JSON API – Records
  • 14 Sep 2020
  • 2 Minutes To Read
  • Contributors
  • Print
  • Share
  • Dark
    Light

JSON API – Records

  • Print
  • Share
  • Dark
    Light

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.

Records

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:

{
    "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,
                    "Status": "banana"
                }
            ]
        }
    }
}

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:
200 Success (EMPTY)

No such record:
404 Not Found

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

Success:
204 No Content (EMPTY)

No such record:
404 Not Found

Delete Record

Use this function to delete a single record.

DELETE @apiroot/records/<urlencoded eformtype> /<recordid>

Example Request

NO CONTENT

Example Response

Successfully deleted:
200 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 Response

Record is the child of Contract 57:

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

Record does not have a parent:

{
    "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:
200 Success

Record does not exist, or parent does not exist:
404 Not Found (EMPTY)

Was This Article Helpful?