Documents
Searching for Documents
Link: https://au.itwocx.com/api/latest/api/help/index#!/Document/Document_Search
With this interface you can pass criteria to return a matching list of document ids.
Supported Criteria
Criteria | Example | Note(s) |
---|---|---|
cx_scope | ALL | Means return any matching result the current user can access |
cx_regtype | DEF,GEN,RFI | A single entry or comma separated list of form types to search against |
cx_projects | PSDEMO,DFDEMO | A single entry or comma separated list of projects to search against |
cx_status | FOR REVIEW | A single entry or comma separated list of form statuses to search against |
cx_timestamp | 637053676201363162 | Only return results which have been modified after this. (C# = DateTime.Now.Ticks) |
cx_reference | DEF#0170 | Only return results which match this reference. |
cx_text | Example Text | Text Contains: Example Text |
usr_{code} | "USR_LOC": "/Z2/A02" | Only return results which match this user field value. In this example a select user field option code. |
Max Number limits the number of results. 0 means no limit.
Example filter
{ "CriterionList": { "cx_scope": "ALL", "cx_regtype": "DEF,GEN,RFI", "cx_projects": "PSDEMO,DFDEMO", "cx_status": "FOR REVIEW", "cx_timestamp": 637053676201363162, "cx_reference": "DEF#0170", "usr_loc": "/Z2/A02" }, "MaxNumber": 0 }
Retrieving Document Details
Link: https://au.itwocx.com/api/24.08/api/help/index#!/Document/Document_GetById
By passing in a document id, potentially from a search result, you will get all the details of that document.
This can also be done in bulk by passing in a list of Ids:
https://au.itwocx.com/api/24.08/api/help/index#!/Document/Document_GetByIds
Creating a Document
Link: https://au.itwocx.com/api/24.08/api/help/index#!/Document/Document_Create
Properties
Property | Required | Example | Note(s) |
---|---|---|---|
DocCode | Yes | DEF | User needs to have permission to create forms of this type from. |
StatusName | Yes | FOR REVIEW | As per Configure → Document Types → Form (e.g. DEF) → Status |
Title | Yes | Example Title | |
ActionCodes | No | ["MC-MC"] | An array of user codes. If blank will be the current user |
InfoCodes | No | ["MC-PA","RIB-SS"] | An array of user codes. |
UserfieldValues | No | [{"UserfieldCode": "LOC", "Value": "/Z1/A01"}] | As per Configure → Document Types → Form (e.g. DEF) → User Fields If the type of field is one with configured options (e.g. Select, Radio, Checkbox etc.), the value should be the option code to be selected. |
Example Value
{ "DocCode": "DEF", "StatusName": "FOR REVIEW", "Title": "Example Defect", "ActionCodes": ["MC-MC"], "InfoCodes": ["MC-PA","RIB-SS"], "UserfieldValues": [ { "UserfieldCode": "LOC", "Value": "/Z1/A01" }, { "UserfieldCode": "CCISSU", "Value": "WORKM" }, { "UserfieldCode": "BBPOS", "Value": "/EST" } ] }
Upon completion and if successful, the result will include the generated Id, Reference number and a link to it.
Updating a Document
Link: https://au.itwocx.com/api/24.08/api/help/index#!/Document/Document_Update
You can pass in a simple model with just the Document.Id and the value(s) you wish to change.
Action User
{ "Id": 13295021, "ActionCodes": ["RIB-AM"] }
Info User(s)
{ "Id": 13295021, "InfoCodes": ["RIB-SS", "RIB-DF"] }
In iTWOcx, you cannot remove users from addressing. So any user who is already on the document will be automatically added back to this list.
Status
{ "Id": 13295021, "StatusName": "CLOSED" }
Title
Users with the appropriate permissions can now update a form title through the REST API using the Document/Update endpoint.
Userfield Value(s)
You can identify a userfield through either its Id, Code and optionally if they are used within a Table you can specify the name of the table, and the row of the value you wish to update.
{ "Id": 13295021, "UserfieldValues": [ { "UserfieldCode": "TEXT1", "Value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse luctus sodales enim, quis placerat nisi faucibus ac. Etiam ut orci id metus tempus pellentesque. Integer ex quam, tempor at dapibus et, viverra at enim. Aenean scelerisque, mi vel eleifend viverra, urna sapien mattis risus, ut tincidunt tortor eros sed diam. Nulla felis enim, bibendum nec dui eu, semper tincidunt magna. Morbi sem augue, tempor at egestas non, sollicitudin at turpis. Sed eget justo sapien. Nulla facilisi. Morbi eu magna eros. Morbi pellentesque justo ut nunc aliquet blandit. Nulla tempor pharetra orci, vitae convallis arcu semper euismod. Vestibulum tristique posuere aliquam. Nulla cursus magna ut urna scelerisque, vitae ullamcorper libero tincidunt. Phasellus sodales ligula vitae elit convallis, nec vulputate enim pulvinar. Donec non lacus ipsum. Nulla dapibus scelerisque dignissim." }, { "UserfieldCode": "SEL1", "Value": "A" }, { "UserfieldCode": "NUM", "Value": 123.45 }, { "TableName": "tblPCTB148", "RowIndex": 1, "UserfieldCode": "LNUM", "Value": 321.00 } ] }
Adding a Comment
{ "Id": 13295021, "Comments": [ { "Id": 0, "Comment": "Example Comment added through the API" } ] }
Example output
The following example is updating the Status, Action, Info and three user fields, as well as adding a comment.
{ "Id": 13295021, "ActionCodes": ["RIB-AM"], "InfoCodes": ["RIB-DF", "RIB-AM"], "StatusName": "CLOSED", "UserfieldValues": [ { "UserfieldCode": "NUM", "Value": 1234.68 }, { "TableName": "tblPCTB148", "RowIndex": 1, "UserfieldCode": "LNUM", "Value": 321.00 }, { "TableName": "tblPCTB148", "RowIndex": 2, "UserfieldCode": "LNUM", "Value": 456.00 } ], "Comments": [ { "Id": 0, "Comment": "Example API Comment" } ] }