This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
forked from mulesoft-labs/raml-tutorial-200
-
Notifications
You must be signed in to change notification settings - Fork 27
/
jukebox-api.raml
193 lines (187 loc) · 5.95 KB
/
jukebox-api.raml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#%RAML 1.0
---
title: Jukebox API
baseUri: http://jukebox.api.com
version: v1
types:
song: !include jukebox-include-song.schema
artist: !include jukebox-include-artist.schema
album: !include jukebox-include-album.schema
resourceTypes:
readOnlyCollection:
description: Collection of available <<resourcePathName>> in Jukebox.
get:
description: Get a list of <<resourcePathName>>.
responses:
200:
body:
application/json:
example: |
<<exampleCollection>>
collection:
description: Collection of available <<resourcePathName>> in Jukebox.
get:
description: Get a list of <<resourcePathName>>.
responses:
200:
body:
application/json:
example: |
<<exampleCollection>>
post:
description: |
Add a new <<resourcePathName|!singularize>> to Jukebox.
queryParameters:
access_token:
description: "The access token provided by the authentication application"
example: AABBCCDD
required: true
type: string
body:
application/json:
type: <<resourcePathName|!singularize>>
example: |
<<exampleItem>>
responses:
200:
body:
application/json:
example: |
{ "message": "The <<resourcePathName|!singularize>> has been properly entered" }
collection-item:
description: Entity representing a <<resourcePathName|!singularize>>
get:
description: |
Get the <<resourcePathName|!singularize>>
with <<resourcePathName|!singularize>>Id =
{<<resourcePathName|!singularize>>Id}
responses:
200:
body:
application/json:
example: |
<<exampleItem>>
404:
body:
application/json:
example: |
{"message": "<<resourcePathName|!singularize>> not found" }
traits:
searchable:
queryParameters:
query:
description: |
JSON array [{"field1","value1","operator1"},{"field2","value2","operator2"},...,{"fieldN","valueN","operatorN"}] <<description>>
example: |
<<example>>
orderable:
queryParameters:
orderBy:
description: |
Order by field: <<fieldsList>>
type: string
required: false
order:
description: Order
enum: [desc, asc]
default: desc
required: false
pageable:
queryParameters:
offset:
description: Skip over a number of elements by specifying an offset value for the query
type: integer
required: false
example: 20
default: 0
limit:
description: Limit the number of elements on the response
type: integer
required: false
example: 80
default: 10
/songs:
type:
collection:
exampleCollection: !include jukebox-include-songs.sample
exampleItem: !include jukebox-include-song-new.sample
get:
is: [
searchable: {description: "with valid searchable fields: songTitle", example: "[\"songTitle\", \"Get L\", \"like\"]"},
orderable: {fieldsList: "songTitle"},
pageable
]
/{songId}:
type:
collection-item:
exampleItem: !include jukebox-include-song-retrieve.sample
/file-content:
description: The file to be reproduced by the client
get:
description: Get the file content
responses:
200:
body:
application/octet-stream:
example:
!include heybulldog.mp3
post:
description: |
Enters the file content for an existing song entity.
The song needs to be created for the `/songs/{songId}/file-content` to exist.
You can use this second resource to get and post the file to reproduce.
Use the "binary/octet-stream" content type to specify the content from any consumer (excepting web-browsers).
Use the "multipart-form/data" content type to upload a file which content will become the file-content
body:
application/octet-stream:
multipart/form-data:
properties:
file:
description: The file to be uploaded
required: true
type: file
/artists:
type:
collection:
exampleCollection: !include jukebox-include-artists.sample
exampleItem: !include jukebox-include-artist-new.sample
get:
is: [
searchable: {description: "with valid searchable fields: countryCode", example: "[\"countryCode\", \"FRA\", \"equals\"]"},
orderable: {fieldsList: "artistName, nationality"},
pageable
]
/{artistId}:
type:
collection-item:
exampleItem: !include jukebox-include-artist-retrieve.sample
/albums:
type:
readOnlyCollection:
exampleCollection: !include jukebox-include-artist-albums.sample
description: Collection of albulms belonging to the artist
get:
description: Get a specific artist's albums list
is: [orderable: {fieldsList: "albumName"}, pageable]
/albums:
type:
collection:
exampleCollection: !include jukebox-include-albums.sample
exampleItem: !include jukebox-include-album-new.sample
get:
is: [
searchable: {description: "with valid searchable fields: genreCode", example: "[\"genreCode\", \"ELE\", \"equals\"]"},
orderable: {fieldsList: "albumName, genre"},
pageable
]
/{albumId}:
type:
collection-item:
exampleItem: !include jukebox-include-album-retrieve.sample
/songs:
type:
readOnlyCollection:
exampleCollection: !include jukebox-include-album-songs.sample
get:
is: [orderable: {fieldsList: "songTitle"}]
description: Get the list of songs for the album with `albumId = {albumId}`