Skip to content

API guide


This page provides details about the various features of the RailSmart API, these features are:
  • Authentication
  • Scopes
  • Request Types
  • Status Codes

RailSmart Api has been written to RESTful standards. The requests and responses are in JSON format. Date times, both for parameters and responses are in the ISO-8601 standard. Responses use common HTTP status codes, if the api returns an error, a JSON error response is returned as well

Authentication

The RailSmart API requires authentication to send requests this is done through entering credentials, apart from needing authentication through the credentials but each type of request (GET,POST,PUT,DELETE) requires the user to be authenticated with different scopes

Scopes

The RailSmart API contains 3 scopes that the user can be authenticated with these scopes allow the user to sends requests to different types of endpoints, without the correct scopes you will recieve a 401 Unauthorized error on each request that you make. The 4 scopes are: Read, Write, Delete.

Read - Allows the user to send GET requests to an endpoint and get data back.

Write - Allows the user to send POST and PUT requests to the endpoint to create or update existing data.

Delete - Allows the user to send DELETE requests and remove data.

Request Types

Within this API there are 4 types of requests that can be used:

  • GET - Used to get data
  • POST - Used to create data
  • PUT - Used to update data
  • DELETE - Used to delete data

Status Codes

Status codes are returned from a request and appear in the response they allows a user\developer to quickly, there are many different types of status codes but this guide will only cover the codes that appear with the responses from the endpoints within this API.

200s

200 (OK) - This status code indicates that the request was sent and received without any errors.

201 (Created) - This status code indicates that the request was sent and received without any errors and something has being created from this.

204 (No Content) - This status code indicates that the request was sent and received without any errors and nothing is returned.

400s

401 (Unauthorized) - This status code indicates that the user attempting the request does not have authorization for the request.

404 (Not Found) - This status code indicates that the request has not been found (Check the request url)

500s

500 (Internal Server Error) - This status code indicates that the server encountered an unexpected issue and was un-able to fulfil the request.