Earlier I introduced you to the WorkXpress API. If you have not read it already you should do so before reading this post. Once you have a basic understanding of what it is and how it works, it’s time to start diving into the API.
This post will cover how to update existing Items in a WorkXpress application using the UpdateItem API function. UpdateItem allows you to set Fields, create Relationships and recycle and delete Items & Relationships. Like the other functions, you can make many UpdateItem requests in one call using data sets.
First, let’s get an understanding of how the request XML should be formed.
|/wxRequest||The root node for all request documents.|
Contains a single UpdateItem request. You may have as many data sets as
you would like.
|/wxRequest/dataSet/items||Root node for the items that should be retrieved.|
A single item to be updated. There is no limit to the number of item
nodes allowed in a data set.
|/wxRequest/dataSet/items/map||The root node for a map definition.|
|/wxRequest/dataSet/items/map/definition||The actual definition for a map. The map XML must have its HTML entities encoded.|
|/wxRequest/dataSet/fields||Root node for any fields that should be updated on the items that were found in the items node.|
A single field to update on the Item.
|/wxRequest/dataSet/fields/field/value||Value to set into the field.|
|/wxRequest/dataSet/relations||Root node for relations that should be added or updated with the current item.|
Defines a single relation to be added or updated. If the action is not
"add", the attributes will be used to look up an existing relation.
|/wxRequest/dataSet/relations/relation/fields||Root node for the fields that should be set on the relationship.|
A single field to be set on the relationship.
|/wxRequest/dataSet/relations/relation/fields/field/value||Value to set into the field.|
Now let’s get an understanding of how the response XML will be formed.
|/wxResponse||The root node for all response documents.|
The status of the SOAP call as it was processed by WorkXpress.
|/wxResponse/compatibilityLevel||The version of the API that was used to process the request.|
One data set is returned for each data set in the request document.
Defines an item that was updated. One item node is returned for each
item that was updated by WorkXpress.
Defines a relationship that was added or updated. Returns one relation
node for each relationship from the item that was added or updated by
Below is an example of a basic UpdateItem request document:
Below is the corresponding response document for the above example:
If you have any questions or would like assistance making some UpdateItem requests of your own, please feel free to comment below. My next post will be on how to use the ExecuteAction request.