Only this pageAll pages
Powered by GitBook
1 of 16

REST API v2

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Using Postman and cURL

Xytech Public Postman Collection

An extensive set of example API calls is available via the Platform’s REST API Postman Collection which you can your fork so that you can pull for future updates. This collection contains many example calls, including basic payload version to get you started.

Using cURL as a test client

cURL is a lightweight command line API client used for testing and troubleshooting.

Example curl to fetch job details (replace authorization string, baseURL and database name with your values)

curl --location 'https://baseURL/api/v2/database/DEMO/JmJob/job_no=342' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ***************' \

Performance Recommendations

To avoid impacting user experience or other integrations, it is important to utilise the APIs efficiently:

  1. Only fetch the fields you need - use the resultColumns parameter

  2. Suppress null value fields - use the nullvaluehandling parameter

  3. Disable alternate key handling - use the alternatekeyhandling parameter

  4. Make use of Webhooks not polling - see the Webhooks guide.

  5. Ensure the use of compression - include header Accept-Encoding: gzip or deflate

  6. Always use pagination.

Connecting and Authenticating

Licensing

The REST API is a licensed component.

Information You Will Need

To be able to connect with the REST API, you will need to know the instance details:

Detail
e.g.
Comment

Site Base URL

https://example.com

The API URL is constructed as follows:

{Site Base URLl}/api/v2/database/{dbname}/{endpoint}

e.g. https://example.com/mysite/api/v2/database/demo1/JmJob

For systems installed prior to mid 2023, you may also require the port number. All later systems are now setup with a proxy to avoid the need to know the port number.

If you do not have this information, please contact Xytech Technical Support.

An API user needs to have been created as a user in the Platform. The user, must be enabled for REST API access by flagging 'Allow API Login' on the user setup. As with all users, assign appropriate security roles (enable as a super user is not recommended).

Two methods are supported

  • Client Credentials method (system to system access)

  • SPA / browser sign-in method (interactive user authentication flow)

Pre-requisites Your auth provider has been configured and the Xytech app server has been configured. (Azure and Okta/Auth0)

Client-Credentials method, from auth provider you needs:

  • Access token URL

  • Client ID

  • Client Secret

  • Scope

For SPA method you need:

  • Authorisation URL

  • Access token URL

  • Client ID

  • Client Secret

Summary flow: - Obtain token from auth provider - Use token to make REST API calls until token expires.

For use case scenarios where database user accounts are employed, using the JWT Token may be the prefered method. Typical use might be for system to system authentication requirements.

Pre-requisite Xytech app server has been configured for JWT authentication

Summary flow: - Retrieve token passing login credentials in the POST body - Use token for all subsequent API calls, until token expires

Below are the URLs for login and token refresh.

{{baseURL}}/api/v2/database/{{dbName}}/orchestration/auth/login {{baseURL}}/api/v2/database/{{dbName}}/orchestration/auth/refresh

cURL Example:

Refresh example:

See additional authentication user guides for more details.

The REST API uses Basic Authentication and will require a login account. Always use HTTPS encrypted protocol when communicating with the REST API to ensure credentials are not passed in clear text.

REST API v2 Introduction

The Xytech platform provides a REST API that enables you to create integrations and custom workflows with 3rd party systems.

You will need:

  • Authentication credentials

  • The base URL of the instance you wish to communicate with

What's New

External ID fields have now been added to layout and document customisation documents.

This is to enable the ability to import and export layouts via the REST API whilst storing an external identifier, 'external_key'.

Specific endpoints XeDocLayout, XeDocTemplate and XeDocField.

Note: Standard Xytech layouts should not not modified using the REST API, as any changes will be overwritten upon the next version update.

Work Order Transactions can be updated using the external_key field without having to know the order number (wo_no_seq).

i.e. previously to PATCH a transaction you needed to use:

/JmWoTransaction/wo_no_seq=1075735-1/jm_wo_transaction/external_key=PH20250103

Custom Field Handling

Any custom fields you have defined through document customization are automatically included in REST API definition. There is specific naming convention that is a combination of the Custom Code you created via document customisation plus the internal field name concatenated with an underscore. i.e. {customization code}_{field name}

Document customization screen showing the user definable Customization Code

Document customization screen showing the internal field names:

Response from a GET call to fetch a Work Order that shows custom fields:

Users can enable custom dropdown fields (through enabling a document customisation flag 'Additional API details', so that when called by the REST API will return the additional attributes stored with the dropdown record such as external_key.

Fundamentals and data model

Xytech is, at a fundamental level, a system that deals with creating, updating, and utilizing a particular type of data object referred to as a document.

  • Each Xytech document is a representation of a database table or collection of database tables and has an API endpoint.

    • Each endpoint has a primary table and may have one or more sub-tables.

Scope

This is the same base URL you use to access your system

Database Name

DEMO1

Instance database name

API URL

API Users & Permissions

Authenticating

OAuth 2.0 OpenID Authentication for REST API

JWT Token authentication

Basic Authentication

curl --location 'https://devwcumpapp2.xytech.xytechsystems.com/xyt_main/orchestration/api/v2/database/XYT_MAIN_V/auth/login' \
--header 'Content-Type: application/json' \
--data '{
    
    "username":"username",
    "password":"password"
    
}'
curl --location 'https://devwcumpapp2.xytech.xytechsystems.com/xyt_main/orchestration/api/v2/database/XYT_MAIN_V/auth/refresh' \
--header 'Content-Type: application/json' \
--data '{
    "accessToken": "xxx",
    "refreshToken": "xxx"
}'

now you can omit the wo_no_seq and use: /JmWoTransaction/jm_wo_transaction/external_key=PH20250103

Applies to all three order types, Work Order, Transmission Order & Media Order.

A minor enhancement has been made to the order list endpoints to include a field with the full name of the scheduled by user ('sched_by_name').

Applies to /JmWorkOrderList, /MoMediaOrderList and /XmTransmissionOrderList endpoints.

This will assist API integrations from needing to make a follow-up API call to retrieve the use name.

Two methods are supported

  • Client Credentials method (system to system access)

  • SPA (single page application) / browser sign-in method (interactive user authentication flow)

Pre-requisites

Your auth provider has been configured and the Xytech app server has been configured. (Azure and Okta/Auth0)

Client-Credentials method, from auth provider you needs:

  • Access token URL

  • Client ID

  • Client Secret

  • Scope

For SPA method you need:

  • Authorisation URL

  • Access token URL

  • Client ID

  • Client Secret

  • Scope

Summary flow: Obtain token from auth provider Use token to make REST API calls until token expires.

For use case scenarios where database user accounts are employed. Typical use might be for system to system authentication requirements.

Pre-requisite Xytech app server has been configured for JWT authentication

Summary flow: Retrieve token passing login credentials in the POST body Use token for all subsequent API calls, until token expires

See additional authentication user guides for more details.

When creating or updating an order you can load a work order template along with any child templates associated. This has been accomplished by adding an additional optional parameter to the existing Save Argument called 'LoadChildTemplates'

e.g. header:

(25746)

Users can now enable custom dropdown fields (through a new document customisation flag 'Additional API details', so that when called by the REST API will return the additional attributes stored with the dropdown record such as external_key.

Document Customisation fields showing additional checkbox:

Example of a custom drop-down field when 'Additional API details' is not enabled:

Example of a custom drop-down field when 'Additional API details' is enabled:

(28200)

Below is a summary of key fixes, for a full list, refer to the 11.3 release notes.

Resolves an issue where the OpenAPI (Swagger) documentation for certain REST API endpoints did not accurately reflect the actual HTTP response value, such as the 200 Ok response calling the POST method for the /JmJob endpoint (previously 204). (26278)

Resolves a REST API issue when using POST, datetime offset attributes on date times values were being ignored. Date formats can include the time offset e.g. "2024-12-05T04:00:00-08:00" (27932)

Release fixes

Resolved an issue where the API documentation for JmWoTransaction incorrectly omitted the required wo_no_seq parameter.

Resolves a REST API pagination issue, where the Pagination Count (found in the response header) was responding with in incorrect value.

Resolves an issue when creating a Media Order or Transmission Order via the REST API where a service row field value was set incorrectly (dsp_seq), creating invalid orders.

REST API calls now support the ability to pass the Division as an override to the API API user's default Division.

A new optional header called "Division-Code" exists where you can now include the Division code. This will ensure the correct results are returned for the API users current Division. The API user account must have user access to the division to be able to successfully pass it in the API call. If not, you will receive an error message.

e.g. Division-Code : GS In Postman:

POST calls now include sub-table IDs of any sub-table records created by the call in the response body. The response HTTP Status code changes from 201 to 200 to reflect a response body.

The REST API now provides the ability to upload an attachment file that auto creates the attachment record.

The file type needs to already exist as a defined Attachment Type (System - Setup - Attachment Types) to be successfully uploaded. The ability to delete is also provided.

The attachment record will be auto created assigning the matching Attachment Type and description as the filename.

Multiple files can be uploaded in a single POST API call. Use form-data for the body.

Endpoint: /SysAttachment/attachment_keystring=10339:100-1 Where attachment_keystring is made up of a concatenation of document ID and record ID

e.g.

  • Document ID for Work Orders = 10339 (see document customisation list for IDs)

  • A specific Work Order ID = 100-1 The response will include the IDs of the created attachment records.

Full cURL example:

Postman:

Delete attachment file example: DELETE {{server}}/SysAttachment/attachment_keystring=10339:100-1/sys_attachment/attachment_no=2205

The existing /SysContactFacade endpoint now supports the creation and updating of User and Vendor contact types (profiles).

Ability to query where a field's value does not match an array of supplied values. Usage example: {{server}}/PmProjectList?query={"project_desc":{"$notin":["test", "Sarah"]}} Applies to GET queries.

Ability to define an array of matching values that all have to match regardless of the order defined. Usage example: {{server}}/LibMasterList?{"master_desc":{"$LIKEAND":["%Genesis%","%XHD%"]} Applies to GET queries.

The Swagger document definition now provides the ability to download the definition as a JSON file instead of a YAML.

REST API now provides a new endpoint that gives the ability to manage new or existing Titles and assign the Title to a parent Title in a single API call. New endpoint: /LibTitleHierarchyFacade.

Swagger defines the payload for a sub-table GET differently to how the REST API actually responds.

Ability to create or update if record already exists. see: Upsert

Compression is enabled by default when making calls using a standard header: Accept-Encoding: gzip or deflate This applies to all API methods.

A couple of real-world examples that shows the benefit of using compression, where a list of transactions were retrieved using a GET list endpoint for a date range:

Example #1 Without compression: Takes 5 seconds and has a payload of 4.4 MB. With compression: Takes 4 seconds and has a payload of 142 KB.

Example #2 Without compression: 22 seconds with response size of 9.47 MB With compression: 8 seconds with response size of 320 KB In this example, compression made the payload a 30th the size.

It is recommend to always use compression.

You can now use query parameters with:

  • LessThanOrEqual ($lte)

  • LessThan ($lt)

  • GreaterThanOrEqual ($gte)

  • GreaterThan ($gt)

e.g. Title numbers greater than 106438 {"title_no":{"$gt": "106438"}}

When calling a maintenance document using a GET that includes a URL sub-table filter, you can now use the 'resultColumns' parameters to define the fields you want returned in the response body. Previously the resultColumns parameter was only respected for the primary table and all fields were returned for the sub-table. By specifying the fields you want returned helps maintain overall system performance.

Example defining the field value you want returned from a Job subtable called Episode:

This will return only respond with the Episode title_no values for job 342

A more complex example where there is a sub-sub-table are involved:

Returns Operation details for a transmission order for a specific Service Row.

Fixed in v10.6SP1 and v11.0 Creating date fields with a null value now correctly sets the date value to null as opposed to "0001-01-01T00:00:00" Applies to POST/PUT/PATCH methods.

POST to SysContactFacade no longer responds with the ID of the created record in the header, instead it now responds with the ID within the response body. This is due to the fact that SysContactFacade is capable of creating multiple new records and the header can only provide a single ID value.

  • Swagger documentation now includes the PATCH method using a POST payload

  • Swagger includes example payloads for sub-tables (previously not populated).

  • Swagger now includes PATCH method for list documents.

  • Other Swagger improvements and correct missing parameter fields.

  • Additional header parameters for optimization and filtering

    • Ignore alternate keys

    • Omit null values

    • Filter results for maintenance documents

v26.1

Add external key field to remaining xe_doc documents

Call order transactions without providing wo_no_seq

SaveArgument: {"LoadTemplate":"1012","LoadChildTemplates":"Y"}
curl --location 'https://devwcumpapp2.xytech.xytechsystems.com/xyt_main/api/v2/database/XYT_MAIN_RUBY_V/SysAttachment/attachment_keystring=10339:100-1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic xxxxxxxxxxxxxxxxxxxx' \
--form '=@"/C:/temp/DetailsOn100-1.txt"' \
--form '=@"/C:/temp/A File.pdf"'
{{server}}/JmJob/job_no=342/jm_episode?resultColumns={"jm_episode":"title_no"}
{{server}}/XmTransmissionOrder/wo_no_seq=1072992-1/mo_service_row/service_row_no=221083/mo_operation/operation_no=133119?resultColumns={"mo_operation":["operation_no","task_no","trx_resource_desc","trx_group_desc"]}

Add 'Sched By Name' to the response for JmWorkOrderList

v11.3

OAuth 2.0 OpenID Authentication for REST API

JWT Token authentication

Child templates of Work Order Templates are now loaded.

Ability to enable custom drop-down fields to return additional attributes

Fixes

Response status codes in Swagger documentation now reflect the correct values for the 2xx range.

POST datetime fields ignore offset attribute

v11.2

JmWoTransaction

API Pagination Count incorrect value for pages after 1

Error Loading Service Templates

v11.1

Division

Response body on creation

Attachment File Upload

SysContactFacade ability to create User and Vendor profiles

Additional query parameters

NOTIN (Not in)

LIKEAND (Like and)

Swagger/OpenAPI definition now downloadable as JSON

Link child titles to parent in single API call

Known issues

There are differences in the way Swagger reports a payload definition between POST & GET calls.

v11.0

'upsert' is now supported via the PUT method

Compression is now supported

Greater than and less than new query parameters

Ability to use resultColumns for defining sub-table fields to return on maintenance docs.

Corrected null date values

SysContactFacade

v10.6

Document Customisation fields showing additional checkbox:

Example of a custom drop-down field when 'Additional API details' is not enabled:

Example of a custom drop-down field when 'Additional API details' is enabled:

Custom Fields

Custom drop-down fields with additional attributes

All sub-tables are children of the primary table, and a sub-table can have one or more child sub-tables.
  • Each endpoint represents one of the following types of document:

    • Setup - generally describes a single item, and usually only contains a primary table. Setup documents are often used to manage simple items used to generate lists of options in other documents, such as status labels or predefined sets of codes.

    • Maintenance – generally describes either master data (which are used in transactional data) or transactional data. Maintenance documents often contain one or more sub-tables.

    • List documents provide access to sets of other records, such as Setup and Maintenance documents.

  • The Xytech REST API is JSON-based and has Open API v3.0 API specifications for each API call available in YAML (migrating to JSON from v11.1). These specifications can be retrieved as a plain YAML file and are also readily available to be viewed in a browser through the Swagger UI. See the OpenAPI definition

    This diagram provides you with a high-level understanding of the primary Xytech data objects and how they relate.

    Below the name of each data object is the REST API endpoint used for accessing the data object. Where ~/ is prefixed before the endpoint, that indicates it is a sub-table endpoint of the primary endpoint. See the OpenAPI definition for full details.

    High level data model diagram

    Upsert / PUT

    Upsert provides the ability to create records if they don't already exist, or update them if they do.

    Upsert functionality is provided using the PUT method and is available on all maintenance document types. (v11.0+)

    PUT payload concepts

    The most common use of the PUT method will be where a 3rd party identifier is known and you wish to create or update a Xytech record.

    The external identifier is likely to be stored in the "external_key" field of the record.

    What is important, is to supply the external_key field in multiple places:

    1. In the URL

    2. As a payload field within the key field object (this is for lookup of existing record)

    3. Within the root body of the payload (this is for inserting the value)

    This will ensure correct insert or update functionality.

    Example to upsert a Job:

    You will receive the ID of the created record if one does not already exist matching the external_key.

    If you send the same payload again, you will receive a 2xx success code, no new ID as the record already exists (any changes would update the record).

    See the OpenAPI definition on endpoint details and the Postman collection for examples.

    When performing an upsert, you may wish to clear any existing sub-table records before adding new ones. This can be done in a single API call by adding a header.

    Syntax: rowAction : {"deleteAll":["<sub-table>"]} Example: endpoint /LibMaster rowAction value: {"deleteAll":["lib_master_audio"]} This will delete all existing audio records of the library asset (and add new ones if defined in the payload)

    Optionally, you can delete multiple sub-tables by including separating comma: Syntax: rowAction : {"DeleteAll":["<sub table name>","<sub table name>"]}

    Full example: In this example we're creating or updating a library asset with a barcode identifier, if the record already exists the system will delete any existing audio and title records and create new audio and title records.

    Methods and Response Codes

    RESTful services utilize HTTP methods to differentiate between different types of API calls.

    Methods

    Verb
    Used for

    GET

    - Retrieving a list of all records of a certain document type that match specified criteria, such as all Bids that start in the current year, all Jobs associated with a specific Client, or all Contacts whose names begin with the letter A, or - Retrieving a specific record of a certain document type, such as all the properties of a Job with a specific Job ID.

    POST

    POST commands are usually used to create new records, such as adding a new resource or creating a new Job

    The REST service generates HTTP response codes. In many cases, the HTTP response code will be accompanied by additional information in the body or the header of the message. In some cases, the HTTP response code may be the only response.

    Response Code
    Description

    For more information refer to the or a developer resource for HTTP status codes, such as the

    Known Issues

    There are differences in the payload structure between POST & GET calls when filtering by sub-table.

    When using GET to fetch a payload filtered by a sub-table, the payload is missing the sub-table wrapper. The Swagger definition reports the correct payload structure that includes the sub-table wrapper, but that is not what works today.

    A fix would mean a breaking change, so we shall not be correcting this until API v3.

    Example of how Swagger defines the GET response payload for a sub-table of /XmTransmissionOrder endpoint, which includes the wrapper in this case mo_service_row.

    Below is how the the endpoint actually responds that excludes the wrapper.

    When using a POST call that includes creating sub-table records, some endpoints respond with invalid sub-table record IDs that are negative values. This has been resolved in v11.1 onwards.

    There is an issue with a few endpoints when sending a JSON payload. The order the fields submitted within the payload can cause an error response when placed in an in an order the endpoint does not expect.

    204 No Content

    The server has fulfilled the request but does not need to return a response body. The server may return the updated meta information.

    4xx Range

    Client Error

    400 Bad Request

    The call was not successful due to an error in the URL or the syntax of the API call. Check the syntax of the API call to make sure there are no invalid characters.

    401 Unauthorized

    The call was not successful because the API requires a valid credentials, and they were not provided as part of the call. Response Code Description Verify that the call is providing login information in an acceptable manner.

    404 Not Found

    The call was not successful because the service could not find the requested API. Check the URL for any mismatches between the API call being sent and the documented API signature.

    5xx Range

    Server Error

    500 Internal Server Error

    The call was not successful because it caused an error in the service during processing, such as providing an incorrect data type for a given property/field. Verify that all parameters are correct, and values are valid.

    502 Bad Gateway

    The call was not successful because the service got an invalid response from the API. Verify that all parameters are correct, and values are valid.

    PATCH

    Updates an existing record with a specified value(s) using partial information Two forms of PATCH are supported: - Specific field replace/delete value (Content-Type : application-json) - Replace using a full JSON payload (Content-Type : application-patch+json) - see note below

    PUT

    Upserts a record (Create or update if already exists using external_key as the identifyer)

    DELETE

    Delete commands are usually used to permanently remove existing records from the host system. Note: DELETE commands should be used sparingly; to both preserve data integrity and provide historical information, it is usually recommended to change the Status of a record instead of deleting the record completely.

    Note: PATCH using 'Content-Type : application-patch+json' cannot be used when calling sub-tables

    2xx Range

    Success Codes

    200 Ok

    The call was successful. In most cases, there will be additional information returned by the API in the body of the message, such as the matching record(s) for a query, or the ID of a record created, modified, or deleted by a corresponding API call.

    201 Created

    The request has been fulfilled, resulting in the creation of a new resource.

    Response Codes

    appropriate section of the HTTP protocol
    MDN Web Docs.
    |334
    |332

    Deleting existing sub-table records

    Field order should not be a necessity, but to improve this, requires substantial changes to the API that can only be considered for the future API v3.

    Temporally in release v10.6, the format of date time values where all expressed in UTC format instead of with the time offset.

    Should look like this:

    For v10.6 the format looked like this:

    This has been corrected from v11.0 onwards.

    An issue existed in v11.2 where any offset value included with the date time when using POST would be ignored. This has been resolved in v11.3

    POST & GET payload differences

    Sub-table record creation respond with invalid IDs

    Field order of some endpoints has to be maintained

    Release v10.6 Date Time format

    Release v11.2 Date Time offset ignored for POST

    curl --location --request PUT 'https://{APIbaseURL}/JmJob/external_key=PH20250205a' \
    --header 'Content-Type: application/json-patch+json' \
    --header 'Authorization: Basic ********' \
    --data '{
        "jm_job": [
            {
                "job_no": {
                    "external_key": "PH20250205a"
                },
                "external_key": "PH20250205a",
                "division_no": 12,
                "cust_id": "010",
                "job_desc": "test2",
                "job_type_no": 163,
                "account_rep_no_1": 18,
                "active": "Y"
            }
        ]
    }'
    curl --location --request PUT 'http://{APIbaseURL}/LibMaster/barcode=XYZ19030504' \
    --header 'Content-Type: application/json-patch+json' \
    --header 'rowAction: {"DeleteAll":["lib_master_audio","lib_master_title"]}' \
    --header 'Authorization: Basic **************' \
    --data '{
        "lib_master": [
            {
                "master_no": {
                    "barcode": "XYZ19030504"
                },
                "master_desc": "My Content 40",
                "asset_type_no": "1",
                "lib_master_title": [
                    {
                        "title_no": {
                            "title_no": "36"
                        }
                    }
                ],
                "lib_master_audio": [
                    {
                        "audio_desc": "Stereo Left",
                        "audio_content_desc": "English",
                        "track_language": "English",
                        "audio_channel": "1"
                    },
                    {
                        "audio_desc": "Stereo Right",
                        "audio_content_desc": "English",
                        "track_language": "English",
                        "audio_channel": "2"
                    }
                ]
            }
        ]
    }'
    {
      "mo_service_row": [
        {
          "service_header": "string",
          "service_desc": "string",
          "service_row_no": {
            "service_row_no": 0,
            "external_key": "string"
          },
          "dsp_seq": 0,
          ...
    [
        {
          "service_header": "Y",
          "service_desc": "AUTO ROUTE",
          "service_row_no": {
            "service_row_no": 7428,
            "external_key": null
          },
          "dsp_seq": 1,
          ...
    "2023-04-21T01:00:00+01:00"
    "2023-04-21T00:00:00Z"

    Examples

    Some basic examples of API calls

    GET

    Retrieve Work Order header details returning specific fields and not null values:

    curl --location --globoff 'http://{APIbaseURL}/JmWorkOrder/wo_no_seq=2627-1?resultColumns={"jm_work_order":["wo_no_seq","wo_desc","wo_begin_dt","wo_end_dt","phase_desc","sched_by_name"]}&nullvaluehandling=ignore' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic *************' \
    --data '@'

    Response:

    {
        "jm_work_order": [
            {
                "wo_no_seq": {
                    "wo_no_seq": "2627-1"
                },
                "wo_desc": "Dscription2",
                "wo_begin_dt": "2000-03-31T02:30:00-08:00",
                "wo_end_dt": "2000-03-31T05:30:00-08:00",
                "wo_type_no": {
                    "wo_type_no": 3275,
                    "wo_type_desc": "Production"
                }
            }
        ]
    }

    POST method

    Create a new Work Order with minimal fields:

    curl --location 'http://{APIbaseURL}/JmWorkOrder' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic ********' \
    --data '{
        "jm_work_order": [
            {
                "wo_desc": "Match20",
                "wo_begin_dt": "2023-08-22T10:00:00.000Z",
                "wo_end_dt": "2023-08-22T16:00:00.000Z",
                "wo_type_no": 17,
                "phase_code": "Bid",
                "rate_card_no": 1,
                "cust_id": 19
            }
        ]
    }'

    Response:

    {
        "message": null,
        "tables": [
            "jm_work_order"
        ],
        "jm_work_order": {
            "record_identifiers": [
                "wo_no_seq"
            ],
            "records": [
                {
                    "wo_no_seq": "8250-1"
                }
            ]
        }
    }

    PATCH

    curl --location --request PATCH 'http://{APIbaseURL}/JmJob/job_no=67981' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic **********' \
    --data '[
        {
            "op": "replace",
            "path": "job_desc",
            "value": "Hello World"
        },
        {
            "op": "replace",
            "path": "external_key",
            "value": 15411
        }
    ]'

    Response: Status Code 204

    PATCH Using POST Payload

    There are two PATCH methods, one where you define the field and the operation, the other is to use the full POST JSON payload. To use the PATCH with the full JSON payload, you must include the header parameter: 'Content-Type: application/json-patch+json'

    Example Work Order update using PATCH and the POST payload structure:

    Response 200 status code

    Notes: The payload must include the existing primary key as a URL parameter as well as in the body payload. The expected response status code for a successful PATCH can be 200 or ‘204’ where no response is returned.

    List endpoints also support the PATCH method so that you can update multiple records using a query (see ‘Parameters’ section above for details on available query parameters). This method is the equilivent API functionality of the Grid Update feature in the UI.

    Example to update multiple Work Orders using the $range query parameter:

    Response Status Code 204.

    As with GET, wildcards ‘%’ are supported such as: PATCH {base_url}__/ JmJobList?Query={"job_desc": "Sport%"}

    See many other basic payload examples in the public .

    Deprecation of REST API v1

    REST API v1 was the first Xytech REST API product. It had limitations that required breaking changes to improve so v2 was made available from Xytech v9.4 with improved functionality.

    REST API v1 is no longer supported in version 11.0 and beyond.

    All new integrations should use API v2 and existing integrations should port to v2 as soon as possible.

    To use v2 API, change the base URL version number from ../v1/.. to ../v2/..

    Changes in v2 API

    Payload structure changes

    The payload structure has been enhanced to be more robust and scalable. The primary data object name is now always added as the root element of the payload with an array containing the details. v2 handles sub tables more gracefully and respects the hierarchy of the tables. With v1, the sub tables were often added to the bottom of the payload at the root level, which made it difficult to determine the relationship between tables and their sub items. With v2, the table names are included in the payload and the sub tables are added as children to maintain the relationships.

    Example showing the root element for JmJob

    API v1 JSON structure
    API v2 JSON structure

    All sub-tables are offset from the root object. See the OpenAPI documentation for details of the JSON structure for each endpoint.

    In addition, v2 has many enhancements as detailed in this document.

    To assist, below are main steps needed to migrate to API v2:

    1. Change your URL to use the v2 path.

    2. Adapt to the new and improved payload structure.

    3. Utilise new parameters

    API v1 base URL http://domain/api/v1/database/XYT_MAIN_V

    API v2 base URL http://domain/api/v2/database/XYT_MAIN_V

    The main difference is that v2 handles sub tables more gracefully and respects the hierarchy of the tables especially when making POST calls. See the examples below:

    GET Jm_Job v1:

    GET Jm_Job v2:

    POST XmTransmissionOrder v1:

    POST XmTransmissionOrder v2:

    To improve responsiveness and design efficient integrations. The following additional URL parameters were added for GET requests:

    NullValueHandling : ignore

    This parameter removes all the fields with null values from the result set.

    AlternateKeyHandling : ignore

    This parameter instructs the API to not resolve the alternate keys in the payload for GET requests. In the example below, the highlighted items are removed from the result set when using the AlternateKeyHandling=ignore parameter:

    Best practice:

    ResultColumns

    Always filter a GET call using resultColumns parameter so that you only return the fields you need.

    Avoids making additional calls to check whether a record already exists before creating/updating it.

    POST XmTransmissionOrder response payload with record IDs

    Key Fields and Time Formats

    Each payload contains a nested sub-section of key fields which are used for the lookup of records by a key field. This sub-subsection is identified by the primary key field name.

    The nested sub-section of fields are not used for writing values to the database, values that need to be stored should be contained in the main root of the payload.

    The sub-group always contains the primary key field and the 'external_key' field.

    Additionally, there are sub-sections of related tables with their key fields. Lookups (using GET query parameters) can only filter sub-tables using the sub-table primary key and not their alternate keys, unless sub-table fields exist in the main body of the payload.

    As a general rule, if you are creating or updating file values, the fields you need to write values to should be included in the root of the payload

    Using POST, you have two options for creating and setting key values of sub-tables. Below is an example to create a JmJob that generates the primary key value (using -1) and assigns the Division, Customer and Job Type sub-table IDs. This structure follows the same structure you will receive from a GET call.

    OpenAPI Definition and Endpoints

    From Xytech version v10.2, an OpenAPI (previously referred to as Swagger) index page has been introduced to assist in the navigation and generation of OpenAPI definitions. The index page can be found by entering the base URL of your site (you use for accessing the Xytech UI) and adding “/ApiDocs” to the end (e.g. www.xytechexample.com/XYT_TEST/ApiDocs). The Xytech API Index page is displayed.

    API Index Page

    The index page displays groups of endpoints called modules for the selected database. Clicking on a module will reveal the endpoints within that module. Click on an endpoint, and the OpenAPI definition will be generated using the Swagger UI.

    The Index is comprised of the following areas:

    PATCH using List endpoints

    Postman Collection

    Alternatively you can flatten the structure to populate the primary key values. This is where the field name is the same as the sub-section name.

    When using POST to create new records, values for any alternate key fields, such as external_key, must be contained in the main body of the payload and not included in the sub-section of key fields (where they will be ignored). The same applies to PATCH method that uses the header application/json-patch+json See examples above where external_key is included in the POST payload. Or this example for creating a resource with an external key value:

    External key fields exist on all documents and is designed to be used to store the external system's unique identifier for a record. The external key field can then be used in future look-ups as opposed to having to know the Xytech primary key field value.

    Example below shows a GET response section of the Job's (jm_job) key fields in the sub-group "job_no":

    Some documents may have additional key fields which will all be contained within the same sub-group, such as Media Assets (known by the document name lib_master). All these key fields within "master_no" sub section can be used to retrieve the record with a GET call.

    GET call example to retrieve the above record using barcode:

    NOTE: You will need to ensure uniqueness is maintained across alternate keys if you want to be able to retrieve individual records like the above example.

    When creating records using the POST method, to generate the primary key, set the value to -1. When creating multiple sub-table records in a single call that need their own next value generated, advance the value by one for each separate sub-table key field needed, E.g -1, -2, -3 etc…

    If you use -1 again, it will use the same value as the first instance. This can be useful in calls that require the same ID value to be populated again elsewhere in the payload.

    Prior to v11.3, there is one exception to this which is JmWorkOrder, where the primary key is a combination of wo_no + wo_seq. To generate wo_no_seq requires a "+1" value. Example:

    Be aware some fields are mandatory, and are defined in the OpenAPI definition.

    The id of the created record is returned in the response payload.

    Date time formats used by the REST API follow ISO-8601 standards. YYYY-MM-DDThh:mm:ss.sTZD

    Times are stored in the Xytech database as UTC times (the exception being when the Master Time Zone is not set to UTC, which is a legacy option)

    The recommendation is to work in UTC times or local times using the Time Zone Header attribute.

    UTC time format: 2025-02-20T10:00:00.000Z 2025-02-20T10:00:00Z

    Or Using time zone offset: 2025-02-16T04:00:00-05:00

    Or use the header 'Source-Time-Zone-Name' to define the time zone. e.g. header: Source-Time-Zone-Name: Pacific Standard Time

    Use this if you want to supply API payload times in local times, any DST offsets will be auto calculated when the system stores the UTC time into the database.

    This will override any time zone offset supplied.

    Will respond with the offset attribute. 2025-02-20T10:00:00+00:00

    (Note any offset is determined by the app server time zone , normally set to UTC, the time plus offset will equate to the UTC time)

    Creating Records with key fields

    Creating records with alternate keys

    External Key

    Generating the primary key

    Time formats

    POST, PUT and PATCH Examples

    GET and response payloads

    curl --location --request PATCH 'http://{APIbaseURL}/JmWorkOrder/wo_no_seq=8248-1' \
    --header 'Content-Type: application/json-patch+json' \
    --header 'Authorization: Basic **********' \
    --data '{
        "jm_work_order": [
            {
                "wo_no_seq": {
                    "wo_no_seq": "8248-1"
                },
                "wo_desc": "My New Description",
                "po": "123456",
                "phase_code": "Hold"
            }
        ]
    }'
    {
        "message": null,
        "tables": []
    }
    curl --location --globoff --request PATCH 'http://{APIbaseURL}/JmWorkOrderList?Query={"date_added":{"$range":["2022-07-26T00:00:00","2023-07-28T00:00:00"]},"wo_type_no": 40}' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: ••••••' \
    --data '[
      {
        "op": "replace",
        "path": "wo_reference",
        "value": "Quick Service 2"
      }
    ]'
    {
        "jm_job": [
            {
                "job_no": {
                    "job_no": -1
                },
                "division_no": {
                    "division_no": 2
                },
                "cust_id": {
                    "cust_id": 409
                },
                "job_desc": "Passing Fancy",
                "external_key": "1234",
                "po": "PO002",
                "job_type_no": {
                    "job_type_no": 1113
                }
            }
        ]
    }
    {
        "jm_job": [
            {
                "job_no": -1,
                "division_no": 2,
                "cust_id": "409",
                "job_desc": "Passing Fancy",
                "external_key": "1234",
                "po": "PO002",
                "job_type_no": 1113
            }
        ]
    }
    {
        "sch_resource": [
            {
                "resource_code": {
                    "resource_code": "FRED01"
                },
                "resource_desc": "Fred",
                "external_key": "Ext001"
            }
        ]
    }
    {
        "jm_job": [
            {
                "job_no": {
                    "job_no": 342,
                    "external_key": "154110"
                },
                "division_no": {
                    "division_no": 2,
                    "division_desc": "Burbank ",
                    "division_code": "BRB",
                    "external_key": null
                },
                "cust_id": {
                    "list_id": "409",
                    "other_cust_id": null,
                    "cust_reference": null,
                    "external_key": null,
                    "cust_id": "409"
                },
                "other_cust_id": null,
                "external_key": "154110",
                "customer_name": "Tupper Lake Films",
                ...
    {
        "lib_master": [
            {
                "master_no": {
                    "master_no": 18,
                    "barcode": "2000XYT",
                    "external_key": null,
                    "umid": null
                },
                "cust_id": {
                    "list_id": "32",
                    "other_cust_id": null,
                    "cust_reference": null,
                    "external_key": null,
                    "cust_id": "32"
                },
                "customer_name": "Alchemy Films",
                "master_desc": "International Master  
                ...
    {{server}}/LibMaster/barcode=2000XYT
    {
        "jm_work_order": [
            {
                "wo_no_seq": "+1",
                "wo_desc": "Match20",
                "wo_begin_dt": "2023-08-22T10:00:00.000Z",
                "wo_end_dt": "2023-08-22T16:00:00.000Z",
                "wo_type_no": 17,
                "phase_code": "Bid",
                "rate_card_no": 1,
                "cust_id": 19
            }
        ]
    }
    Selected Database: The name of the database currently selected for this host.
  • Available Databases: (Where multiple databases exist on the same host) Click a database to select it and view its associated endpoint modules.

  • Filter Documents: Enter text into this field and press [Enter] to display matching endpoint descriptions.

  • Module and Document List: Only modules in the selected database are displayed. Click any Module to expand and show the endpoints it contains. Each endpoint has a label that describes its type (Document [maintenance], List, or Setup).

  • The OpenAPI definition model identifies many fields as mandatory (nullable: false), which indicates that a value must be provided when the item is written to the database. However, in some cases, the business logic will provide default values, so it may not be strictly necessary to pass values for all mandatory fields to the API to create a new record. For example, in a basic payload to create a Work Order, OpenAPI identifies at least 25 fields as mandatory, but the most basic payload to create a Work Order requires 7.

    For versions prior to v10.2 you will need to generate the OpenAPI documentation manually for each document endpoint. Use a browser to generate the OpenAPI document: http://{host}:{port}/API/v2/database/{db_name}/spec/{docName}

    For example: http://myhost:8088/API/v2/database/mp10/spec/JmJob

    The above URL will generate the OpenAPI document and then display the OpenAPI document. To display generated OpenAPI documents, browse to: http://{host}:{port}/REST/SwaggerUI/dist/index.html?document={docName}_v2

    For example: http://myhost:8088/REST/SwaggerUI/dist/index.html?document=JmDivision_v2

    There are over 1000 individual documents (endpoints) available to Xytech's REST API. Below is a small sample of those documents. The full list of available documents can be obtained directly from the Xytech UI using the Document Customizations list found under the System module. Specific details on each document can be found via the OpenAPI (Swagger) documentation.

    ID

    Class Name

    Document Description

    Document Type

    10315

    JmJob

    Job

    Maintenance

    Summary Index

    Using the Index

    Demo OpenAPI definitions See a demo of Xytech OpenAPI definitions

    Mandatory Fields Note

    For versions prior to v10.2

    Endpoint List

    {
        "cust_id": {
            "cust_id": "4",
            "cust_reference": "a",
            "list_id": "4",
            "other_cust_id": "80000016-1475102220"
        },
        "customer_name": "Xytech Systems (80000016-1475102220)",
        "division_no": {
            "division_code": "BUR",
            "division_desc": "Burbank",
            "division_no": 12
        },
        "jm_episode": [
            {
                "episode_desc": "Come, Now is the Time to Worship",
                "episode_number": "3",
                "job_no": 1
            }
        ],
        "jm_installment": [
            {
                "installment_desc": "First installment",
                "installment_no": 1486,
                "job_no": 1
            }
        ],
        "job_no": {
            "external_key": null,
            "job_no": 1
        },
        "other_cust_id": "80000016-1475102220"
    }
    {
    	"jm_job": [
    		{
    			"job_no": {
    				"job_no": 1
    			},
    			"division_no": {
    				"division_no": 12
    			},
    			"cust_id": {
    				"cust_id": "4"
    			},
    			"customer_name": "Xytech Systems (80000016-1475102220)",
    			"title": "Hungary",
    			"job_type_no": {
    				"job_type_no": 1158
    			},
    			"jm_episode": [
    				{
    					"job_no": 1,
    					"episode_det_no": {
    						"episode_det_no": 1
    					},
    					"episode_number": "3",
    					"episode_desc": "Come, Now is the Time to Worship",
    				}
    			],
    			"jm_installment": [
    				{
    					"installment_no": {
    						"installment_no": 1486
    					},
    					"installment_desc": "First installment",
    					"term_no": {
    						"term_no": 33
    					},
    					"invoice_type": {
    						"invoice_type": 1
    					},
    				},
    			]
    		}
    	]
    }
    {
        "wo_desc": " AS XM Test 7",
        "wo_begin_dt": "2024-09-07T00:00:00-07:00",
        "wo_end_dt": "2024-09-07T00:00:00-07:00",
        "wo_type_no": {
            "wo_type_no": 3301
        },
        "phase_code": {
            "phase_code": "Conf"
        },
        "cust_id": {
            "list_id": "403"
        },
        "xm_mode_type": "O",
        "xm_mode_no": {
            "xm_mode_no": 12
        }
    }
    {
        "jm_work_order": [
            {
                "wo_desc": " AS XM Test 7",
                "wo_begin_dt": "2024-09-07T00:00:00-07:00",
                "wo_end_dt": "2024-09-07T00:00:00-07:00",
                "wo_type_no": {
                    "wo_type_no": 3301
                },
                "phase_code": {
                    "phase_code": "Conf"
                },
                "cust_id": {
                    "list_id": "403"
                },
                "xm_mode_type": "O",
                "xm_mode_no": {
                    "xm_mode_no": 12
                },
                "mo_service_row": [
                    {
                        "service_row_no": {
                            "service_row_no": -1
                        },
                        "service_header": "Y",
                        "service_no": {
                            "service_no": 482
                        },
                        "service_profile_no": {
                            "service_profile_no": 1264
                        },
                        "service_status_no": {
                            "service_status_no": 3,
                            "service_status_code": "RDY"
                        },
                        "service_profile_desc": "Media Broadcast BNS"
                    },
                    {
                        "service_row_no": {
                            "service_row_no": -2
                        },
                        "service_header": "N",
                        "service_no": {
                            "service_no": 482
                        },
                        "service_profile_no": {
                            "service_profile_no": 1264
                        },
                        "service_status_no": {
                            "service_status_no": 3,
                            "service_status_code": "RDY"
                        },
                        "parent_service_row_no": -1,
                        "service_profile_desc": "Media Broadcast BNS",
                        "mo_operation": [
                            {
                                "operation_no": {
                                    "operation_no": -1
                                },
                                "task_no": {
                                    "task_no": 200,
                                    "task_code": "ALW"
                                },
                                "service_row_no": -1,
                                "status_no": 2,
                                "task_code": "ALW",
                                "trx_group_code": {
                                    "group_code": "0004S",
                                    "trx_group_code": "0004S"
                                },
                                "trx_resource_code": {
                                    "resource_code": "FCR10",
                                    "trx_resource_code": "FCR10"
                                },
                                "trx_phase_code": {
                                    "phase_code": "Conf",
                                    "trx_phase_code": "Conf"
                                },
                                "trx_sched_qty": 1,
                                "lock_billing_unit": "N"
                            }
                        ]
                    }
                ]
            }
        ]
    }
    {
        "message": null,
        "tables": [
            "jm_work_order",
            "mo_service_row",
            "mo_operation"
        ],
        "jm_work_order": {
            "record_identifiers": [
                "wo_no_seq"
            ],
            "records": [
                {
                    "wo_no_seq": "1067998-1"
                }
            ]
        },
        "mo_service_row": {
            "record_identifiers": [
                "service_row_no"
            ],
            "records": [
                {
                    "service_row_no": 217413
                },
                {
                    "service_row_no": 217414
                }
            ]
        },
        "mo_operation": {
            "record_identifiers": [
                "operation_no"
            ],
            "records": [
                {
                    "operation_no": 128370
                },
                {
                    "operation_no": 128371
                }
            ]
        }
    }

    Migrating to API v2

    1. Change your URL to the v2 path.

    2. Update to handle the improved payload structure.

    3. Utilise new parameters

    4. Use PUT requests for upserts (create or update)

    5. Utilise the new response payload with IDs of created records

    315

    JmJobList

    Jobs

    Select (List)

    10317

    JmJobStatus

    Job Statuses

    Setup

    10318

    JmJobTable1

    Subscription

    Setup

    10322

    JmJobType

    Job Types

    Setup

    359

    JmTrxReport

    Transaction Reports

    Select (List)

    10339

    JmWorkOrder

    Work Order

    Maintenance

    10346

    JmWoTransaction

    Work Order Transactions

    Maintenance

    here

    Save Arguments

    API Function

    In some cases, you must also add a header to trigger the app server to perform a function as part of an API call. For example, when creating a Work Order, to load a Work Order Template you must provide the SaveArgument header parameter as well as including the wo_template_no value in the payload.

    Below is a list of Save Arguments

    Load a Template to an order

    Applicable endpoints: JmWorkOrder, MoMediaOrder, XmTransmissionOrder

    Loads Work Order Template to an order.

    This replaces LoadTemplate as an improved method that includes the option to append or replace existing transactions. (Available from release 26.1)

    saveArgument : {"LoadTemplateOption":1}
    
    //option to load child templates
    saveArgument : {"LoadTemplateOption":1,"LoadChildTemplates":"Y"}

    Options:

    • 1 = append template transactions to existing order transactions

    • 0 = replace any existing order transactions with the template transactions

    Applies to POST, PATCH and PUT methods. Requires the wo_template_no to exist in the payload.

    Example:

    POST - create Work Order and load template

    Where the number represents the number of the template to load.

    To load child templates (available from release 11.3), add an additional parameter called 'LoadChildTemplates'

    Example when creating an order using a POST call. The template number must be provided in both the header and the payload.


    For transmission orders, you can load a Service Template

    And populate the XmTransmissionOrder payload with service_template_no value

    Multiple Service Templates can be loaded by including comma separated values:

    In this scenario you can leave the "service_template_no" in the body as null.


    Function to void an Order.

    Where the number represents the Work Order number sequence.

    Example using a PATCH call:


    Provides the ability to un-void an Order.

    Example using a PATCH call with the header Content-Type : application/json-patch+json


    v11.1

    To actualize selected or all transactions. This save argument will update the transaction and order phase, effectively posting the actuals.

    Variations:

    Intended to be used in conjunction with the POST of actual actions. This save argument then performs the action of actualization.

    Example single transaction actualization without times:


    v11.1

    Replicates the action UI menu item to 'Post' the batch.

    Example PATCH payload:


    Function to set the default Group of a scheduling resource. The Group must already be assigned to the Resource in the Group list.

    Example using a PATCH call with the header Content-Type : application/json-patch+json


    Changes the bid approval state of a Bid using number that represents the approval type.

    Approval number types:

    Example using a PATCH call to set the 'approved' value and the header save argument.


    Where applicable, multiple save arguments can be used as an array separated by a comma.

    Example:

    4

    Abort

    0

    Approval

    1

    Unapproval

    2

    ApproveAsChangeMemo

    3

    ApproveAndUnApproveOriginal

    Load Template - prior method still supported.

    Load a Service Template

    Void a Work Order

    Applicable endpoints: JmWorkOrder, MoMediaOrder, XmTransmissionOrder

    Un-Void a Work Order

    Applicable endpoints: JmWorkOrder, MoMediaOrder, XmTransmissionOrder

    Actualise Work Order actuals

    Applicable endpoints: JmActual

    Post Time Card Batch

    Applicable endpoint: TcBatch

    Set the default Group of a Scheduling Resource

    Applicable endpoints: SchResource

    Approve a Bid

    Applicable endpoints: BidVersion

    Multiple Save Arguments

    curl --location --globoff '{APIBaseURL}/JmWorkOrder' \
    --header 'Content-Type: application/json' \
    --header 'saveArgument: {"LoadTemplateOption":1,"LoadChildTemplates":"Y"}' \
    --header 'Authorization: Basic ********' \
    --data '{
        "jm_work_order": [
            {
                "wo_no_seq": {
                    "wo_no_seq": "+1"
                },
                "wo_desc": "Match2006",
                "wo_begin_dt": "2026-08-22T10:00:00.000Z",
                "wo_end_dt": "2026-08-22T16:00:00.000Z",
                "wo_template_no": {
                    "wo_template_no": 1050
                },
                "wo_type_no": {
                    "wo_type_no": 3275
                },
                "phase_code": {
                    "phase_code": "Hold"
                },
                "rate_card_no": {
                    "rate_card_no": 1
                },
                "cust_id": {
                    "cust_id": "1157"
                }
            }
        ]
    }'
    SaveArgument : {"LoadTemplate":"2"}
    SaveArgument: {"LoadTemplate":"1012","LoadChildTemplates":"Y"}
    curl --location 'http://{APIbaseURL}/JmWorkOrder' \
    --header 'Content-Type: application/json' \
    --header 'SaveArgument: {"LoadTemplate":"15"}' \
    --header 'Authorization: Basic ••••••' \
    --data '{
        "jm_work_order": [
            {
                "wo_desc": "100m Finals",
                "wo_begin_dt": "2024-08-22T10:00:00.000Z",
                "wo_end_dt": "2024-08-22T16:00:00.000Z",
                "wo_type_no": 17,
                "phase_code": "RQST",
                "rate_card_no": 1,
                "cust_id": 27,
                "wo_template_no": 15
            }
        ]
    }'
    SaveArgument : {"LoadServiceTemplate":"10"}
    "service_template_no":10
    SaveArgument : {"LoadServiceTemplate":"10","11"}
    SaveArgument: {"VoidWorkOrder":"36914-1"}
    curl --location --request PATCH 'http://{APIbaseURL}/JmWorkOrder/wo_no_seq=2626-1' \
    --header 'Content-Type: application/json' \
    --header 'SaveArgument: {"VoidWorkOrder":"2626-1"}' \
    --header 'Authorization: Basic ••••••' \
    --data '[
       {
           "op": "replace",
           "path": "cancel_no",
           "value": 1
       }
    ]'
    SaveArgument : {"UnVoidWorkOrder":"1067982-1"}
    curl --location --request PATCH 'http://{APIbaseURL}/JmWorkOrder/wo_no_seq=1067982-1' \
    --header 'SaveArgument: {"UnVoidWorkOrder":"1067982-1"}' \
    --header 'Content-Type: application/json-patch+json' \
    --header 'Authorization: ••••••' \
    --data ''
    saveArgument : { "ActualizeSelected":"38521,38522", "ActualizeUpdatePhase":"Y"}
    saveArgument : { "ActualizeAll":"-2", "ActualizeUpdatePhase":"Y"}
    
    SaveArgument : { "ActualizeSelected":"-2,200003,200004", "ActuallizeUpdatePhase":"Y"}
    curl --location 'http://{APIbaseURL}/JmActual/' \
    --header 'Content-Type: application/json' \
    --header 'SaveArgument: { "ActualizeSelected":"1259520", "ActualizeUpdatePhase":"Y"}' \
    --header 'Authorization: ••••••' \
    --data '{
        "jm_actual_header": [
            {
                "actual_hdr_no": {
                    "actual_hdr_no": -1
                },
                "wo_no": 9453,
                "wo_seq": 1,
                "wo_no_seq": {
                    "wo_no_seq": "1075881-1"
                },
                "actual_status": "Y",
                "jm_actual_detail": [
                    {
                        "actual_hdr_no": -1,
                        "actual_det_no": -2,
                        "action_code": {
                            "action_code": "I"
                        },
                        "actual_unit": 4,
                        "actual": "Y"
                    }
                ],
                "jm_actual_link": [
                    {
                        "actual_link_no": -3,
                        "actual_det_no": -2,
                        "trx_no": 1259520
                    }
                ]
            }
        ]
    }'
    saveArgument : {"Post":""}
    curl --location --request PATCH '/TcBatch/batch_no=7572' \
    --header 'Content-Type: application/json-patch+json' \
    --header 'saveArgument: {"Post":""}' \
    --header 'Authorization: Basic aHR0cDovL2RldndjdW1wYXBwMjoxMTAwMC9hcGkvdjIvZGF0YWJhc2UvWFlUX01BSU5fVjp4eXRlY2hwdw==' \
    --data '{
        "tc_batch": [
            {
                "batch_no": {
                    "batch_no": "7572"
                }
            }
        ]
    }'
    SaveArgument : {"GroupCode":"UKPS"}
    curl --location --request PATCH 'http://{APIbaseURL}/SchResource/resource_code=3' \
    --header 'Content-Type: application/json-patch+json' \
    --header 'SaveArgument: {"GroupCode":"TRX"}' \
    --header 'Authorization: Basic ••••••' \
    --data ''
    SaveArgument : {"BidApproval":"0"}
    curl --location --request PATCH 'http://{APIbaseURL}/BidVersion/version_no=211' \
    --header 'Content-Type: application/json' \
    --header 'SaveArgument: {"BidApproval":"0"}' \
    --header 'Authorization: Basic ••••••' \
    --data '[
        {
            "op": "replace",
            "path": "approved",
            "value": "Y"
        }
    ]'
    SaveArgument : {"LoadServiceTemplate":"10","LoadTemplate":"2"}

    Working with Query Parameters and Filters

    Query Parameter

    GET and PATCH List endpoints require query parameters.

    This section describes the syntax and options used for the query parameter. This is a mandatory parameter for List documents.

    The standard format for a “query” parameter is to add the parameter as query={} to the end of a GET request for a List document after the parameter delimiter (“?”), where the value of query= is a JSON object:

    http://{APIbase_url}/documentList?query={key: value}

    Such as:

    http://{APIbase_url}/jmJobList?query={"job_no": "12345"}

    Note: The query parameter is supported with GET and PATCH requests of List type documents and is not supported by GET requests for Setup or Maintenance documents.

    In the simplest form, the value is a single piece of information, such as a string or integer. In more complex forms, the value is a JSON object containing specific formats as described below.

    See section regarding URL encoding requirements:

    To return items that match a specified string. The string can either be letters or numbers. Wildcard ‘%’ can be used. Remember to URL encode the % sign.

    Description
    Parameter values

    To return items that fall between a specified minimum and maximum numeric value.

    Description
    Parameter values

    To return items that match one of the values provided in a given set of values. See section below on wildcards

    Description
    Parameter values

    To return items that have NULL values. Note: Put pipe characters around NULL to differentiate it from the literal string “NULL”.

    Description
    Parameter Values

    To return items that do not match the specified number, string, or NULL.

    Description
    Parameter Values

    To return items where values are greater than or less than a given value.

    Description
    Abv
    Parameter values

    Full GET example for greater than

    (11.1) Ability to query where a field's value does not match an array of supplied values. Usage example: {{server}}/PmProjectList?query={"project_desc":{"$notin":["test", "Sarah"]}} Applies to GET queries.

    (11.1) Ability to define an array of matching values that all have to match regardless of the order defined. {{server}}/LibMasterList?{"master_desc":{"$LIKEAND":["%Genesis%","%XHD%"]} Applies to GET queries.

    The Null parameter returns any record that has a null value for the specified key, which indicates that no value has ever been set. This differentiates it from an empty string for text-based or date-based properties, a 0 value for numbers, and true or false values for Boolean properties.

    Note: Not all fields support null values. If possible, check the OpenAPI definition whether the field allows nulls.

    Values

    • String values are not case-sensitive.

    • DateTime values should be provided in a valid ISO date format.

    When using HTML special characters as part of the query value, they must be URL encoded.

    Example: to use a wildcard query such as "%dave%", the % needs substituting with %25. Once URL encoded will look like this %25dave%25

    Example GET query with URL encoded wildcard : {{server}}/MoMediaOrderList?query={"wo_desc":"%25dave%25"}&resultcolumns={"L": ["wo_no", "wo_desc"]}

    (The reason why %dave% fails to return valid results it that %da is the encoding for the Ú character)

    This also applies to datetime values that use the offset attribute with the + sign.

    To include a value of "2023-06-01T09:00+5:00" in a URL query parameter, substitute + with %2b

    Example: query={"wo_begin_dt":{"$range":["2023-06-01T09:00%2b5:00","2023-06-01T17:00%2b5:00"]}}

    If you wanted to search for multiple wildcard values contained within a single field that all need to exist, then you can include a list of wildcard values.

    For example, if you wanted to search for media assets that have "Tale" AND "Dark" in their "master_desc" field, you can use the following query parameter:

    {"master_desc":{$in:["%Tale%Dark%","%Tale%Dark%"]}}

    Note you may need to use encode the % symbol (for instance if using Postman) you will need:

    {"master_desc":{$in:["%25Tale%25Dark%25","%25Tale%25Dark%25"]}}

    Used by the GET method on List and Maintenance endpoints.

    resultColumns parameter is used to define the fields you wish to return in the response. Without this parameter, the response will contain all document fields which is not recommended for performance reasons.

    For example: {APIbaseurl}/JmJobList?Query={"job_no":2}&resultColumns={"L":["job_no","job_desc"]}

    Job No. and Job Description fields will be included in the response. Important to include the “L” as the top-level element.

    Sub-Table columns

    Many endpoints include related sub-tables in their responses. Example syntax to include specific sub-table columns.

    Below example fetches a transmission order description and all it's service row numbers:

    {APIbase_url}/XmTransmissionOrder/wo_no_seq=7655-1?resultColumns={"jm_work_order":["wo_desc"],"mo_service_row":["service_row_no"]}

    Response:

    API Pagination is available for the GET Query on List endpoints.

    Parameter
    Type
    Description

    Sort parameters: Syntax: sort=[field1 sort, field2 sort] Example: sort=["job_desc desc", "job_no desc"]

    Note: If you don’t specify pageSize, the ‘page’ and ‘sort’ options are ignored. If you do specify a pageSize and do not pass a page, page will default to 1.

    Example: To return the first 10 records on page 1 sorted by product_no:

    Full example:

    The above example queries for jobs that have job numbers in the range of 1 to 67982, returns job number and job description fields but only the 7th page with 5 jobs sorted first by description (descending) then by job number (descending).

    The response header will include a parameter called 'Pagination-Count' which is the count of all records as a result of the query.

    This will allows you to call for data in manageable payloads without exceeding memory limitations.

    This optional parameter suppresses all null value fields from the response payload. Using this parameter reduces the payload size dramatically, especially for larger queries. (v10.6+)

    Applicable for all GET calls with List, Maintenance & Report endpoints. Values are ‘ignore’ or ‘include’ (default). 'include' means that all null values are included in the response.

    Examples: URL Parameter:- nullvaluehandling=include (default)

    URL Parameter:- nullvaluehandling=ignore (recommended)

    Notice how all null value fields are omitted.

    This optional parameter suppresses additional key fields from the responses. If you do not need to work with key fields other than the primary key, use this parameter to keep the API call performant and reduce the processing overhead when not working with alternate key fields. (v10.6+)

    Applicable for all GET calls with List, Maintenance endpoints.

    Values are ‘ignore’ or ‘include’ (default). ‘include’ includes alternate keys in the response.

    Example: URL Parameter:- alternatekeyhandling=include (default)

    URL Parameter:- alternatekeyhandling=ignore (recomended)

    Notice how the additional key fields barcode, external_key & umid are omitted.

    The REST API uses Date time formats in ISO format with an optional offset value.

    e.g. 2014-11-03T22:20:00+00:00

    If you omit the offset value when using POST to create a record, you can use a header parameter to set the time zone your dates are using. The advantage of using this header approach, is that it will respect any daylight savings offset applicable to the date given.

    Header Key
    Header Value

    e.g. header: Source-Time-Zone-Name: Pacific Standard Time

    This example will will create records in the time zone of Pacific Standard Time. Remember to omit the offset values in your time formats.

    See link for list of

    (11.1)

    REST API calls support the ability to pass the Division as an override to the API API user's default Division.

    An optional header called "Division-Code" exists where you can include the Division code. This will ensure the correct results are returned for the API users when using Divisions.

    The API user account must have been given user access to the division to be able to successfully pass it in the API call. If not, you will receive an error message.

    e.g. Division-Code : GS

    Using Postman:

    This capability replicates the functionality when a user accesses the webapp with their default division, who will see data filtered by their default Division.

    Applicable only to sites that use the Division feature.

    Note: When specifying multiple key/value pairs, the API will return only items that match ALL specified criteria.

    Not number

    query={"cust_id":{"$ne":1001}}

    Not null

    query={"jm_phase_external_key":{"$ne":"|NULL|"}}

    Not like

    query={"wo_desc":{"$ne":"Test%"},"wo_type_no": 83}

    Greater Than

    $gt

    query={"title_no":{"$gt": 106438}}

    Greater Than Or Equal

    $gte

    query={"date_added":{"$gte":"2022-07-26T00:00:00"}}

    Less Than

    $lt

    query={"date_added":{"$lt":"2022-07-26T00:00:00"}}

    Less Than Or Equal

    $lte

    query={"date_added":{"$lte":"2022-07-26T00:00:00"}}

    Values can be numeric or dates.

    sort

    String

    is the field to sort followed by ascending or descending option

    Syntax

    query= {"field":"value"}

    Examples

    query={"job_desc":"Big Apple Live"} query={"job_desc":"%Big%"} query={"job_no":101101}

    Multiple key/value pairs

    To specify multiple key/value pairs, separate each key/value pair with a comma query={"cust_id":"123","job_type_no":"4"} query={"cust_id":"123","job_type_no":"4","active":"Y"}

    Syntax

    query="field":{"$range":[lower_limit, upper_limit]}

    Examples

    query={"job_no":{"$range":[100, 199]}}

    query={"wo_begin_dt":{"$range":["2023-12-01","2023-12-31"]}}

    query={"wo_begin_dt":{"$range":["2023-06-01T09:00","2023-06-01T17:00"]}}

    Syntax

    query={“field”:{"$in":[“value_1”,”value_2”, … ”value_n”]}}

    Examples

    query={“job_no”:{"$in":[100, 105, 110, 119]}}

    Syntax

    query={"field": "|NULL|"}

    Examples

    query={"phone_number":"|NULL|"}

    Syntax

    query={"field":{"$ne":"value"}}

    Examples:

    Not string

    query={"job_desc ":{"$ne":"Big Apple Live"}}

    Syntax

    query={"field":{"option": "value"}}

    Examples:

    pageSize

    Integer

    is the number of records returned per page

    page

    Integer

    is the page number to return

    Source-Time-Zone-Name

    {Windows Time Zone name}

    Query Filters

    String or Number

    Range

    In

    Null (empty)

    NE (not equal)

    Greater than and less than new query parameters

    NOTIN (Not in)

    LIKEAND (Like and)

    Query Filter Tips

    NULL Values

    URL encoding of special characters

    Searching for multiple wildcard values

    Result Columns Parameter

    Performance recommendation. Always use the resultColumns parameter otherwise responses will return large numbers of fields most of which will not be required and only adds to the system performance overhead. In the future API v3, this will become a mandatory parameter.

    Pagination and Sort Parameters

    Null Value Handling Parameter

    Performance Recommendation It's recommended to always include this parameter with the value 'ignore', unless visibility of null values is required.

    Alternate Key Handling Parameter

    Performance Recommendation It's recommended to always include this parameter with the value 'ignore', unless you are working with alternate keys.

    Source Time Zone Name Header

    Division

    URL encoding of special characters
    Searching for multiple wildcard values
    Windows Time Zones
    curl --location --globoff 'http://{APIbaseURL}/LibMasterList?resultcolumns={"L": ["master_no", "master_desc", "date_added","desc_3"]}&query={"title_no":{"$gt": 1102}}' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic ******' \
    --data ''
    {
        "jm_work_order": [
            {
                "mo_service_row": [
                    {
                        "service_row_no": {
                            "external_key": null,
                            "service_row_no": 9933
                        }
                    },
                    {
                        "service_row_no": {
                            "external_key": null,
                            "service_row_no": 9934
                        }
                    }
                ],
                "wo_desc": "WS Transmission Test"
            }
        ]
    }
    GET {APIbaseURL}/JmOrgProductList?query={"active":"Y"}&resultColumns={"L":["product_no","product_desc"]}&sort=["product_no desc"]&pageSize=10&page=1
    GET {APIbaseURL}/JmJobList?query={"job_no":{"$range":[1,67982]}}&resultcolumns={"L": ["job_no", "job_desc"]}&pageSize=5&page=7&sort=["job_desc desc", "job_no desc"]
    {
        "L": [
            {
                "barcode": "MM915",
                "company_name": null,
                "cust_id": null,
                "master_desc": null,
                "master_no": {
                    "barcode": "MM915",
                    "external_key": "VX-90",
                    "master_no": 915,
                    "umid": null
    ...
    {
        "L": [
            {
                "barcode": "MM915",
                "master_no": {
                    "barcode": "MM915",
                    "external_key": "VX-90",
                    "master_no": 915
    ...
    {
        "L": [
            {
                "barcode": "MM915",
                "company_name": null,
                "cust_id": null,
                "master_desc": null,
                "master_no": {
                    "barcode": "MM915",
                    "external_key": "VX-90",
                    "master_no": 915,
                    "umid": null
    ...
    {
        "L": [
            {
                "barcode": "MM915",
                "company_name": null,
                "cust_id": null,
                "master_desc": null,
                "master_no": {
                    "master_no": 915
    ...