Application Programming Interface

This RESTful API provides the building blocks that developers need to programmatically integrate CRS with other network elements and systems. The API works over HTTP or HTTPS.

Individual objects that can be manipulated through the API include CRS administrators, service providers, and more. This chapter is a developer reference for connecting a currently used system to CRS.

The API is available at https://<NIU or HA address>/crs/api.

Note

For more information about JSON, see http://json.org/


URI Scheme

The following shows the base URI and the format used by the API:

Base URI: <niu-ha>/crs/api

Where niu-ha is the host address of the primary NIU.

Following the base URI, the scope and scope ID are added to show which role the actions are to be completed as.

URI Format: /<object>

Many objects will use the following URI: /<object>/<service_provider>/<subscriber>


Methods

The API uses the following methods:

  • GET: Access a resource

  • PUT: Create or modify a resource

  • POST: Create a resource

Note

The POST method can be used to import and export data. For more information, see Provisioning.

  • DELETE: Delete a resource

Note

The DELETE method can be used to archive and purge data. For more information, see Archiving, Restoring, and Purging Data.


Logging In to the API

POST to <base_uri>/authenticate with the username and password parameters.

For example:

curl -X POST \
         -H "Content-Type:application/json" \
         <niu-ha>/crs/api/authenticate \
         -d '{"username":"<username>","password":"<password>"}'

The response will contain the following:

"data": [
        {"token": "<secure-access-token>"}
        ],
"jsonapi": {"version": "2.0-3",
"name": "Custom Redirect Service",
"short_name": "crs",
"author": "IMSWorkX, Inc."

The secure access token must be passed back as the value of the Authorization header. For example:

Authorization: Basic <secure-access-token>

Note

Tokens expire after 24 hours.


Accessing an Object

URI Format: <niu-ha>/crs/api/<object>/<object-id>

curl -X GET \
         -H  "Content-Type:application/json" \
         -H "Authorization:Basic <secure-access-token>" \
         "http://localhost/crs/api/service_provider/IMSWorkX"

This GET command will provide a 200 message if the specified object exists:

{
        "meta": {
                "scope": "success",
                "code": "200",
                "records_page_size": "request.parameters.limit",
                "archive": "request.parameters.archive",
                "records_page_offset": "request.parameters.offset"
        },
        "data": [
                {
                        "scope": "number",
                        "meta": {
                                "modified_by": "<string>",
                                "modified": "<datetime>",
                                "created_by": "<string>",
                                "created": "<datetime>"
                        },
                        "attributes": {
                                "rules": "<array>",
                                "timezone": "<string>",
                                "number": "<string>",
                                "subscriber_name": "<string>"
                        }
                }
        ]
}

Table Queries

Tables are lists of objects that can be accessed and modified to affect multiple objects at once.

URI Format: <niu-ha>/crs/api/<object>?<optionalparameters>

Table queries may contain the following parameters, all of which are optional:

{
        "sort": {},
        "search": {},
        "like": {},
        "sort_function": {},
        "icontains": {},
        "limit": {},
        "offset": {}
}
sort

A string that defines how a column is ordered. Accepted values are ‘<column_name> ASC’ to be sorted by ascending value or ‘<column_name> DES’ to be sorted by descending value.

search

A string that is a comma-separated sequence of parameters to search by. There are two formats: ‘:string’ and ‘::’ where the first represents a string search (for example, ‘first_name:Bill’ would find any person with a first name of Bill) and the second represents a between search (for example, ‘customer_number:1000:2000’ would find all records with customer numbers between, but not including, 1000 and 2000). Note that this can also be a datetime object in ISO format.

like

A string that denotes a value to perform a ‘like’ search. This will perform a substring search on any string fields in the object and return if any of these fields are a partial match.

sort_function

A string that overrides ‘sort’. Pass in ::{:}*.

icontains

A string that is a case insensitive ‘contains’ search. Similar to the ‘search’ parameter, you should pass in a comma-separated list of ‘:string’. Exact search takes precedence. The field being searched must be a string-type variable.

limit

An integer that is the number of records to retrieve at a time. The default value is 10.

offset

An integer that is the number of records to skip from the beginning. The default value is 0.

An example CDR query:

curl -X GET \
         -H  "Content-Type:application/json" \
         -H "Authorization:Basic <secure-access-token>" \
         "http://localhost/crs/api/cdr"?offset=0&limit=25&sort=column:asc

Call Detail Records

The following information is returned after a request to retrieve Call Detail Records (CDRs).

{
        "original_called_number": "<string>",
        "called_number": "<string>",
        "calling_number": "<string>",
        "start_time": "<timestamp>",
        "end_time": "<timestamp>",
        "route": "<json>",
        "service_provider_name": "<string>",
        "subscriber_name": "<string>",
        "cdrs": "<array>"
}

Endpoints

/crs/api/crs_cdr

GET - Retrieve all CDRs that match the specified criteria.

/crs/api/crs_cdr/{service_provider_name}

GET - Retrieve the CDRs associated with a particular Service Provider.

/crs/api/crs_cdr/{service_provider_name}/{subscriber_name}

GET - Retrieve the CDRs associated with a particular Subscriber.

/crs/api/crs_cdr/{service_provider_name}/{subscriber_name}/{original_called_number}

GET - Retrieve the CDRs associated with a particular originally called number.


Creating an Object

Use the POST command without specifying an object ID to create an object. At this time, the object will be given an object ID that can be modified later.

For example:

curl -X POST \
         -H "Content-Type:application/json" \
         -H "Authorization:Basic <secure-access-token>" \
         <ha_address>/crs/api/service_provider -d \
         '{"name": "IMSWorkX", "display_name": "IMSWorkX", "first_name": "Jane", "last_name": "Doe", "email": "example@example.com", "address": "1 Main St. Rochester, NY", "phone": "5858675309", "notes": "more notes"}'

This example POST command will add a new Service Provider named IMSWorkX.


Modifying an Object

When the PUT command is used and the object ID is included in the command, the object is modified.

For example:

curl -X PUT \
         -H "Content-Type:application/json" \
         -H "Authorization:Basic <secure-access-token>" \
         <ha_address>/crs/api/service_provider/IMSWorkX -d \
         '{"first_name": "John", "last_name": "Smith"}'

This example PUT command will change the name of the Service Provider from Jane Doe to John Smith.

Object Definitions

administrator

The following information is used in the body of a request to create and edit different administrator level users.

{
        "username": "John_Doe_admin",
        "role_id": "service_provider:exampleserviceprovider",
        "first_name": "John",
        "last_name": "Doe",
        "email": "jdoe@example.com",
        "permissions": "default:service_provider"
}
username

A unique string that is the user name for this user. Limit of 64 characters. Can contain only lowercase characters, numbers, or underscores.

role_id

A string that defines the type of administrator that is being created. Accepted values are:

  • platform_owner

  • service_provider:<service_provider_name>

  • subscriber:<service_provider_name>:<subscriber_name>

first_name (optional)

A string that is the first name of this user. Limit of 250 characters.

last_name (optional)

A string that is the last name of this user. Limit of 250 characters.

email (optional)

A string that is the email address for this user. Limit of 250 characters.

permissions (optional)

An array of permission groups that this user is a member of. Permissions are dependent on the specified role_id of the created administrator.

Endpoints

/crs/api/administrator/{role_id}

GET - Retrieve all administrators with the specified role.

POST - Create an administrator with the specified role.

/crs/api/administrator/{role_id}/{username}

GET - Retrieve the administrator with the specified role and user name.

PUT - Modify the administrator if it exists, otherwise create the administrator.

DELETE - Archive the specified administrator.

/crs/api/administrator/{role_id}/{username}/reset

POST - Reset this user’s password, returning a reset token.

service_provider

The following information is used in the body of a request to create and edit different Service Providers.

Note

These are not administrator accounts.

{
        "name": "exampleserviceprovider",
        "display_name": "JSMITH",
        "first_name": "John",
        "last_name": "Smith",
        "email": "jsmith@example.com",
        "address": "123 Main St",
        "phone": "5851231234",
        "notes": "Any string here",
}
name

A unique string that is the name of this Service Provider. Limit of 64 characters.

display_name (optional)

An unconstrained string used as a display name. Limit of 250 characters.

first_name (optional)

A string that is the first name of a contact for this Service Provider. Limit of 250 characters.

last_name (optional)

A string that is the last name of a contact for this Service Provider. Limit of 250 characters.

email (optional)

A string that is the email address of this Service Provider, where notifications and password reset requests will be sent. Limit of 250 characters.

address (optional)

A string that is the physical address of this Service Provider. Limit of 250 characters.

phone (optional)

A string that is the primary phone number of this Service Provider. Limit of 250 characters.

notes (optional)

A string that is a free-form notes field. Limit of 2048 characters.

Endpoints

/crs/api/service_provider

GET - Retrieve all Service Providers.

POST - Create a new Service Provider.

/crs/api/service_provider/{name}

GET - Retrieve the Service Provider with the specified name.

PUT - Modify the Service Provider if it exists, otherwise create the Service Provider.

DELETE - Archive the specified Service Provider.

subscriber

The following information is used in the body of a request to create and edit different Subscribers.

Note

These are not administrator accounts.

{
        "name": "examplesubscriber",
        "service_provider_name": "exampleserviceprovider",
        "ivr_pin": "1234",
        "override": false,
        "display_name": "ExampleSubscriber",
        "first_name": "Jane",
        "last_name": "Doe",
        "email": "jdoe@example.com",
        "address": "123 Main St",
        "phone": "5851234321",
        "notes": "This is an example Subscriber.",
}
name

A unique string that is the name of this Subscriber. Limit of 64 characters.

service_provider_name

A unique string that is the name of the Service Provider for this Subscriber. Must match an existing Service Provider.

ivr_pin (optional)

A string that is the PIN used by this Subscriber to log in to the IVR interface.

override (optional)

A boolean value that determines whether this Subscriber can use an override number to direct all numbers to a single destination.

display_name (optional)

An unconstrained string used as a display name. Limit of 250 characters.

first_name (optional)

A string that is the first name of a contact for this Subscriber. Limit of 250 characters.

last_name (optional)

A string that is the last name of a contact for this Subscriber. Limit of 250 characters.

email (optional)

A string that is the email address of this Subscriber, where notifications and password reset requests will be sent. Limit of 250 characters.

address (optional)

A string that is the physical address of this Subscriber. Limit of 250 characters.

phone (optional)

A string that is the primary phone number of this Subscriber. Limit of 250 characters.

notes (optional)

A string that is a free-form notes field. Limit of 2048 characters.

Endpoints

/crs/api/subscriber/{service_provider_name}

GET - Retrieve all Subscribers owned by the specified Service Provider.

POST - Create a new Subscriber.

/crs/api/subscriber/{service_provider_name}/{name}

GET - Retrieve the Subscriber with the specified name.

PUT - Modify the Subscriber if it exists, otherwise create the Subscriber.

DELETE - Archive the specified Subscriber.

number

The following information is used in the body of a request to create and edit numbers.

{
        "number": "5851239876",
        "timezone": "gmt",
        "service_provider_name": "exampleserviceprovider",
        "subscriber_name": "examplesubscriber",
        "params": []
}
number

A unique string that must be a valid phone number. Limit of 250 characters.

timezone

A string that is the time zone used by the number to determine call routing.

subscriber_name

A unique string that is the name of the Subscriber who uses this number. Must match an existing Subscriber.

service_provider_name

A unique string that is the name of the Service Provider for the Subscriber who uses this number. Must match an existing Service Provider.

params (optional)

A JSON object that defines the set of parameters configured for this number that are passed to the routing engine.

Endpoints

/crs/api/number

GET - Retrieve all numbers.

/crs/api/number/{service_provider_name}

GET - Retrieve all numbers owned by the specified Service Provider.

POST - Create a new number owned by the specified Service Provider.

/crs/api/number/{service_provider_name}/{subscriber_name}

GET - Retrieve all numbers owned by the specified Subscriber.

POST - Create a new number owned by the specified Subscriber.

/crs/api/number/{service_provider_name}/{subscriber_name}/{number}

GET - Retrieve the specified number.

PUT - Modify the number if it exists, otherwise create the number.

DELETE - Archive the specified number.

/crs/api/number/{service_provider_name}/{subscriber_name}/{number}/{groups}

GET - Retrieve the group or groups that the specified number is associated with.

group

The following information is used in the body of a request to create and edit groups.

{
        "display_name": "group1",
        "group_number": "111",
        "override_number": "1234567",
        "last_index": "1",
        "service_provider_name": "exampleserviceprovider",
        "subscriber_name": "examplesubscriber",
        "members": [],
        "call_plans": [],
        "constraints": []
}
display_name (optional)

An unconstrained string used as a display name. Limit of 250 characters.

group_number

An integer that is the number for identifying this group.

override_number (optional)

A string that is the number to route calls to by default for this group.

last_index (optional)

An integer that is the last activated call plan for this group.

service_provider_name

A unique string that is the name of the Service Provider for the Subscriber who uses this group. Must match an existing Service Provider.

subscriber_name

A unique string that is the name of the Subscriber who uses this group. Must match an existing Service Provider.

members (optional)

An array of numbers associated with this group. An individual number can be associated with more than one group.

call_plans (optional)

An array of call plans associated with this group. An individual call plan can be associated with more than one group.

constraints (optional)

A JSON object defining the routing constraints that apply to this group. This should be a set of regex strings that define which destinations are prohibited.

Endpoints

/crs/api/group

GET - Retrieve all groups.

/crs/api/group/{service_provider_name}

GET - Retrieve all groups owned by the specified Service Provider.

POST - Create a new group owned by the specified Service Provider.

/crs/api/group/{service_provider_name}/{subscriber_name}

GET - Retrieve all groups owned by the specified Subscriber.

POST - Create a new group owned by the specified Subscriber.

/crs/api/group/{service_provider_name}/{subscriber_name}/{group_number}

GET - Retrieve the specified group.

PUT - Modify the group if it exists, otherwise create the group.

DELETE - Archive the specified group.

/crs/api/group/{service_provider_name}/{subscriber_name}/{group_number}/{members}

GET - Retrieve all numbers within the specified group.

PUT - Add a new number to the specified group.

DELETE - Remove a number from the specified group.

/crs/api/group/{service_provider_name}/{subscriber_name}/{group_number}/{call_plans}

GET - Retrieve all call plans within the specified group.

PUT - Add a new call plan to the specified group.

DELETE - Remove a call plan from the specified group.

supergroup

The following information is used in the body of a request to create and edit supergroups.

{
        "display_name": "supergroup1",
        "supergroup_number": "222",
        "service_provider_name": "exampleserviceprovider",
        "subscriber_name": "examplesubscriber",
        "group_entries": []
}
display_name

A string that is the display name for this supergroup, which will be used in the web UI.

supergroup_number

An integer that is the number for identifying this supergroup.

service_provider_name

A unique string that is the name of the Service Provider for the subscriber who uses this supergroup. Must match an existing Service Provider.

subscriber_name

A unique string that is the Subscriber who uses this supergroup. Must match an existing Subscriber.

group_entries

An array of groups associated with this supergroup.

Endpoints

/crs/api/supergroup

GET - Retrieve all supergroups.

/crs/api/supergroup/{service_provider_name}

GET - Retrieve all supergroups owned by the specified Service Provider.

POST - Create a new supergroup owned by the specified Service Provider.

/crs/api/supergroup/{service_provider_name}/{subscriber_name}

GET - Retrieve all supergroups owned by the specified Subscriber.

POST - Create a new supergroup owned by the specified Subscriber.

/crs/api/supergroup/{service_provider_name}/{subscriber_name}/{supergroup_number}

GET - Retrieve the specified supergroup.

PUT - Modify the supergroup if it exists, otherwise create the supergroup.

DELETE - Archive the specified supergroup.

/crs/api/supergroup/{service_provider_name}/{subscriber_name}/{supergroup_number}/{group_entries}

GET - Retrieve all groups within the specified supergroup.

PUT - Add a new group to the specified supergroup.

DELETE - Remove a group from the specified supergroup.

call_plan

The following information is used in the body of a request to create and edit call plans.

{
        "call_plan_name": "callplan1",
        "display_name": "ExampleCallPlan",
        "rules": "Require315",
        "service_provider_name": "exampleserviceprovider",
        "subscriber_name": "examplesubscriber",
}
call_plan_name

A unique string that is the name of this call plan.

display_name

A string that is the display name for this call plan, which will be used in the web UI.

service_provider_name

A unique string that is the name of the Service Provider for the subscriber who uses this call plan. Must match an existing Service Provider.

subscriber_name

A unique string that is the Subscriber who uses this call plan. Must match an existing Subscriber.

rules

A JSON object that defines the routing rules for this call plan.

Endpoints

/crs/api/call_plan

GET - Retrieve all call plans.

/crs/api/call_plan/{service_provider_name}

GET - Retrieve all call plans under the specified Service Provider.

POST - Create a new call plan under the specified Service Provider.

/crs/api/call_plan/{service_provider_name}/{subscriber_name}

GET - Retrieve all call plans under the specified Subscriber.

POST - Create a new call plan under the specified Subscriber.

/crs/api/call_plan/{service_provider_name}/{subscriber_name}/{call_plan_name}

GET - Retrieve the call plan under the specified Subscriber and with the specified name.

PUT - Modify the call plan if it exists, otherwise create the call plan.

DELETE - Archive the specified call plan.

constraint

The following information is used in the body of a request to create and edit rules used by a call plan.

{
        "label": "Require315",
        "description": "Requires the destination to have a 315 area code.",
        "type": "REQUIRE",
        "value": "1315xxxxxxx",
        "service_provider_name": "Name"
}
type (optional)

A string that determines if the constraint requires or blocks the call based on the value. Accepted values are ‘REQUIRE’ or ‘BLOCK’.

description (optional)

A string that describes the call destination constraint. Limit 250 characters.

value

A string that is the call destination constraint value. Uses regex format.

label

A string that is the call destination constraint label. Limit 250 characters.

service_provider_name

A unique string that is the Service Provider for this constraint. Must match an existing Service Provider.

Endpoints

/crs/api/constraint/{service_provider_name}

GET - Retrieve all call destination constraints under the specified Service Provider.

POST - Create a call destination constraint under the specified Service Provider.

/crs/api/constraint/{service_provider_name}/{label}

GET - Retrieve the specified call destination constraint.

PUT - Modify the call destination constraint if it exists, otherwise create the audio file.

DELETE - Archive the specified call destination constraint.


Settings

The following information is used in the body of a request to edit settings. The following example uses the default values.

{
        "routing_engine_uri": "http://niu/crs-routing-engine",
        "download_directory": "/var/opt/xpressworkx/app-manager/crs/media/download",
        "upload_directory": "/var/opt/xpressworkx/app-manager/crs/media/upload",
        "job_log_directory": "/var/opt/xpressworkx/app-manager/crs/media/download",
        "default_route_on": "1",
        "application_username": "crs_application_manager",
        "application_password": "im5_wrkX",
        "routing_interface_impl": "com.imsworkx.routingEngine.callflow.HttpClient",
        "menu_destination": "12345",
        "csr_location": "",
        "use_contact": false,
        "branding": {
                "imsworkx": {
                        "color_hue": "202",
                        "highlight_hue": "198",
                        "logo": "logo.png",
                        "label": "Evolve Cellular Inc. &reg;"
                }
        },
        "restworkx": {
                "archive_max_days": "7",
                "audit_log_directory": "/var/opt/xpressworkx/app-manager/crs/logs/audit-logs/",
                "log_duration": "1"
        },
        "web_settings": {
                "help_page": "http://www.imsworkx.com",
                "password_length": "8",
                "number_mask": "{+ddd }(ddd) ddd-dddd",
                "audio_package": "xpressworkx"
        },
        "routing_engine": {
                "egress_route": "",
                "default_no_route_behavior": "404",
                "redirect_address": "",
                "point_code_format": "ansi",
                "sip_routing_prefix": "",
                "sip_connection_type": "redirect",
                "sip_play_media_on_error": false,
        {
        "crs_settings": {
                "csv_retention_days": 30
        }
}

The following settings are set automatically during installation and should not need to be changed:

  • routing_engine_uri

  • download_directory

  • upload_directory

  • job_log_directory

  • application_username

  • application_password

  • routing_interface_impl

use_contact

If true, the host from the Contact header of the INVITE will be used as the egress_route.

branding

Contains settings related to the look and feel of the website using the following parameters:

imsworkx: The default appearance settings. Additional fields can be added at this level under different names, which can then be appended to the URL for custom branding.

color_hue: (Integer) This will change the primary color used on the site. This value is a number between 0 and 360, using the HSL model where 0 is red, 120 is green, and 240 is blue.

highlight_hue: (Integer) This will change the secondary color used on the site. This value is a number between 0 and 360, using the HSL model where 0 is red, 120 is green, and 240 is blue.

logo: (String) Filename for the logo that will appear in the upper, left corner of the website. The image must be a PNG file and placed in the /var/opt/xpressworkx/app-manager/crs/static/img/ directory.

label: (String) The message displayed in the upper, right corner of the website. This is generally a company name.

restworkx

Contains settings related to the platform and database.

archive_max_days: (Integer) Number of days to keep records in the archive table.

log_duration: (Integer) Number of days before rotating the log file.

audit_log_directory: (String) Should not be changed.

web_settings

Contains settings for elements on the website.

help_page: (String) URL for the web page that is linked in the “Help” button on the upper, right corner of the page.

password_length: (Integer) Minimum number of characters allowed in a password.

number_mask: (String) Determines how phone numbers appear. Lowercase ‘d’ represents a digit 0-9. Uppercase ‘D’ represents a digit 0-9 or an ‘X’ (denoting any digit). A lowercase ‘x’ denotes any character. Braces ({}) denote an optional grouping that will only be filled after all other groupings are filled. All other characters are taken literally as they are written but are not taken as part of the value when saving. Treat these as visual separators only.

audio_package: (String) The prompt set that will be used in the web UI.

routing_engine

Contains settings used to determine call flow.

egress_route: (String) The host to use when connecting a call to the called party.

default_no_route_behavior: (String) The default behavior for SIP calls when no route is found for the call. The options available directly correspond to SIP final response codes.

redirect_address: (String) The address a SIP redirect message will be sent.

point_code_format: (String: “ansi”, “itu”) The format that point codes will be in.

sip_routing_prefix: (String) A prefix value added to the call during the call processing.

sip_connection_type: (String) The type of SIP connection.

sip_play_media_on_error: (String) The sounds a subscriber will hear as the called party is answering.

crs_settings

Contains settings specific to the Customer Redirect service.

csv_retention_days: (Integer) The number of days CSVs for imports and exports will be kept on the system.

Endpoints

/crs/api/settings/

GET - Retrieve the settings for the current user.

PUT - Modify the settings.


Common Responses

The following common responses may be encountered while using the CRS API. The format of these responses may look different from the documented examples based on the tool used to make API calls.

Note

Many HTTP responses are a 200 OK due to the call to the API being successful. It is important to read the body of the response as it could contain an error.

CRS Not Installed

When making an API call to a server that does not have CRS installed, the following message will be seen.

curl -X POST \
         -H "Content-Type:application/json" \
         <niu-ha>/crs/api/authenticate \
         -d '{"username":"<username>","password":"<password>"}'
         -v

< HTTP/1.1 404 Not Found
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Content-Length: 412
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /crs/api/authenticate was not found on this server.</p>
</body></html>

Note

This response is not controlled by the CRS API and is entirely an HTTP response.

Incorrect Log In

When logging in to the API with incorrect or missing information, the following message will be seen.

curl -X POST \
         -d '{"username":"crs_administrator"}' \
         localhost/crs/api/authenticate
         -v

< HTTP/1.1 200 OK
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Expires: <datetime>
< Vary: Cookie
< Cache-Control: max-age=0
< Last-Modified: <datetime>
< Content-Type: application/json
< Set-Cookie: crs_sessionid=<cookie>; expires=<datetime>; httponly; Max-Age=1209600; Path=/crs
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0

{"meta": {
        "scope": "exception",
        "message": "The username and password provided were not correct.",
        "code": 401,
        "encoding": "ascii"
        },
"jsonapi": {
        "version": "1.2-11",
        "name": "Custom Redirect Service",
        "short_name": "crs",
        "author": "IMSWorkX, Inc."
        }
}

Unauthorized Action

When attempting to perform an action without the proper user permissions, such as a Service Provider creating another Service Provider, the following message will be seen.

{"meta": {
        "scope": "exception",
        "message": "You do not have permission to perform that operation.",
        "code": 403,
        "encoding": "ascii"},
"jsonapi": {"version": "1.2-11",
"name": "Custom Redirect Service",
"short_name": "crs",
"author": "IMSWorkX, Inc."}
}

Not Provisioned

When preforming a GET for data that has not been provisioned, the following message will be seen.

curl -X GET \
        -H "Authorization: Basic <secure-access-token>" \
        localhost/crs/api/service_provider/service_test45 \
        -v

< HTTP/1.1 200 OK
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Expires: <datetime>
< Vary: Cookie
< Cache-Control: max-age=0
< Last-Modified: <datetime>
< Content-Type: application/json
< Set-Cookie: crs_sessionid=<cookie>; expires=<datetime>; httponly; Max-Age=1209600; Path=/crs
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0

{"meta": {
        "code": 200,
        "encoding": "ascii",
        "zoom": 0,
        "records_shown": 0,
        "records_total": 0,
        "scope": "success",
        "message": "",
        "archive": false,
        "authorization": "Basic <secure-access-token>"
        },
"data": [],
"jsonapi": {
        "version": "1.2-11",
        "name": "Custom Redirect Service",
        "short_name": "crs",
        "author": "IMSWorkX, Inc."
        }
}

Note

This is technically a successful call to the API, thus the 200 code return.

Object Does Not Exist

When creating an object that does not exist (for example, servi instead of service_provider), the following message will be seen.

curl -X GET \
         -H "Authorization: Basic <secure-access-token>" \
         localhost/crs/api/servi
         -v

< HTTP/1.1 200 OK
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Expires: <datetime>
< Vary: Cookie
< Cache-Control: max-age=0
< Last-Modified: <datetime>
< Content-Type: application/json
< Set-Cookie: crs_sessionid=<cookie>; expires=<datetime>; httponly; Max-Age=1209600; Path=/crs
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0

{"meta": {
        "scope": "exception",
        "message": "No object 'servi' exists.",
        "code": "404"
        },
"jsonapi": {
        "version": "1.2-11",
        "name": "Custom Redirect Service",
        "short_name": "crs",
        "author": "IMSWorkX, Inc."
        }
}

Required Field Missing

If a required field is missing when creating an object, the following message will be seen.

curl -X POST \
         -H "Authorization: Basic <secure-access-token>" \
         localhost/crs/api/service_provider \
         -d '{"last_name":"api_test"}' \
         -v

< HTTP/1.1 200 OK
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Expires: <datetime>
< Vary: Cookie
< Cache-Control: max-age=0
< Last-Modified: <datetime>
< Content-Type: application/json
< Set-Cookie: crs_sessionid=<cookie>; expires=<datetime>; httponly; Max-Age=1209600; Path=/crs
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0

{"meta": {
        "scope": "exception",
        "message": "ServiceProvider(): Field 'name' is required, but missing.",
        "code": 400,
        "encoding": "ascii"
        },
"jsonapi": {
        "version": "1.2-11",
        "name": "Custom Redirect Service",
        "short_name": "crs",
        "author": "IMSWorkX, Inc."
        }
}

No Method at Endpoint

When making a call with a method that is not valid at the specific endpoint, the following message will be seen.

 curl -X GE \
 -H "Authorization: Basic <secure-access-token>" \
 localhost/crs/api/service_provider/service_test45 \
 -v

< HTTP/1.1 405 METHOD NOT ALLOWED
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Expires: <datetime>
< Vary: Cookie
< Allow: GET, POST, PUT, DELETE
< Cache-Control: max-age=0
< Last-Modified: <datetime>
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
< Set-Cookie: crs_sessionid=<cookie>; expires=<datetime>; httponly; Max-Age=1209600; Path=/crs
<
* Connection #0 to host localhost left intact
* Closing connection #0

Successful API Call

When making a successful API call, the following message will be seen.

curl -X GET \
        -H "Authorization: Basic <secure-access-token>" \
        localhost/crs/api/service_provider/ \
        -v

< HTTP/1.1 200 OK
< Date: <datetime>
< Server: Apache/2.2.15 (CentOS)
< Expires: <datetime>
< Vary: Cookie
< Cache-Control: max-age=0
< Last-Modified: <datetime>
< Content-Type: application/json
< Set-Cookie: crs_sessionid=<cookie>; expires=<datetime>; httponly; Max-Age=1209600; Path=/crs
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0

{"meta": {
        "code": 200,
        "encoding": "ascii",
        "zoom": 0,
        "records_page_offset": 0,
        "records_shown": 1,
        "records_total": 1,
        "scope": "success",
        "message": "",
        "archive": false,
        "authorization": "Basic <secure-access-token>",
        "records_page_size": 10
},
"data": [{
        <DATA FROM OBJECT>
}],
"jsonapi": {
        "version": "1.2-11",
        "name": "Custom Redirect Service",
        "short_name": "crs",
        "author": "IMSWorkX, Inc."
        }
}

The above responses can be seen as responses from a stable CRS API. If you encounter other undocumented API errors, please contact support@imsworkx.com with the API call and output.


Audit Logging

Audit logs are generated every day by default and are stored as a CSV file. By default, these files are located in /var/opt/xpressworkx/app-manager/crs/logs/audit-logs and are named audit-<year>.<month>.<day>.log.