Entity¶
/api/repositories/{repository}/entities/{entity}
Parameter | Type | Purpose |
---|---|---|
repository | string | The name of the Repository to access |
entity | int | The ID of the entity to view |
Show¶
-
GET
/api/repositories/
(string: repository)/entities/
(int: entityID)¶ Get the metadata for an entity.
GET /api/repositories/jupiter/entities/1 HTTP/1.1
Accept: application/json
Response Code | Reason |
---|---|
200 | No error |
500 | Server error |
The response is a JSON string containing two values:
Columns¶
The columns value is a JSON array describing the columns that make up the data rows.
Each element in the array is a JSON list containing the following keys:
Key | Description |
---|---|
columnisedName | The column name for computer consumption |
humanisedName | The column name for human consumption |
description | Description of the column |
{
"columns": [
{
"columnisedName": "_col0",
"humanisedName": "Metadata",
"description": "The name of the metadata statistic"
},
{
"columnisedName": "_col1",
"humanisedName": "Value",
"description": "The value of the metadata statistic"
},
{
"columnisedName": "_col2",
"humanisedName": "Description",
"description": "A description of the metadata statistic"
}
]
}
Rows¶
The rows value is a JSON array. Each element consists of one or two values:
Key | Desciption |
---|---|
dataRow | An array containing the data for the row; will have as many elements as there are Columns |
metadata | A JSON list containing metadata for the data row (see below); appears only in rows having appropriate metadata available |
The row metadata contains the following value:
Key | Description |
---|---|
url | The URL to get the data item |
{
"rows": [
...
{
"dataRow": [
"Rows",
"9999",
"The number of loaded rows"
],
"metadata": {
"url": "/api/repositories/test/entities/2/rows"
}
},
{
"dataRow": [
"Values",
"39642",
"The number of distinct values loaded (across all attributes)"
]
},
...
]
}
Load¶
-
POST
/api/repositories/
(string: repository)/entities/
(int: entityID)¶ Load data to an entity.
POST /api/repositories/jupiter/entities/1 HTTP/1.1
Content-Type: application/json
{
"command": "load",
"data": {
"jobName": "my delimited load",
"scheduleNow": "0",
"scheduleTime": "2016-05-05 17:30:45"
}
}
Response Code | Reason |
---|---|
204 | No error |
400 | Invalid data passed with request |
500 | Server error |
The request packet must contain the command
and data
elements. The options
element is not required.
The following table shows which fields are required in data
element:
Field | Required |
---|---|
jobName | Yes |
scheduleNow | Yes |
scheduleTime | No (if scheduleNow is 1) / Yes (if scheduleNow is 0) |
scheduleNow
field can be formatted as follows:
Value | Description |
---|---|
1 | Schedule the job immediately |
0 | Schedule the job at a given date and time (requires scheduleTime field) |
scheduleTime
field can be formatted as follows:
Value | Example |
---|---|
YYYY-Month-DD HH:MM:SS | 2016-JANUARY-01 10:30:45 |
YYYY/Month/DD HH:MM:SS | 2016/JANUARY/01 10:30:45 |
YYYY-Mon-DD HH:MM:SS | 2016-JAN-01 10:30:45 |
YYYY/Mon/DD HH:MM:SS | 2016/JAN/01 10:30:45 |
YYYY-MM-DD HH:MM:SS | 2016-01-01 10:30:45 |
YYYY/MM/DD HH:MM:SS | 2016/01/01 10:30:45 |
If the command is successful, the response will return the url link to a scheduled job as follows:
{
"url": "/api/repositories/jupiter/scheduler/1"
}
Edit¶
-
POST
/api/repositories/
(string: repository)/entities/
(int: entityID)¶ Edit an entity.
POST /api/repositories/jupiter/entities/1 HTTP/1.1
Content-Type: application/json
{
"command": "edit",
"data": {
"name": "entity name",
"description": "entity description"
}
}
The request packet must contain the command
and data
elements.
Key | Purpose |
---|---|
name | The new name of the entity |
description | The new description for the entity |
The name
field is required. The description
field is optional.
Response Code | Reason |
---|---|
200 | No error |
400 | Invalid data passed with request |
500 | Server error |
If the command is successful, the response will return the url link to an updated entity as follows:
{
"url": "/api/repositories/jupiter/entities/1"
}
Delete¶
-
POST
/api/repositories/
(string: repository)/entities
¶ Delete one or more entities.
DELETE /api/repositories/jupiter/entities HTTP/1.1
Content-Type: application/json
{
"command": "delete",
"data": {
"entityId": ["198", "199"]
}
}
The request packet must contain the command
and data
elements.
Key | Purpose |
---|---|
entityId | A list of entity IDs. |
To delete only one entity, provide only 1 entity ID:
{
"command": "delete",
"data": {
"entityId": ["200"]
}
}
Response Code | Reason |
---|---|
200 | No error |
400 | Invalid data passed with request |
500 | Server error |
If the command is successful, the response will return the url link to the scheduled job:
{
"url": "/api/repositories/jupiter/scheduler/136"
}