JSON API - Records

  • Updated

NimblexHCBanner.png

 

This page defines the API for accessing records within your Nimblex system, including management of record objects as well as relationships between records and documents attached to them.

Read Record

This function will retrieve the contents of a single record.

GET @apiroot/records/{urlencoded eformtype}/{recordid}

Example Request

NO DATA

Example Response

Success:

// Status: 200 Success
{ "data":{ "type":"record", "id":"Contract/57", "links":{ "self":"@apiroot/records/Contract/57", "attachments":"@apiroot/records/Contract/57/attachments" }, "relationships":{ "parent":{ "links":{ "self":"@apiroot/records/Contract/57/relationships/parent", "related":"@apiroot/records/Programme/2" } } }, "attributes":{ "content":[ { "LineNumber":1, "Status":"banana" }, { "LineNumber":1, "Status":"banana" } ] } } }

When record does not exist:

404 Not Found (Empty)

Create Record

Use this function to create a single record.

POST @apiroot/records/<urlencoded eformtype>

Example Request

{
    "data": {
        "type": "record",
        "attributes": {
            "content": [{
                    "LineNumber": 1, // Mandatory 
                    "Status": "banana"
                }, {
                    "LineNumber": 2, // Mandatory 
                    "Status": "banana"
                }
            ]
        }
    }
}

Example Response

// Status: 201 Created
{
"data": {
"id": "Example/1",
"type": "record",
"links": {
"link", "@apiroot/records/Example/1"
}
}
}

Update Record

Use this function to change the values within fields of a record.

PATCH @apiroot/records/{urlencoded eformtype}/{recordid}

Note that HASH value behaviour is not specified at this stage.

Example Request

{
    "data": {
        "type": "record",
        "attributes": {
            "content": [{
                    "LineNumber": 1, // Mandatory 
                    "Status": "banana"
                }, {
                    "LineNumber": 2,
                    "Status": "banana"
                }
            ]
        }
    }
}

Example Response

Success:

204 No Content (Empty)

No such record:

404 Not Found (Empty)

Create Or Update Record

(Added in Nimblex 5.5)

Use this function to change the values within fields of a record (and create if it does not exist).

PUT @apiroot/records/{urlencoded eformtype}/{recordid}

Note that HASH value behaviour is not specified at this stage.

Example Request

{
    "data": {
        "type": "record",
        "attributes": {
            "content": [{
                    "LineNumber": 1, // Mandatory
                    "Status": "banana"
                }, {
                    "LineNumber": 2,
                    "Status": "banana"
                }
            ]
        }
    }
}

Example Response

Successful update:

204 No Content (Empty)
Successful create:

(This was 200 Success in earlier versions)

201 Created (Empty)
No such record:
404 Not Found (Empty)

Delete Record

Use this function to delete a single record.

DELETE @apiroot/records/{urlencoded eformtype}/{recordid}

Example Request

NO CONTENT

Example Response

Successfully deleted:

204 Success (Empty)

No such record:

404 Not Found (Empty)

Parent Relationship

Get Record Parent

GET @apiroot/records/{urlencoded eformtype}/{recordid}/relationships/parent

Example Request

NO CONTENT

Example Responses

Record is the child of Contract 57:

// Status: 200
{
"data": {
"type": "record",
"id": "Contract/57"
}
}

Record does not have a parent:

// Status: 200
{
"data": null
}

Record does not exist:

404 Not Found (Empty)

Update Record Parent

PATCH @apiroot/records/{urlencoded eformtype}/{recordid}/relationships/parent

Example Requests

To set new value:

{
    "data": {
        "type": "record",
        "id": "Contract/57"
    }
}

To clear:

{
    "data": null
}

Example Responses

Success:

204 No Content (Empty)

Record does not exist, or parent does not exist:

404 Not Found (Empty)