iotoms Docs

Update a report template

PUT
/api/v1/reports/templates/{templateId}

Changes the name or layout of a document template. Active templates cannot be edited; create a new version instead.

How to use it

  1. Get the template ID from List report templates; it must not be the active version.
  2. Send reportType (required by validation but ignored), the name and, optionally, a new layoutJson; omitting layoutJson keeps the current layout. Unknown layout keys or columns are rejected.
  3. The document type does not change. Use Activate a report template to start using the edited version.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

templateId*integer

ID of the template version, from List report templates. It must not be the active version.

Formatint64

Request Body

application/json
  1. body
reportType*string

Document type: PURCHASE_ORDER, SALES_INVOICE, DAY_END_SUMMARY, ROUTE_SETTLEMENT, DELIVERY_NOTE, CREDIT_NOTE or SALES_QUOTATION. Required; ignored on update.

Value in"PURCHASE_ORDER""SALES_INVOICE""DAY_END_SUMMARY""ROUTE_SETTLEMENT""DELIVERY_NOTE""CREDIT_NOTE""SALES_QUOTATION"
name*string

Name of the template version. Required, not blank.

layoutJson?

Layout object. Allowed keys: theme, header, partyBlocks, lineItemColumns (array of column names valid for the type), footer.

sourceTemplateId?|

On create, ID of an existing template of the same type to copy the layout from when layoutJson is omitted.

Formatint64

Response Body

OK

*/*
  1. response
status*string

Outcome of the call: SUCCESS when the request worked, ERROR when it did not.

message*string

Short human-readable message describing the result, for logs or display; do not parse it.

data?

The report template version as it now stands.

Example Request
curl -X PUT 'https://beta.iotoms.com/api/v1/reports/templates/0' \  -H 'Content-Type: application/json' \  -d '{  "reportType": "PURCHASE_ORDER",  "name": "string"}'
Example Response
{  "status": "string",  "message": "string",  "data": {    "id": 0,    "reportType": "PURCHASE_ORDER",    "name": "string",    "layoutJson": "string",    "version": 0,    "isActive": true,    "isSystem": true,    "createdBy": "string",    "createdTime": "2019-08-24T14:15:22Z",    "modifiedTime": "2019-08-24T14:15:22Z",    "system": true,    "active": true  }}