Pharma-E Limited - Intact iQ API
Queue Management

The API operates a queuing system for updates. Depending on the configuration of the service in question, items that are received through the API via POST or PUT are either automatically processed through or queued up for manually processing on our side.

While an item is queued up for processing it is possible to query the current state of the update and also cancel it. Once an item is processed, either automatically or manually by an operator on our side it cannot be cancelled.

The queue is also useful when an new item received using a POST or an update via a PUT has failed validation or cannot be processed for some other reason. The response will have information about the reasons an item has not been processed and you can use the Queue service built into the API to cancel the entry and repost a valid item.

Imagine a call to the API to create these two customers...

[
	{ Code:'REST020', Name: 'Rest 1', Region: 'ENG', DefaultCurrency: 'STG' },
	{ Code:'REST021', Name: 'Rest 1', Region: 'ENGL', DefaultCurrency: 'ERU' }
]				
						

If these two customers already existed then you might receive a response that looked like this...

{
	"status": "Failed",
	"message": 
		"-= Item 0 of Type (Customer) =-
		Validation Failed...
		Code - This code is already in use.
		-= Item 1 of Type (Customer) =-
		Validation Failed...
		Code - This code is already in use.
		Region - This is a required value.
		DefaultCurrency - You must provide a valid value.",
	"queueEntryId": 86550037762988677,
	"items": []
}
					

This indicates that the first customer (index 0) uses a code that is already in use and for the second one the code is also already in use but the Region and DefaultCurrency property values sent in are not valid. The queue entry id is available in the response too which allows you to use the Queue service in the api to cancel and retry with new data. To achieve this you use the HTTP DELETE method like so..

curl -X DELETE "http://localhost:1024/QUEUE/86550037762988677" -H "Authorization : bearer ABC12MyKey" '

Now if you were to repost with valid data like...

[
	{ Code:'REST090', Name: 'Rest 1', Region: 'ENG', DefaultCurrency: 'STG' },
	{ Code:'REST091', Name: 'Rest 1', Region: 'ENG', DefaultCurrency: 'STG' }
]				
			

The response (if the codes are valid) might look like...

{
	"status": "Processed",
	"message": "Ok",
	"queueEntryId": 86550037762988679,
	"items": [
			{
					"id": 8594232236695,
					"typeName": "Customer",
					"info": "REST090"
			},
			{
					"id": 8594232236712,
					"typeName": "Customer",
					"info": "REST090"
			}
	]
	}
			

The items have been processed and the service will return the new IDs and some basic information about each new item.