1. Framework¶
1.1. Types¶
-
GET
/rest/types/
¶ HTTP GET/HEAD rest route. HEAD will be the same result except their will be no body.
Example request:
GET /rest/types/ HTTP/1.1 Host: datagerry.com Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 3311 X-Total-Count: 1 X-API-Version: 1.0 { "results": [ { "public_id": 1, "name": "example", "active": true, "author_id": 1, "creation_time": "", "label": "Example", "version": "1.0.0", "description": "", "render_meta": { "icon": "", "sections": [ { "type": "section", "name": "example", "label": "Example", "fields": [ "f" ] } ], "externals": [ { "name": "example", "href": "https://example.org", "label": "Example", "icon": "fas fa-external-link-alt", "fields": [] } ], "summary": { "fields": [ "f" ] } }, "fields": [ { "type": "text", "name": "f", "label": "F" } ] } ], "count": 1, "total": 1, "parameters": { "limit": 10, "sort": "public_id", "order": 1, "page": 1, "filter": {}, "optional": {} }, "pager": { "page": 1, "page_size": 10, "total_pages": 1 }, "pagination": { "current": "http://datagerry.com/rest/types/", "first": "http://datagerry.com/rest/types/?page=1", "prev": "http://datagerry.com/rest/types/?page=1", "next": "http://datagerry.com/rest/types/?page=1", "last": "http://datagerry.com/rest/types/?page=1" }, "response_type": "GET", "model": "Type", "time": "1970-01-01T00:00:00" }
- Query Parameters
sort – the sort field name. default is public_id
order – the sort order value for ascending or descending. default is 1 for ascending
page – the current view page. default is 1
limit – max number of results. default is 10
filter – a mongodb query filter. default is {} which means everything
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Everything is fine.
400 Bad Request – The request or the parameters are wrong formatted.
404 Not Found – No collection or resources found.
-
GET
/types/
(int: public_id)¶ HTTP GET/HEAD rest route for a single resource by its ID.
Example request
GET /rest/types/1 HTTP/1.1 Host: datagerry.com Accept: application/json
Example response
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 588 X-API-Version: 1.0 { "result": { "public_id": 1, "name": "example", "active": true, "author_id": 1, "creation_time": "", "label": "Example", "version": "1.0.0", "description": "", "render_meta": { "icon": "", "sections": [ { "type": "section", "name": "example", "label": "Example", "fields": [ "f" ] } ], "externals": [ { "name": "example", "href": "https://example.org", "label": "Example", "icon": "fas fa-external-link-alt", "fields": [] } ], "summary": { "fields": [ "f" ] } }, "fields": [ { "type": "text", "name": "f", "label": "F" } ] }, "response_type": "GET", "model": "Type", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Everything is fine.
404 Not Found – No resource found.
-
POST
/types/
¶ HTTP Post route for inserting a new type.
Example request
POST /rest/types/ HTTP/1.1 Host: datagerry.com Accept: application/json
Example response
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 588 Location: http://datagerry.com/rest/types/1 X-API-Version: 1.0 { "result_id": 1, "raw": {}, "response_type": "INSERT", "model": "Type", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Everything is fine.
400 Bad Request – Resource could not be inserted.
404 Not Found – No resource found.
-
PUT
/types/
(int: public_id)¶ HTTP PUT/PATCH route for updating a existing type.
Example request
PUT /rest/types/1 HTTP/1.1 Host: datagerry.com Accept: application/json { }
Example response
HTTP/1.1 202 ACCEPTED Content-Type: application/json Content-Length: 170 Location: http://datagerry.com/rest/categories/1 X-API-Version: 1.0 { "result": { }, "response_type": "UPDATE", "model": "Type", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
202 Accepted – Everything is fine.
400 Bad Request – Resource could not be updated.
404 Not Found – No resource found.
-
DELETE
/type/
(int: public_id)¶ HTTP DELETE route for deleting a existing type.
Example request
DELETE /rest/types/1 HTTP/1.1 Host: datagerry.com Accept: application/json
Example response
HTTP/1.1 202 ACCEPTED Content-Type: application/json Content-Length: 170 X-API-Version: 1.0 { "deleted_entry": { }, "response_type": "DELETE", "model": "Type", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
202 Accepted – Everything is fine.
400 Bad Request – Resource could not be deleted.
404 Not Found – No resource found.
1.2. Categories¶
-
GET
/rest/categories/
¶ HTTP GET/HEAD rest route. HEAD will be the same result except their will be no body.
Example request:
GET /rest/categories/ HTTP/1.1 Host: datagerry.com Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 3311 X-Total-Count: 1 X-API-Version: 1.0 { "results": [ { "public_id": 1, "name": "example", "label": "Example", "meta": { "icon": "", "order": null }, "parent": null, "types": [1] } ], "count": 1, "total": 1, "parameters": { "limit": 10, "sort": "public_id", "order": 1, "page": 1, "filter": {}, "optional": { "view": "list" } }, "pager": { "page": 1, "page_size": 10, "total_pages": 1 }, "pagination": { "current": "http://datagerry.com/rest/categories/", "first": "http://datagerry.com/rest/categories/?page=1", "prev": "http://datagerry.com0/rest/categories/?page=1", "next": "http://datagerry.com/rest/categories/?page=1", "last": "http://datagerry.com/rest/categories/?page=1" }, "response_type": "GET", "model": "Category", "time": "1970-01-01T00:00:00" }
- Query Parameters
sort – the sort field name. default is public_id
order – the sort order value for ascending or descending. default is 1 for ascending
page – the current view page. default is 1
limit – max number of results. default is 10
filter – a mongodb query filter. default is {} which means everything
view – the category view data-structure. Can be list or tree. default is list
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Everything is fine.
400 Bad Request – The request or the parameters are wrong formatted.
404 Not Found – No collection or resources found.
-
GET
/categories/
(int: public_id)¶ The category with the public_id.
Example request
GET /rest/categories/1 HTTP/1.1 Host: datagerry.com Accept: application/json
Example response
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 588 X-API-Version: 1.0 { "result": { "public_id": 1, "name": "example", "label": "Example", "meta": { "icon": "far fa-folder-open", "order": 0 }, "parent": null, "types": [1] }, "response_type": "GET", "model": "Category", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Everything is fine.
404 Not Found – No resource found.
-
POST
/categories/
¶ HTTP Post route for inserting a new category.
Example request
POST /rest/categories/ HTTP/1.1 Host: datagerry.com Accept: application/json { "name": "example", "label": "Example", "meta": { "icon": "", "order": 0 }, "parent": null, "types": [1] }
Example response
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 588 Location: http://datagerry.com/rest/categories/1 X-API-Version: 1.0 { "result_id": 1, "raw": { "public_id": 1, "name": "example", "label": "Example", "meta": { "icon": "", "order": 0 }, "parent": null, "types": [1] }, "response_type": "INSERT", "model": "Category", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Everything is fine.
400 Bad Request – Resource could not be inserted.
404 Not Found – No resource found.
-
PUT
/categories/
(int: public_id)¶ HTTP PUT/PATCH route for updating a existing category.
Example request
PUT /rest/categories/1 HTTP/1.1 Host: datagerry.com Accept: application/json { ""public_id": 1, "name": "example", "label": "Example", "meta": { "icon": "", "order": 0 }, "parent": null, "types": [1] }
Example response
HTTP/1.1 202 ACCEPTED Content-Type: application/json Content-Length: 170 Location: http://datagerry.com/rest/categories/1 X-API-Version: 1.0 { "result": { "public_id": 1, "name": "example2", "label": "Example, "meta": { "icon": "", "order": 0 }, "parent": null, "types": [] }, "response_type": "UPDATE", "model": "Category", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
202 Accepted – Everything is fine.
400 Bad Request – Resource could not be updated.
404 Not Found – No resource found.
-
DELETE
/categories/
(int: public_id)¶ HTTP DELETE route for deleting a existing category.
Example request
DELETE /rest/categories/1 HTTP/1.1 Host: datagerry.com Accept: application/json
Example response
HTTP/1.1 202 ACCEPTED Content-Type: application/json Content-Length: 170 X-API-Version: 1.0 { "deleted_entry": { "public_id": 1, "name": "example", "label": "Example", "meta": { "icon": "", "order": 1 }, "parent": null, "types": [ 1 ] }, "response_type": "DELETE", "model": "Category", "time": "1970-01-01T00:00:00" }
- Request Headers
Accept – application/json
Authorization – jwtoken to authenticate
- Response Headers
Content-Type – application/json
- Status Codes
202 Accepted – Everything is fine.
400 Bad Request – Resource could not be deleted.
404 Not Found – No resource found.