-
Notifications
You must be signed in to change notification settings - Fork 0
Endpoint Reference
Every API call needs to be authorized using an access token from an supported OAuth2.0 provider. Learn more on how to make an authorized request.
Method | Endpoint | Parameter | Usage | Returns |
---|---|---|---|---|
GET | /api/user/me | eisLS | Authenticate an user and make sure he exists in the database | User*, [Upload]* |
GET | /api/upload | eisLS | Get a list of uploads for a user | User*, [Upload]* |
GET | /api/upload/{id} | eis | Get informations about a single upload | Upload, User* |
POST | /api/upload | eis | Upload a new upload | Upload, User* |
The Endpoint Reference List contains all callable API URLs. For a quicker overview a few abbreviations are being used.
eisLS
stands for exclude, include, select, limit, skip. You can use any of the assigned parameters in the URL of your request to modify the response.
eis
is available everywhere.
-
?exclude=key
removeskey
from the response object -
?include=key.sub
includessub
in a nested object back to the response, when it was removed -
?select=key
is a shorthand vor?exclude=all&include=key
- You don't have to respect arrays. Just pretend it would be one single item of the array as a object.
LS
is available when the response contains a list.
-
?limit=5
limits the list to 5 items (default: 10) -
?skip=5
skips the first 5 items, before applyinglimit
(default: 0)
This gives you a quick overview which objects you will get in the response when performing a request.
- ObjA, ObjB: Both ObjA and ObjB are in the first level of the response object.
- ObjA, ObjB*: ObjA will be in the first level, ObjB in a second level of the response object.
- ObjA, [ObjB]*: ObjA will be in the first level, ObjB is an array in the second level of the response object.
This will make a Request to the OAuth2.0 Provider to look for changed profile informations. You should use this in appropriate situations like starting the app or looking for changes in a users profile.
GET https://localhost:3000/api/user/me
Header field | Description |
---|---|
Authorization | A valid OAuth2.0 Access Token from a supported OAuth2.0 Provider. |
x-auth-provider | The name of a supported OAuth2.0 Provider. Possible values are: google . |
Parameter | Description |
---|---|
exclude | A key or a path to a key to exclude from the response. |
include | A key or a path to a key to include to the response, if it was excluded. |
select | Alias for include , exclude will be set to all . |
limit | Number of returned Upload Items in the response. Default: 10 |
skip | Number of skipped Upload Items before executing limit . Default: 0
|
On success the HTTP Status Code is 200 OK
. The response body contains a JSON with the User Object in the key user
and an Array with Upload Objects in the key uploads
.
curl -X GET https://localhost:3000/api/user/me&limit=2 -H "Authorization: Bearer <access token>" -H "x-auth-provider: google"
{
"user": {
"id": "546ce2cadc7c0162336090e2",
"name": "John Doe",
"email": "[email protected]",
"image": "https://lh4.googleusercontent.com/-xUelHR_l_mk/AAAAAAAAAAI/AAAAAAAACS4/zvs8v_wLjyo/photo.jpg",
"oauth": {
"provider": "google",
"id": "123456789098765430000"
},
"quota": {
"used": 2058304,
"total": 10000000000,
"count": 4
}
},
"uploads": [
{
"id": "546ce32ad0358b7a33bb9b23",
"userid": "546ce2cadc7c0162336090e2",
"title": "Screen Shot 2014-11-19 at 14.55.53.png",
"shortlink": "https://localhost:3000/mPo2",
"views": 0,
"created": "2014-11-19T18:36:26.130Z",
"publicUrl": "https://localhost:3000/files/pub/YTc3MzhhYmJkMDYxMWUxMTY1NmE4ZTZmYzUzNDY1OTQ0YjAzYzAzMg==/1416995530765/546ce2cadc7c0162336090e2/7e2bc5903ca394f989aeb1c128bdd892.png",
"size": 85962,
"mimetype": "image/png"
},
{
"id": "546dde63f2ff08d957c1828f",
"userid": "546ce2cadc7c0162336090e2",
"title": "img_201411323_172225.jpg",
"shortlink": "https://localhost:3000/qy9e",
"views": 0,
"created": "2014-11-20T12:28:19.811Z",
"publicUrl": "https://localhost:3000/files/pub/NjZlZTQ2MDQ2MGI0MWI3NTZkOWU0N2YyZWUyZWI0ZmQwNDJlMjE5Ng==/1416995530765/546ce2cadc7c0162336090e2/4660291b78d67e24d5e76aa5756c840d.jpg",
"size": 1904772,
"mimetype": "image/jpeg"
}
]
}
GET https://localhost:3000/api/upload
Header field | Description |
---|---|
Authorization | A valid OAuth2.0 Access Token from a supported OAuth2.0 Provider. |
x-auth-provider | The name of a supported OAuth2.0 Provider. Possible values are: google . |
Parameter | Description |
---|---|
exclude | A key or a path to a key to exclude from the response. |
include | A key or a path to a key to include to the response, if it was excluded. |
select | Alias for include , exclude will be set to all . |
limit | Number of returned Upload Items in the response. Default: 10 |
skip | Number of skipped Upload Items before executing limit . Default: 0
|
On success the HTTP Status Code is 200 OK
. The response body contains a JSON with the User Object in the key user
and an Array with Upload Objects in the key uploads
.
curl -X GET https://localhost:3000/api/upload&limit=2 -H "Authorization: Bearer <access token>" -H "x-auth-provider: google"
{
"user": {
"id": "546ce2cadc7c0162336090e2",
"name": "John Doe",
"email": "[email protected]",
"image": "https://lh4.googleusercontent.com/-xUelHR_l_mk/AAAAAAAAAAI/AAAAAAAACS4/zvs8v_wLjyo/photo.jpg",
"oauth": {
"provider": "google",
"id": "123456789098765430000"
},
"quota": {
"used": 2058304,
"total": 10000000000,
"count": 4
}
},
"uploads": [
{
"id": "546ce32ad0358b7a33bb9b23",
"userid": "546ce2cadc7c0162336090e2",
"title": "Screen Shot 2014-11-19 at 14.55.53.png",
"shortlink": "https://localhost:3000/mPo2",
"views": 0,
"created": "2014-11-19T18:36:26.130Z",
"publicUrl": "https://localhost:3000/files/pub/YTc3MzhhYmJkMDYxMWUxMTY1NmE4ZTZmYzUzNDY1OTQ0YjAzYzAzMg==/1416995530765/546ce2cadc7c0162336090e2/7e2bc5903ca394f989aeb1c128bdd892.png",
"size": 85962,
"mimetype": "image/png"
},
{
"id": "546dde63f2ff08d957c1828f",
"userid": "546ce2cadc7c0162336090e2",
"title": "img_201411323_172225.jpg",
"shortlink": "https://localhost:3000/qy9e",
"views": 0,
"created": "2014-11-20T12:28:19.811Z",
"publicUrl": "https://localhost:3000/files/pub/NjZlZTQ2MDQ2MGI0MWI3NTZkOWU0N2YyZWUyZWI0ZmQwNDJlMjE5Ng==/1416995530765/546ce2cadc7c0162336090e2/4660291b78d67e24d5e76aa5756c840d.jpg",
"size": 1904772,
"mimetype": "image/jpeg"
}
]
}
GET https://localhost:3000/api/upload/{id}
Header field | Description |
---|---|
Authorization | A valid OAuth2.0 Access Token from a supported OAuth2.0 Provider. |
x-auth-provider | The name of a supported OAuth2.0 Provider. Possible values are: google . |
Parameter | Description |
---|---|
exclude | A key or a path to a key to exclude from the response. |
include | A key or a path to a key to include to the response, if it was excluded. |
select | Alias for include , exclude will be set to all . |
On success the HTTP Status Code is 200 OK
. The response body contains a JSON with the Upload Object and the User Object in the key user
.
curl -X GET https://localhost:3000/api/upload/546ce32ad0358b7a33bb9b23 -H "Authorization: Bearer <access token>" -H "x-auth-provider: google"
{
"id": "546ce32ad0358b7a33bb9b23",
"userid": "546ce2cadc7c0162336090e2",
"title": "Screen Shot 2014-11-19 at 14.55.53.png",
"shortlink": "https://localhost:3000/mPo2",
"views": 0,
"created": "2014-11-19T18:36:26.130Z",
"publicUrl": "https://localhost:3000/files/pub/NzljYTdlMDg5OTllNjRhYmZiOGNhNDk5ZTdiNjgxZDk3MmY5MWZiZQ==/1416995979409/546ce2cadc7c0162336090e2/7e2bc5903ca394f989aeb1c128bdd892.png",
"size": 85962,
"mimetype": "image/png",
"user": {
"id": "546ce2cadc7c0162336090e2",
"name": "John Doe",
"email": "[email protected]",
"image": "https://lh4.googleusercontent.com/-xUelHR_l_mk/AAAAAAAAAAI/AAAAAAAACS4/zvs8v_wLjyo/photo.jpg",
"oauth": {
"provider": "google",
"id": "123456789098765430000"
},
"quota": {
"used": 2058304,
"total": 10000000000,
"count": 4
}
}
}
POST https://localhost:3000/api/upload
Header field | Description |
---|---|
Authorization | A valid OAuth2.0 Access Token from a supported OAuth2.0 Provider. |
x-auth-provider | The name of a supported OAuth2.0 Provider. Possible values are: google . |
Parameter | Description |
---|---|
exclude | A key or a path to a key to exclude from the response. |
include | A key or a path to a key to include to the response, if it was excluded. |
select | Alias for include , exclude will be set to all . |
On success the HTTP Status Code is 201 Created
. The response body contains a JSON with the Upload Object and the User Object in the key user
.
curl -X POST https://localhost:3000/api/upload -H "Authorization: Bearer <access token>" -H "x-auth-provider: google"
{
"id": "5475a5eff948e7bcce205b02",
"userid": "546ce2cadc7c0162336090e2",
"title": "Screen Shot 2014-11-26 at 11.05.32.png",
"shortlink": "https://localhost:3000/Jhe9",
"views": 0,
"created": "2014-11-26T10:05:35.824Z",
"publicUrl": "https://localhost:3000/files/pub/YWYyYmU3NTAzMWZmZGVkYjU5Y2E3YjA1YTBjMDdkNDE0YWEyYWZiNw==/1416996335833/546ce2cadc7c0162336090e2/a92777f0c026968672fbcf6b6391de24.png",
"size": 18891,
"mimetype": "image/png",
"user": {
"id": "546ce2cadc7c0162336090e2",
"name": "John Doe",
"email": "[email protected]",
"image": "https://lh4.googleusercontent.com/-xUelHR_l_mk/AAAAAAAAAAI/AAAAAAAACS4/zvs8v_wLjyo/photo.jpg",
"oauth": {
"provider": "google",
"id": "123456789098765430000"
},
"quota": {
"used": 2077195,
"total": 10000000000,
"count": 5
}
}
}