-
Notifications
You must be signed in to change notification settings - Fork 2
API Documentation
All POST requests require a token authentication header. An API token can be generated for a particular user from the administrator dashboard. The authentication header should look something like this (note the word Token followed by a space and then the token):
Authorization: Token 8fea4cfd3c5494ec305bf0db59428e89514bcc27
Available methods: GET, HEAD, OPTIONS
Provides information about available endpoints.
Sample response to GET:
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS
{
"resource": "http://127.0.0.1:8000/rest/resource/",
"localresource": "http://127.0.0.1:8000/rest/localresource/",
"remoteresource": "http://127.0.0.1:8000/rest/remoteresource/"
}Available methods: GET, HEAD, OPTIONS
Sample response:
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS
[
{
"url": "http://127.0.0.1:8000/rest/resource/14/",
"name": "TestResource",
"stored": "Local",
"content_location": "/content/10578099.txt"
},
{
"url": "http://127.0.0.1:8000/rest/resource/16/",
"name": "Serializer Fields",
"stored": "Remote",
"content_location": "http://www.django-rest-framework.org/api-guide/fields/#serializermethodfield"
}
]Available methods: GET, POST, HEAD, OPTIONS
LocalResources are Resources whose content lives inside JARS. Each LocalResource can have one (and only one) file associated with it.
Sample response:
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
[
{
"url": "http://127.0.0.1:8000/rest/localresource/14/",
"name": "TestResource",
"stored": "Local",
"content_location": "/content/10578099.txt"
}
]Create a new LocalResource.
Sample request (with file data included):
Request Url: http://127.0.0.1:8000/rest/localresource/
Request Method: POST
Status Code: 201
Files: {
"0": {
"webkitRelativePath": "",
"lastModified": 1426969670000,
"lastModifiedDate": "2015-03-21T20:27:50.000Z",
"name": "201503 - Peirson - CV.pdf",
"type": "application/pdf",
"size": 74440
},
"length": 1
}
Params: {
"name": "testPayload12"
}Sample response:
{
"url": "http://127.0.0.1:8000/rest/localresource/29/",
"name": "testPayload12",
"stored": "Local",
"content_location": "/content/201503%20-%20Peirson%20-%20CV_eWhjU3A.pdf"
}Available methods: GET, POST, HEAD, OPTIONS
Sample JSON request:
{
"name": "Hillary Clinton Addresses Baltimore, Race and Justice in Impassioned Speech",
"location": "http://www.nytimes.com/2015/04/30/us/politics/baltimore-forces-presidential-hopefuls-to-confront-a-jarring-crisis.html?_r=0"
}Amphora documentation is provided under a CC0 1.0 Universal (CC0 1.0) license.