Admin API¶
Endpoints¶
| Resource | Operation | Description |
|---|---|---|
| About | POST /api/admin/about/update | Updates ODS application settings. |
| GET /api/admin/about | Returns ODS application settings. | |
| ODS | GET /api/admin/registered_ods | Returns a list of all registered ODS instances. |
| POST /api/admin/register | Register with another ODS instance. | |
| Packages | GET /api/admin/packages | Returns a list of all packages on the server. |
| GET /api/admin/packages/(package_id_or_name) | Returns a single package by the database ID or | |
| System | GET /api/admin/system | Returns system information. |
| Upload | POST /api/admin/upload | Upload a file to the ODS. |
Reference¶
-
GET/api/admin/about¶ Returns ODS application settings.
Example Request:
GET /api/admin/about HTTP/1.1 Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "firewalled_mode": false, "iss": "e7becdda9a9046f6a78f69ef591e9835", "key": "r3Yt354eDTY0JkaiObpsM4krfkDzdZD9NNYwDr9aSk0=", "name": "Example ODS", "stage": "Prod", "url": "http://192.168.99.100" }
-
POST/api/admin/about/update¶ Updates ODS application information and settings.
Note
You cannot update the
issorkeyvalues!Accepted values for
stageare:Dev,Test,ProdAccepted values for
firewalled_modeare:Enabled,DisabledExample Request:
POST /api/admin/about HTTP/1.1 Content-Type: application/json { "name": "Example ODS", "url": "http://192.168.99.100", "firewalled_mode": "Disabled", "stage": "Prod" }
Example Response:
HTTP/1.1 201 OK Content-Type: text/html
-
GET/api/admin/packages¶ Returns a list of all packages on the server. The
package objectsare nested under anitemskey.createdvalue is in ISO 8601 format (without microseconds).created_tsvalue is a Unix timestamp (time since Epoch).file_sizevalue is represented in total bytes.file_size_hris a human readable representation.Example Request:
GET /api/admin/packages HTTP/1.1 Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "items": [ { "created": "2017-11-11T03:15:54", "created_ts": 1510370154, "file_size": 3438044, "file_size_hr": "3.3 MB", "filename": "NoMAD.pkg", "id": 1, "sha1": "3fab53c6f12e3d4621b17f728e9b3c522bb90816", "stage": "Prod", "status": "Public", "uuid": "28f7adde4f674873807a4c8c69b641d0" } ] }
-
GET/api/admin/packages/(package_id_or_name)¶ Returns a single package by the database ID or filename.
createdvalue is in ISO 8601 format (without microseconds).created_tsvalue is a Unix timestamp (time since Epoch).file_sizevalue is represented in total bytes.file_size_hris a human readable representation.chunksis an array of indexed hashes for each 1 MB block of the file.Example Request:
GET /api/admin/packages/1 HTTP/1.1 Accept: application/json
GET /api/admin/packages/NoMAD.pkg HTTP/1.1 Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "created": "2017-11-11T03:15:54", "created_ts": 1510370154, "file_size": 3438044, "file_size_hr": "3.3 MB", "filename": "NoMAD.pkg", "id": 1, "sha1": "3fab53c6f12e3d4621b17f728e9b3c522bb90816", "stage": "Prod", "status": "Public", "uuid": "28f7adde4f674873807a4c8c69b641d0" "chunks": [ { "index": 0, "sha1": "f34fef9be0364d92424106c19596d3fcd1676635" }, { "index": 1, "sha1": "93633f00f71d3b5494b23b74b37777bc07f9d713" }, { "index": 2, "sha1": "9e0ca33c872fb9b5d7aa46fbd865c309db792c12" }, { "index": 3, "sha1": "468521469da7fd40ee72f18e70bf578f055b3878" } ], }
-
POST/api/admin/register¶ Register with another ODS instance.
Example Request:
POST /api/admin/register HTTP/1.1 Content-Type: application/json { "url":"http://192.168.99.101", "iss_id":"e7becdda9a9046f6a78f69ef591e9835", "key":"r3Yt354eDTY0JkaiObpsM4krfkDzdZD9NNYwDr9aSk0=" }
Example Response:
HTTP/1.1 201 OK Content-Type: text/html
-
GET/api/admin/registered_ods¶ Returns a list of all registered ODS instances. The
ods server objectsare nested under anitemskey.registered_onvalue is in ISO 8601 format (without microseconds).registered_on_tsvalue is a Unix timestamp (time since Epoch).Example Request:
GET /api/admin/registered_ods HTTP/1.1 Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "items": [ { "firewalled_mode": false, "id": 1, "name": "Example ODS 2", "registered_on": "2017-11-10T04:45:47", "registered_on_ts": 1510289147, "stage": "Prod", "url": "http://192.168.99.101" } ] }
-
GET/api/admin/system¶ Returns system information.
disk_,mem_, andnetwork_values are represented in total bytes.uptimeis represented in total seconds.Human readable values are denoted by the
_hrsuffix.Example Request:
GET /api/admin/system HTTP/1.1 Accept: application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "cpu_count": 2, "disk_free": 60352081920, "disk_free_hr": "56.2 GB", "disk_total": 67371577344, "disk_total_hr": "62.7 GB", "disk_used": 3566796800, "disk_used_hr": "3.3 GB", "mem_available": 936255488, "mem_available_hr": "892.9 MB", "mem_total": 1567678464, "mem_total_hr": "1.5 GB", "mem_used": 444342272, "mem_used_hr": "423.8 MB", "network_bytes_received": 54346, "network_bytes_received_hr": "53.1 KB", "network_bytes_sent": 45694, "network_bytes_sent_hr": "44.6 KB", "uptime": 30806, "uptime_hr": "8:33:26" }
-
POST/api/admin/upload¶ Upload a file to the ODS.
Accepted values for
stageare:Dev,Test,ProdExample Request:
POST /api/admin/register HTTP/1.1 Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryvvcON8g8Lh1D16BS ------WebKitFormBoundaryvvcON8g8Lh1D16BS Content-Disposition: form-data; name="file"; filename="NoMAD.pkg" Content-Type: application/octet-stream ------WebKitFormBoundaryvvcON8g8Lh1D16BS Content-Disposition: form-data; name="stage" Prod ------WebKitFormBoundaryvvcON8g8Lh1D16BS--
Example Response:
HTTP/1.1 201 OK Content-Type: application/json { "filename": "NoMAD.pkg", "sha1": "3fab53c6f12e3d4621b17f728e9b3c522bb90816" }