REST API for POST and PUT method calls

The REST API for POST and PUT feature will be deprecated.

Consider using the Record APIs feature instead.

Overview

ReadiNow allows third party systems to connect to ReadiNow to Create, Update or Delete records of any object within ReadiNow. This is achieved through configurable API endpoints where the Administrator specifies which object to expose to an API.

Definitions:

  • API: An application programming interface.Within ReadiNow this is a collection of endpoints that are grouped and secured together in order for third party systems to perform actions on records within ReadiNow
  • API Endpoint: An endpoint is a web address that the remote system can use to connect to our system. Each endpoint does either a create, update or delete of a particular record of a nominated object. These Endpoints can be created and configured by the ReadiNow Administrator
  • API Key: The authentication mechanism for calling endpoints in an API.

Process:

  • Decide which object needs to be exposed to an API
  • Create an API (see below)
  • Configure the Endpoint which specifies the object and allowed actions (create, update, delete via API)
  • Create API key (see below)
  • Use the details generated to configure the third party system (or integration tool) to POST, PUT or DELETE (which corresponds to create, update and delete) action to ReadiNow

Creating an API

To create an API:

  1. Select Application Menu. The menu appears with available applications.
  2. Select Administration. The application displays at the landing page.
  3. In the Left Navigation Area, select Integration. The Integration expands to display list.
  4. Select APIs. The existing APIs display.
  5. Select +NEW. The API form displays.
  6. Type the Name in the Name field 
  7. Type the Address in the Address field, e.g. the name of application in one word. Please refer to step 4 of creating endpoint.
  8. Select the checkbox for Enabled.
  9. Select Save to save the details.

Creating an Endpoint for any object

To create an Endpoint for any object:

  1. On the Endpoints tab of the newly created API, select +NEW. The menu appears.
  2. Select API Resource Endpoint. The API Resource Endpoint form displays.
  3. In the Object field, select the Pencil  icon and select from the list e.g. Student.
  4. Type the Address in the Address field, e.g. the name of the object in one word. (https://yourseveraddress/spapi/api/yourtenant/yourapiaddress/yourendpoint)
  5. Select the checkbox for Enabled.
  6. Select fields as required.
  7. Select Save to save the details.

Creating an API Key

To create an API Key:

  1. Select Application Menu. The menu appears with available applications.
  2. Select Administration. The application displays at the landing page.
  3. In the Left Navigation Area, select Integration. The Integration  expands to display list.
  4. Select API Keys. The existing API Keys display.
  5. Select +NEW. The API Key form displays.
  6. In the API Key field, enter a guid. E.g. b9c91534-7cc1-4e09-b22f-2808072e333e, or generate one at https://www.guidgenerator.com/.
  7. Select the checkbox for Enabled, if not ticked.
  8. For Run as user, select a user account such as Administrator (The user account must have access control permission to do whatever you expect the API to do).
  9. Under APIs Granted tab, link to the New API (or other API as required).
  10. Select Save to save the details.

Using a tool that can simulate making web requests

To get a tool that can simulate making web requests:

  1. Use a tool that can simulate making web requests e.g. the Postman Plugin for Chrome.
  2. Alternatively, see getpostman.com , or just navigate in the Chrome app store.

Running a request to create a new data record

To run a request to create a new account:

  1. Use Postman to issue a request like this: (see image below).
  2. Use the 'POST' verb.
  3. Use key that is generated (e.g. https://yourseveraddress/spapi/api/yourtenant/yourapiaddress/yourendpoint?key=b9c91534-7cc1-4e09-b22f-2808072e333e).
  4. Select the Body tab.
  5. Select 'Raw'. The textbox appears.
  6. Enter this (case sensitive) query:

    { "field1 of string type":"value of field1",  "field2 of decimal type":234.0 }

  7. Set the type to JSON (application/json).
  8. Select Send.


Notes

  • A 201 Created response appears.
  • Navigate to your report of your object, a new data record with specified field values is created.

Response Codes

When an API call is made, the server will response with a HTTP response code as follows:

HTTP Response Codes

HTTP Response Code

Meaning

200/201 - OK(200 or 201 as applicable). Everything worked.
400 - Bad Request

Something about the request received from the client was invalid.

  • There was something invalid about the request received from the client.
  • I.e. not a server problem, configuration problem, or internal error.
  • Body of a 400 reply should contain a message and an ID (in the E1xxx range). See error codes below.
401 - Unauthorized

Any of the following:

  • An API key was not provided
  • The API key was an invalid format
  • The API key was not found in the specified tenant
  • The specified tenant not not exist (to be indistinguishable from the above)
  • The API key is not attached to a user account
  • The API key is attached to a user account that is disabled, locked, or expired
  • There are multiple API key objects with the same key name (which is invalid)
403 - Forbidden

Any of the following:

  • The API key does not have permission to access the requested API
  • The API key is attached to a user account that does not have permission to perform the requested task
405 - Method not allowedCaller attempted to use a verb that was not supported or allowed or enabled by that endpoint.
500 - Server-side Error

Either of the following:

  • A platform server error - for example with IIS
  • A platform unhandled exception - includes a E0001 message. Raise a bug ticket if you see these.
  • A connector configuration error (such as a misconfigured API mapping) - not a platform bug

Ideally all 500 errors will also include an Exxxx error number in their message. See table below.

Error Codes

In addition to the standard HTTP response codes, the body of the responsee message may contain an error code. Note that error codes do not form part of the HTTP standard.

Errors in the range E0xxx represent platform errors. Errors in the range E1xxx represent request errors. Errors in the range E2xxx represent tenant configuration errors.

Error Code

Message

E0001

Platform internal error.

E1001

Property ''name'' was formatted incorrectly.


E1002

No resource of the correct type matched the GUID 'guid'.

E1003

No resources were found that matched 'value'.

E1004

Multiple resources were found that matched 'value'.

E1005

Identifier list contained nulls.

E1006

Expected an array of identities for 'property'.

E1007

Cardinality violation.

E1008

Field validation rules were not met.

E1009

The message body was empty.

E1010

Mandatory property 'property' was not provided.

E2001

Multiple API keys have the same value.

E2002

Multiple APIs matching ''name''.

E2003

Multiple APIs endpoint matching ''name''.

E2004

Endpoint has no resource mapping.

E2005

Resource mapping has no resource type.

E2006

Resource mapping identity field cannot be write-only.

E2007

Resource mapping identity field was not set.

E2008

Field mapping ''name'' did not point to a field.

E2009

Relationship mapping ''name'' did not point to a relationship.

E2010Field mapping ''name'' did not have a mapped name.