To retrieve a list of Users, an application submits an HTTP GET request to the URL that represents the User resource.
/user
GET
The response header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the retrieved content. |
The response body contains a list containing the following elements in JSON format:
Element | Description |
---|---|
username | Name of the User. |
Email of the User. | |
createdAt | A dateTime value that specifies the date and time the User was created. |
updatedAt | A dateTime value that specifies the date and time the User was last modified. |
sessions | An integer value that specifies the number of sessions belonging to the User. |
Status Code | Description |
---|---|
200-299 | The request was successful. The list of Users are in the response body. |
400 | Bad request. Typically returned if required information was not provided as input. |
500-599 | Server error. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Fri, 22 Oct 2014 08:01:54 GMT
Server: Noelios-Restlet-Engine/1.1.5
[
{
"username": "johndoe",
"email": "john.doe@example.com",
"createdAt": "2014-02-12 03:34:51",
"updatedAt": "2014-02-12 03:34:51",
"sessions": 34
},
{
"username": "janedoe",
"email": "jane.doe@example.com",
"createdAt": "2014-02-12 03:34:51",
"updatedAt": "2014-02-12 03:34:51",
"sessions": 9
}
]
To retrieve information about a User, an application submits an HTTP GET request to the URL that represents the User resource.
/user/:username
, for example, /user/johndoe
to retrieve information about a User with username "johndoe".
GET
The response header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the retrieved content. |
The response body contains the following elements in JSON format:
Element | Description |
---|---|
username | Name of the User. |
Email of the User. | |
createdAt | A dateTime value that specifies the date and time the User was created. |
updatedAt | A dateTime value that specifies the date and time the User was last modified. |
sessions | A list of Session JSON representation. Refer to the Session resource documentation. |
Status Code | Description |
---|---|
200-299 | The request was successful. The User information is in the response body. |
400 | Bad request. Typically returned if required information was not provided as input. |
404 | Not found. The resource was not found. |
500-599 | Server error. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Fri, 22 Oct 2014 08:01:54 GMT
Server: Noelios-Restlet-Engine/1.1.5
{
"username": "janedoe",
"email": "jane.doe@example.com",
"createdAt": "2014-02-12 03:34:51",
"updatedAt": "2014-02-12 03:34:51",
"sessions":
[
{
"id": 1,
"name": "Session A",
"description": "This is a description for a Session",
"createdAt": "2014-02-12 03:34:51",
"updatedAt": "2014-02-12 03:34:51",
"testPlan":
{
"id": 12,
"name": "ViPR Test plan"
},
"executions": 42,
"latest_execution_at": "2014-02-12 03:34:51"
},
{
"id": 2,
"name": "ViPR Session 1",
"description": "This is a description for a Session",
"createdAt": "2014-02-12 03:34:51",
"updatedAt": "2014-02-12 03:34:51",
"testPlan":
{
"id": 12,
"name": "ViPR Test plan"
},
"executions": 634,
"latest_execution_at": "2014-02-12 03:34:51"
}
]
}
An application can create a User by issuing an HTTP POST request to the URL of the containing User resource
/user/
POST
The request header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the retrieved content. |
JSON input that contains a User representation with the following elements:
Element | Description |
---|---|
username | Username. |
Email of the User. | |
password | Password of the User |
POST https://api.heliosburn.com/user/ HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.heliosburn.com
Content-Length: 294
Content-Type: application/json; charset=UTF-8
{
"username": "johndoe",
"email": "johndoe@example.com",
"password": "Super secure password"
}
The response header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the content. |
Location | The location of the newly created Test Plan. |
Status Code | Description |
---|---|
200-299 | The request was successful. The Session was successfully created. |
400 | Bad request. Typically returned if required information was not provided as input. |
500-599 | Server error. |
HTTP/1.1 201 Created
Content-Type: application/octet-stream; charset=UTF-8
Content-Length: 0
Date: Wed, 14 Dec 2014 19:35:02 GMT
Location: http://api.heliosburn.com/user/johndoe
Server: Noelios-Restlet-Engine/1.1.5
An application can update a User by issuing an HTTP PUT request to the URL of the containing User resource. In addition, the app needs to provide as input, JSON that identifies the new attribute values for the User. Upon receiving the PUT request, the HeliosBurn service examines the input and updates any of the attributes that have been modified.
/user/:username
, for example, /user/johndoe
to update the User with username "johndoe".
PUT
The request header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the retrieved content. |
JSON input that contains a User representation with the elements to be modified:
Element | Description |
---|---|
Email of the User. | |
password | Password of the User |
PUT https://api.heliosburn.com/user/johndoe HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.heliosburn.com
Content-Length: 294
Content-Type: application/json; charset=UTF-8
{
"email": "johndoe@example.com",
"password": "Super secure password"
}
The response header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the content. |
Status Code | Description |
---|---|
200-299 | The request was successful. The Session was successfully updated. |
400 | Bad request. Typically returned if required information was not provided as input. |
404 | Not found. The resource was not found. |
500-599 | Server error. |
HTTP/1.1 200 OK
Content-Type: application/octet-stream; charset=UTF-8
Content-Length: 0
Date: Wed, 14 Dec 2014 19:35:02 GMT
Access-Control-Allow-Origin: *
Server: Noelios-Restlet-Engine/1.1.5
An application can permanently delete a User by issuing an HTTP DELETE request to the URL of the User resource. It's a good idea to precede DELETE requests like this with a caution note in your application's user interface.
/user/:username
, for example, /user/johndoe
to delete the User with username "johndoe".
DELETE
DELETE https://api.heliosburn.com/user/johndoe HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.heliosburn.com
Content-Length: 0
Content-Type: application/json; charset=UTF-8
The response header includes the following information:
Field | Description |
---|---|
Content-Type | The content type and character encoding of the response. |
Content-Length | The length of the content. |
Status Code | Description |
---|---|
200-299 | The request was successful. The User was successfully deleted. |
400 | Bad request. Typically returned if required information was not provided as input. |
404 | Not found. The resource was not found. |
500-599 | Server error. |
HTTP/1.1 204 No Content
Content-Type: application/octet-stream; charset=UTF-8
Content-Length: 0
Date: Wed, 14 Dec 2014 19:35:02 GMT
Access-Control-Allow-Origin: *
Server: Noelios-Restlet-Engine/1.1.5