Overview
Firstly, the various Spira APIs is documented at this URL: http://api.inflectra.com/Spira/Services/
Spira offers many different API versions and types:
In this article, we'll be focusing on the REST API, and we normally recommend that you use the latest version of the API available, in this case v6.0.
If you click on the Documentation link for the v6.0 REST API you will see the list of resources and methods:
Each of the resources will generally describe one or more method:
- GET - methods for retrieving data
- POST - methods for creating new items
- (also used for other non-CRUD methods such as advanced searches)
- PUT - methods for updating existing items
- DELETE - methods for deleting items
In this article we'll be focusing on how you can GET an item and then make an update using PUT.
The Spira Concurrency Model
Spira works on the principle of optimistic concurrency so that each change made in Spira updates a special field called ConcurrencyDate. This is effectively the version number of the item being updated. Spira versions the entire record, so if you are going to update a Task (for example), you cannot just simply update a couple of the fields in isolation, you need to first get the latest version of the task object, make the changes to the values, and then send back the entire object.
Graphically this looks like:
So each time you want to make an update, you need to do a fresh GET of the object, followed by a PUT back of the data with the same concurrency date and the various updated fields.