java-tutorials/raml/introduction/0.8/api.raml

102 lines
2.5 KiB
Plaintext

#%RAML 0.8
title: Baeldung Foo REST Services API
version: v1
protocols: [ HTTPS ]
baseUri: http://rest-api.baeldung.com/api/{version}
mediaType: application/json
securitySchemes:
- basicAuth:
description: Each request must contain the headers necessary for
basic authentication
type: Basic Authentication
describedBy:
headers:
Authorization:
description: Used to send the Base64 encoded "username:password"
credentials
type: string
responses:
401:
description: |
Unauthorized. Either the provided username and password
combination is invalid, or the user is not allowed to access
the content provided by the requested URL.
schemas:
- foo: !include foo.json
- foos: !include foos.json
- error: !include error.json
/foos:
get:
description: List all Foos matching query criteria, if provided;
otherwise list all Foos
queryParameters:
name:
type: string
required: false
ownerName:
type: string
required: false
responses:
200:
body:
application/json:
schema: foos
example: !include foos-example.json
post:
description: Create a new Foo
body:
application/json:
schema: foo
example: foo-example.json
responses:
201:
body:
application/json:
schema: foo
example: foo-example.json
/{id}:
get:
description: Get a Foo by id
responses:
200:
body:
application/json:
schema: foo
404:
body:
application/json:
schema: error
put:
description: Update a Foo by id
body:
application/json:
schema: foo
example: foo-example.json
responses:
200:
body:
application/json:
schema: foo
404:
body:
application/json:
schema: error
delete:
description: Delete a Foo by id
responses:
204:
404:
body:
application/json:
schema: error
/name/{name}:
get:
description: List all Foos with a certain name
responses:
200:
body:
application/json:
schema: foos
example: !include foos-example.json