Signed API V1 (deprecated)
Signed API V1 (Deprecated)
Base URL: https://nrsdb.uk/api/nrsdb.php
Signature
Append the signature, timestamp and key as URL parameters, e.g.
https://nrsdb.uk/api/nrsdb.php?key=test×tamp=12345678&signature=
Endpoints
Add the 'r' parameter to the URL to specify the request
ESRs
### r=getEsrs
Get properties of all ESRs, optionally filtered by parameters as follows;
Parameters
- age - limit response to ESRs that have changed within the specified number of days, e.g. age=3
Response Format
Response has two properties, "count" tells us how many records were returned and === 0 for error, "data" is an array of ESR records
The ESR record only returns the "Primary Line", this will always includes the "Commencement Board" and "Termination".
ESR Data Structure
- refnum (string) - this is made up of a route specific prefix, a three digit incremental counter, plus the two digit year
- original_refnum (string) - this gives the original reference, allowing consumer to apply updates
- routename (string) - long name for the Route
- deliveryunit (string) - responsibly Delivery Unit
- elrcode (string) - ELR of track segment impacted e.g. LTN1
- elrdescription (string) - full description of the ELR e.g. "LIVERPOOL STREET - TROWSE LOWER JN"
- lorId (int) - internal ID of the LOR - use r=lor?lorId=X to convert
- location (string) - description of where the restriction is applied
- reason (string) - describes reason the ESR is imposed
- speed (string) - "Freight Speed / Passenger Speed" - single number if both are same
- withdrawn (bool) - 0 = active, 1 = withdrawn
- whenimposed (string) - W3C format date time string
- etc (null|string) - if set this is a W3C format date time string
- whenwithdrawn (null|string) - if withdrawn === 1, W3C format date time string
- line (array) - details of the Primary Line
- elrId - internal ID, not useful - Primary Line is always on the ELR as given above
- trackId (int) - e.g. 1100 = Up Main
- direction (string) - "Up Direction" | "Down Direction" (yuk)
- linedescription (string) - can be driven by trackId or overridden by Controller
- routeheader (string) - "Primary Line" | "Additional Line"
- speed (string) - repeat for backward compatibility
- boards (array)
- type (string) - short name (no spaces)
- description (string) - long name
- elrId (int) - copied from line
- trackId (int) - copied from line
- miles (int) -
- chains (int) - 0 >= X < 80
- serialNumber (string) - not currently used
Example
{
"refnum": "AICC 008A.22",
"original_refnum": "AICC 008.22",
"routename": "Anglia",
"deliveryunit": "Ipswich",
"elr": 255,
"elrcode": "COC",
"elrdescription": "Colchester to Clacton",
"lorId": 1
"location": "Between here and there",
"reason": "Track - Cyclic Top",
"speed": "30/60",
"withdrawn": 0,
"whenimposed": "2022-09-02 13:53:09",
"etr": null,
"whenwithdrawn": null,
"line": {
"elrId": 255,
"trackId": 1100,
"direction": "Up Direction",
"linedescription": "Up Main",
"routeheader": "Primary Line",
"boards": [
{
"type": "commencement",
"description": "Commencement Board",
"elrId": 255,
"trackId": 1100,
"miles": 1,
"chains": 42,
"serialNumber": ""
},
{
"type": "termination",
"description": "Termination",
"elrId": 255,
"trackId": 1100,
"miles": 0,
"chains": 37,
"serialNumber": ""
}
],
"speed": "30/60"
}
}
## Blanket Speed Restrictions
### r = getBlanketSpeeds
### Response Format
TBA
## LORs
### r=lor
#### Parameters
- lorId - give the lorId from an ESR response
#### Response Format
```
{"count":1,"data":[{"lorcode":"EA1010","lordescription":"LIVERPOOL STREET TO SEVEN KINGS"}]}
```
Errors
We return appropriate HTTP response codes whenever an error is encountered
400 Bad Request
If the URL parameter "r" is missing
401 Unauthorized
This is returned if the given signature is invalid or lapsed. A signature is valid for only 5 mins so should be generated for each request
501 Not Implemented
This is returned if "r" is supplied but is not a valid endpoint
Others
Internal errors, for example unable to contact the database or failure to encode JSON will return "400 Bad Request" unless there's a specific HTTP response associated with the error
No comments to display
No comments to display