Request and response data formats

All data should be valid JSON-data, if not stated otherwise.

Binary data for attachments should be base64-encoded.

All date-values sent to NSP Public API are expected to be UTC, and it is recommended they are encoded in ISO-format, like so: "2016-05-25T06:20:10". All response dates follow this standard.

Inputted data is not case-sensitive, but it is recommend to preserve exact casing for entity field names.

All response JSON have this basic structure:

  "Data": {},

  "Errors": null,

  "IsError": false

}

The actual data is always in the property “Data”.

List-queries will be returned in following format:

  "Total": 0,

  "Data": [],

  "Errors": null,

  "IsError": false

}

 

Error responses

When an error has occurred, the response will have an http status indicating the general error, for example 400 for bad requests, or 500 for unexpected exception in NSP. More details relevant to error is found in Errors messages-property, and in the “Code”-integer value.

Example response after providing invalid JSON:

  "Data": null,

  "Errors": [ 

    { 

      "Message": "Invalid json:  'After parsing a value an unexpected character was encountered:  \". Path 'Id', line 4, position 3.'",

      "Code": 11,

      "MessageDetails": ""

    }

  ],

  "IsError": true

}

 

Example response after sending in incorrect entitytype:

{

  "Data": null,

  "Errors": [

    {

      "Message": "Entity type 'Tickett' is not found.",

      "Code": 21,

      "MessageDetails": null

    }

  ],

  "IsError": true

}

404-errors

Note that for 404-errors, where an incorrect URL have been used to call the public API, no content in above format will be supplied.

NSP Error codes

Although the text messages of certain errors may vary, the error code values are fixed and can be used programmatically.

10

AuthenticationFailed

11

AuthenticationTokenHasExpired

13

AuthenticationTokenInvalid

20

Internal binding error (unknown error during processing of inputted JSON)

21

Invalid JSON provided in http message.

22

Json data type mismatch. Data has been provided with wrong datatype.

23

Entity Type was not specified in request data.

24

Subtype not specified (applies to CI/Contracts subtypes, for example CIType)

25

A required parameter was not specified.

30

Record not found.

31

Entity type not found.

40

Internal error. Unknown error in application.