lab¶
More info about the lab schema can be found here.
Note
This resource can also be accessed using the plural form labs
.
GET¶
-
GET
/lab/
(string: id)/
¶ Get all the available registered lab or a single one if
id
is provided.Parameters: - id (string) – The ID of the lab to retrieve.
Request Headers: - Authorization – The token necessary to authorize the request.
- Accept-Encoding – Accept the
gzip
coding.
Response Headers: - Content-Type – Will be
application/json; charset=UTF-8
.
Query Parameters: - limit (int) – Number of results to return. Default 0 (all results).
- skip (int) – Number of results to skip. Default 0 (none).
- sort (string) – Field to sort the results on. Can be repeated multiple times.
- sort_order (int) – The sort order of the results: -1 (descending), 1
(ascending). This will be applied only to the first
sort
parameter passed. Default -1. - date_range (int) – Number of days to consider, starting from today (more info). By default consider all results.
- field (string) – The field that should be returned in the response. Can be repeated multiple times.
- nfield (string) – The field that should not be returned in the response. Can be repeated multiple times.
- _id (string) – The internal ID of the registered lab.
- created_on (string) – The creation date: accepted formats are
YYYY-MM-DD
andYYYYMMDD
. - name (string) – The name of the lab.
- private (boolean) – If the lab is private or not.
- token (string) – The ID of the token associated with the lab.
Status Codes: - 200 OK – Results found.
- 403 Forbidden – Not authorized to perform the operation.
- 404 Not Found – The provided resource has not been found.
- 500 Internal Server Error – Internal database error.
Example Requests
GET /lab/ HTTP/1.1 Host: api.kernelci.org Accept: */* Authorization: token
GET /boot/lab-01 HTTP/1.1 Host: api.kernelci.org Accept: */* Authorization: token
Example Responses
HTTP/1.1 200 OK Vary: Accept-Encoding Date: Tue, 10 Nov 2014 12:28:50 GMT Content-Type: application/json; charset=UTF-8 { "code": 200, "result": [ { "name": "lab-01", "private": false, "address": { "street_1": "Example street" }, "contact": { "name": "Name", "surname": "Surname", "email": "example@example.net" } }, ], }
Note
Results shown here do not include the full JSON response.
POST¶
-
POST
/lab
¶ Create a new lab document as defined in the JSON data.
For more info on all the required JSON request fields, see the lab schema.
Request JSON Object: - name (string) – The name that should be given to the lab.
- contact (object) – The contact data associated with the lab.
Request Headers: - Authorization – The token necessary to authorize the request.
- Content-Type – Content type of the transmitted data, must be
application/json
. - Accept-Encoding – Accept the
gzip
coding.
Response Headers: - Content-Type – Will be
application/json; charset=UTF-8
.
Status Codes: - 201 Created – The request has been accepted and the lab created.
- 400 Bad Request – JSON data not valid, or provided name for the lab already exists.
- 403 Forbidden – Not authorized to perform the operation.
- 415 Unsupported Media Type – Wrong content type.
- 422 Unprocessable Entity – No real JSON data provided.
Example Requests
POST /lab HTTP/1.1 Host: api.kernelci.org Content-Type: application/json Accept: */* Authorization: token { "name": "lab-01", "contact": { "name": "Name", "surname": "Surname", "email": "example@example.net" } }
PUT¶
-
PUT
/lab/
(string: id)¶ Update an existing lab document identified by the
id
value.For more info on all the required JSON request fields, see the lab schema.
Request Headers: - Authorization – The token necessary to authorize the request.
- Content-Type – Content type of the transmitted data, must be
application/json
. - Accept-Encoding – Accept the
gzip
coding.
Response Headers: - Content-Type – Will be
application/json; charset=UTF-8
.
Status Codes: - 200 OK – The request has been accepted and the lab updated.
- 400 Bad Request – JSON data not valid, or provided name for the lab already exists.
- 403 Forbidden – Not authorized to perform the operation.
- 404 Not Found – The provided resource has not been found.
- 415 Unsupported Media Type – Wrong content type.
- 422 Unprocessable Entity – No real JSON data provided.
Example Requests
PUT /lab/0123456789ab0123456789ab HTTP/1.1 Host: api.kernelci.org Content-Type: application/json Accept: */* Authorization: token { "name": "update-lab-name", }
DELETE¶
-
DELETE
/lab/
(string: id)¶ Delete the lab document identified by the
id
value.Parameters: - id (string) – The ID of the lab document to delete.
Request Headers: - Authorization – The token necessary to authorize the request.
- Accept-Encoding – Accept the
gzip
coding.
Response Headers: - Content-Type – Will be
application/json; charset=UTF-8
.
Query Parameters: - _id (string) – The internal ID of the registered lab.
- private (string) – If the lab is private or not.
- token (string) – The ID of token associated with the lab.
Status Codes: - 200 OK – Resource deleted.
- 403 Forbidden – Not authorized to perform the operation.
- 404 Not Found – The provided resource has not been found.
- 500 Internal Server Error – Internal database error.
Example Requests
DELETE /lab/0123456789ab0123456789ab HTTP/1.1 Host: api.kernelci.org Accept: */* Content-Type: application/json Authorization: token