Documentation Summary

REST API

API Calls

This page lists all the API calls available.

With the exception of the call to request a JWT, all API calls use bearer token authorisation with the JWT to authorise requests.

Because the API is deployment-specific (instance-specific), each instance of the API has its own URL.

All calls that return custom field values (product metadata fields, order fields, user profile fields etc.) only return values stored in the Storefront database. Values dynamically retrieved from remote data sources (such as third party web services and APIs) are not returned.

Tokens

POST {DeploymentURL}/restapi/token

This call receives an API key returns a JWT to authorize subsequent API calls.

Request:
{ "apikey" : "{APIKey}" }

Response 200 - OK:
{ "jwttoken" : "{JWT}" }

Users

GET {DeploymentURL}/restapi/users/{UserID}

GET {DeploymentURL}/restapi/users/{Username}

This call returns a User object based on the User ID or Username provided. Where there is both a User ID and Username with matching values, the API will favour the User ID.

Response 200 - OK:
{
    "Id": "{UserID}",
    "LoginName": "{Username}",
    "CustomUserFields": [
        {
            "Name": "{UserProfileFieldName}",
            "Value": "{UserProfileFieldValue}"
        },
        {
            "Name": "{UserProfileFieldName}",
            "Value": "{UserProfileFieldValue}"
        }
    ],
    "CustomUserGroups": [
        {
            "Id": "{UserGroupID}",
            "Name": "{UserGroupName}"
        },
        {
            "Id": "{UserGroupID}",
            "Name": "{UserGroupName}"
        }
    ]
}
Response 404 - Not Found: No user was found matching the criteria.

POST {DeploymentURL}/restapi/users/{Username}/loginticket

This call returns a ticket to sign the user into the deployment without a password. Login tickets are single-use and expire after 24-hours. To sign a user into the deployment, redirect the user to the to the /Login.aspx?ticket="{LoginTicket}"&logonName="{Username}" page with the listed arguments.

Response 200 - OK:
{ "loginticket": "{LoginTicket}" }

POST {DeploymentURL}/restapi/users

This call creates a new user account in the target deployment.

Request:
{
    "LoginName" : "{Username}",
    "Password" : "{Password}"
}

Response 201 - Created:
{ "LoginName": "{Username}" }
Response 409 - Conflict: A user account with these details already exists in the target deployment.

PATCH {DeploymentURL}/restapi/users/{Username}

This call updates a user's profile fields in the target deployment based on provided properties.

Request:
{
    "CustomUserFields": [
        {
            "Name": "{UserProfileFieldName}",
            "Value": "{UserProfileFieldValue}"
        },
        {
            "Name": "{UserProfileFieldName}",
            "Value": "{UserProfileFieldValue}"
        }
    ]
}

Response 200 - OK: The operation completed successfully.
Response 404 - Not Found: No user was found matching the criteria.

Permissions

POST {DeploymentURL}/restapi/permissions

DELETE {DeploymentURL}/restapi/permissions

These calls add and remove users from groups based on the provided relationships. Each group can only be specified once in the request.

Request:
{
    "{UserGroupName}": ["{Username}" , "{Username}" , ... ],
    "{UserGroupName}": ["{Username}" , "{Username}" , ... ]
}

Response 200 - OK: The operation completed successfully.

Products

GET {DeploymentURL}/restapi/products

GET {DeploymentURL}/restapi/products?id={ProductID},{ProductID},...

This call returns the list of all active products in the target deployment. This list can be filtered by specifying a comma-separated list of Product IDs. Products that are not found are not added to the response but the HTTP status '200 - OK' is still returned if at least one product is found.

Response 200 - OK:
[
    {
        "ProductId": "{ProductID}",
        "Name": "{ProductName}",
        "Description": "{ProductDescription}",
	"TaxCategoryName": "{TaxCategoryName}",
	"TaxCategoryRate": {TaxCategoryRate},
        "CustomProductFields": [
            {
                "Name": "{ProductMetadataFieldName}",
                "Value": "{ProductMetadataFieldValue}"
            },
            {
                "Name": "{ProductMetadataFieldName}",
                "Value": "{ProductMetadataFieldValue}"
            }
        ],
        "CustomProductCategories": [
            {
                "Id": "{ProductCategoryID}",
                "DisplayName": "{ProductCategoryName}"
            },
            {
                "Id": "{ProductCategoryID}",
                "DisplayName": "{ProductCategoryName}"
            }
        ]
    },
    {
        "ProductId": "{ProductID}",
        "Name": "{ProductName}",
        "Description": "{ProductDescription}",
        "CustomProductFields": [
            {
                "Name": "{ProductMetadataFieldName}",
                "Value": "{ProductMetadataFieldValue}"
            },
            {
                "Name": "{ProductMetadataFieldName}",
                "Value": "{ProductMetadataFieldValue}"
            }
        ],
        "CustomProductCategories": [
            {
                "Id": "{ProductCategoryID}",
                "DisplayName": "{ProductCategoryName}"
            },
            {
                "Id": "{ProductCategoryID}",
                "DisplayName": "{ProductCategoryName}"
            }
        ]
    }
]
Response 404 - Not Found: No products were found matching the criteria.

Orders

GET {DeploymentURL}/restapi/orders?from={yyyy-MM-dd}&to={yyyy-MM-dd}

GET {DeploymentURL}/restapi/orders?from={yyyy-MM-ddTHH:mm}&to={yyyy-MM-ddTHH:mm}

GET {DeploymentURL}/restapi/orders?id={OrderID},{OrderID},...

This call returns the list of all orders placed between the specified dates. For date and time based calls if the hours and minutes are omitted, the call uses '23:59:59' for the 'to' input parameter (to include all records from the relevant day). This list can alternatively be filtered by specifying a comma-separated list of order IDs. For enumerated values see Enumerations.

Response 200 - OK:
[
    {
        "orderId": "{OrderID}",
        "externalId": ""{ExternalOrderID}",
        "userId": "{UserID}",
        "dateTimeOrderPlaced": "{yyyy-MM-dd}T{HH:mm:ss}",
        "approvalWorkflowName": "{WorkflowName}",
        "orderReviewer": "{UserID}",
        "reviewerComment": "{ApproverComment}",
        "handlingCharge": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "shippingCharge": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "orderTotal": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
	"orderRawTotal": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "orderTax": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "orderWeight": {Weight},
        "orderParts": [
            {
                "id": "{ShipmentID}",
                "orderId": "{OrderID}",
                "documentIdList": [
                    "{ItemID}"
                ],
                "shippingAddress": {
                    "{AddressFieldName}": "{AddressFieldValue}",
                    "{AddressFieldName}": "{AddressFieldValue}"
                }
            }
        ],
        "documentIdList": [
            "{ItemID}"
        ],
        "CustomShippingFields": [
            {
                "Name": "{ShippingFieldName}",
                "Value": "{ShipmentValue}"
            },
            {
                "Name": "{ShippingFieldName}",
                "Value": "{ShipmentValue}"
            }
        ]
    },
    {
        "orderId": "{OrderID}",
        "externalId": ""{ExternalOrderID}",
        "userId": "{UserID}",
        "dateTimeOrderPlaced": "{yyyy-MM-dd}T{HH:mm:ss}",
        "approvalWorkflowName": "{WorkflowName}",
        "orderReviewer": "{UserID}",
        "reviewerComment": "{ApproverComment}",
        "handlingCharge": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "shippingCharge": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "orderTotal": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "orderTax": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "orderWeight": {Weight},
        "orderParts": [
            {
                "id": "{ShipmentID}",
                "orderId": "{OrderID}",
                "documentIdList": [
                    "{ItemID}"
                ],
                "shippingAddress": {
                    "{AddressFieldName}": "{AddressFieldValue}",
                    "{AddressFieldName}": "{AddressFieldValue}"
                }
            }
        ],
        "documentIdList": [
            "{ItemID}"
        ],
        "CustomShippingFields": [
            {
                "Name": "{ShippingFieldName}",
                "Value": "{ShipmentValue}"
            },
            {
                "Name": "{ShippingFieldName}",
                "Value": "{ShipmentValue}"
            }
        ]
    }
]
Response 404 - Not Found: No orders were found matching the criteria.

GET {DeploymentURL}/restapi/orders/{OrderID}/payment_fields

This call returns an array of CustomField objects that correspond to the payment fields of the relevant order. Fields without field definitions (ad-hoc fields) and secure fields are not returned. This call does not support split payment.

Response 200 - OK:
[
        {
                "Name": "{PaymentFieldName}",
                "Value": "{PaymentFieldValue}"
        },
        {
                "Name": "{PaymentFieldName}",
                "Value": "{PaymentFieldValue}"
        }
]
Response 400 - Bad Request: Invalid request.
Response 404 - Not Found: Order or its payment fields not found.

PATCH {DeploymentURL}/restapi/orders/{OrderID}/approve

This call attempts to approve the order. If there are multiple approval workflows, all of these are approved in the single API call. Every ordered document that is subject to approval requires the approval action input structure that contains the Approve and Comment properties.

Request:
{
    "Actions": [
        {
            "OrderItemId": "{DocumentID}",
            "Approve": {false/true},
            "Comment": "{Comment}"
        },
        {
            "OrderItemId": "{DocumentID}",
            "Approve": {false/true},
            "Comment": "{Comment}"
        }
    ]
}

400 Bad request - approval not needed.
400 Bad request - invalid input data.
404 Order not found.
409 Cannot be approved now, try again later.
504 Multiple attempts to update approval status failed.

The '409' response is returned when the order was placed very recently (typically before less than 1 second) and the approval steps have not been fully constructed yet.
The '504' response is used typically when there too many approval steps (tiers) and the call could not finish successfully in a timely manner.

Items (Ordered Documents)

GET {DeploymentURL}/restapi/items?from={yyyy-MM-dd}&to={yyyy-MM-dd}

GET {DeploymentURL}/restapi/items?from={yyyy-MM-ddTHH:mm}&to={yyyy-MM-ddTHH:mm}

GET {DeploymentURL}/restapi/items?id={DocumentID},{DocumentID},...

This call returns the list of all ordered documents whose status changed between the specified dates. For date and time based calls if the hours and minutes are omitted, the call uses '23:59:59' for the 'to' input parameter (to include all records from the relevant day). This list can alternatively be filtered by specifying a comma-separated list of document IDs. For enumerated values see Enumerations.

Response 200 - OK:
[
    {
        "OrderItemId": "{DocumentID}",
        "ExternalId": "{ExternalDocumentID}",
        "OrderId": "{OrderID}",
        "ProductId": "{ProductID}",
        "Description": "{Description}",
        "Quantity": {Quantity},
        "Price": {
            "unit": "{CurrencyUnit}",
            "amount": {Price}
        },
	"RawPrice": {
            "unit": "{CurrencyUnit}",
            "amount": {Price}
        },
        "Status": {OrderItemStatus},
        "CustomFormFillFields": [
            {
                "Name": "{FormFillingFieldName}",
                "Value": "{FormFillingFieldValue}"
            },
            {
                "Name": "{FormFillingFieldName}",
                "Value": "{FormFillingFieldValue}"
            },
            {
                "Name": "{FormFillingFieldName}",
                "Value": "{FormFillingFieldValue}"
            }
        ],
        "CustomPrintingFields": [
        		{
                "Name": "{PrintingOptionsFieldName}",
                "Value": "{PrintingOptionsFieldValue}"
            },
        		{
                "Name": "{PrintingOptionsFieldName}",
                "Value": "{PrintingOptionsFieldValue}"
            },
        		{
                "Name": "{PrintingOptionsFieldName}",
                "Value": "{PrintingOptionsFieldValue}"
            }
        ]
    },
    {
        "OrderItemId": "{DocumentID}",
        "ExternalId": "{ExternalDocumentID}",
        "OrderId": "{OrderID}",
        "ProductId": "{ProductID}",
        "Description": "{Description}",
        "Quantity": {Quantity},
        "Price": {
            "unit": {CurrencyUnit},
            "amount": {Price}
        },
        "Status": {OrderItemStatus},
        "CustomFormFillFields": [
            {
                "Name": "{FormFillingFieldName}",
                "Value": "{FormFillingFieldValue}"
            },
            {
                "Name": "{FormFillingFieldName}",
                "Value": "{FormFillingFieldValue}"
            },
            {
                "Name": "{FormFillingFieldName}",
                "Value": "{FormFillingFieldValue}"
            }
        ],
        "CustomPrintingFields": [
        		{
                "Name": "{PrintingOptionsFieldName}",
                "Value": "{PrintingOptionsFieldValue}"
            },
        		{
                "Name": "{PrintingOptionsFieldName}",
                "Value": "{PrintingOptionsFieldValue}"
            },
        		{
                "Name": "{PrintingOptionsFieldName}",
                "Value": "{PrintingOptionsFieldValue}"
            }
        ]
    }
]
Response 404 - Not Found: No items were found matching the criteria.

PATCH {DeploymentURL}/restapi/items?id={DocumentID},{DocumentID},...

This call updates the Order Item Status value for the ordered documents that match the filtering criteria (comma separated list of IDs). Only the 'Shipped', 'Packed', 'Printed' or 'Rejected' statuses are allowed in this call. For enumerated values see Enumerations.

Request:
{ "Status" : {OrderItemStatus} }

Response 200 - OK: The operation completed successfully for at least one item.
Response 404 - Not Found: No items were found matching the criteria.

GET {DeploymentURL}/restapi/items/{DocumentID}/output_path

This call retrieves the rendered output paths and the creation date and time of each output file of an ordered item. Multiple output files can be generated for some product types like data merge products and kit products.

Response 200 - OK:
[
        {
            "Path": "{OutputPath1}",
            "Created": "{yyyy-MM-dd}T{HH:mm:ss}"
        },
        {
            "Path": "{OutputPath2}",
            "Created": "{yyyy-MM-dd}T{HH:mm:ss}"
        }
]

Response 400 – Bad Request: Incorrect input parameters.
Response 404 - Not Found: Document or output path(s) not found.

Settings

GET {DeploymentURL}/restapi/settings

This call returns the list of global settings of the site.
Response 200 - OK:
{
    "TaxInclusivePricing": {Value}
}