Inventory API Operations - Examples Of Use
- Mike Sheen
- Scott Pearce
Products
Get a filtered list of products
Using v_Jiwa_Inventory_Item_ListQuery
A view, v_Jiwa_Inventory_Item_List is provided with a corresponding query class v_Jiwa_Inventory_Item_ListQuery to facilitate retrieving a filtered, paginated list of products. The data returned includes the PartNo, Description, Picture, Categories, Sell price, RRP and stock levels.
Which fields are returned can be limited with the Fields property - so only the required fields are returned.
With the Include property set to "Total" the response will include the total count of records matching the query - this is useful for pagination. The Skip and Take properties can be added specify the starting record number to return and the number of records to return.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var itemListRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.v_Jiwa_Inventory_Item_ListQuery() { PhysicalWarehouseDescription = "New South Wales", LogicalWarehouseDescription = "Main", LastSavedDateTimeGreaterThan = DateTime.Now.AddDays(-1), Fields = "PartNo, Description, Picture, AvailableStock, SellPrice", Include = "Total" }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.v_Jiwa_Inventory_Item_List> itemListResponse = client.Get(itemListRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/InventoryItemList?PhysicalWarehouseDescription=New South Wales&LogicalWarehouseDescription=Main&LastSavedDateTimeGreaterThan=2017-09-18T00:00:00.000&Fields=PartNo,Description,Picture,AvailableStock,SellPrice&Include=Total"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/InventoryItemList?PhysicalWarehouseDescription=New%20South%20Wales&LogicalWarehouseDescription=Main&LastSavedDateTimeGreaterThan=2017-09-18T00:00:00.000&Fields=PartNo,Description,Picture,AvailableStock,SellPrice&Include=Total
Instead of using URL parameters as above, you can also use a DTO to set the parameters:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/InventoryItemList -d '{"PhysicalWarehouseDescription":"New South Wales", "LogicalWarehouseDescription":"Main","LastSavedDateTimeGreaterThan="2017-09-18T00:00:00.000", "Fields":"PartNo, Description, Picture, AvailableStock, SellPrice", "Include":"Total"}'
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/InventoryItemList?PhysicalWarehouseDescription=New%20South%20Wales&LogicalWarehouseDescription=Main&LastSavedDateTimeGreaterThan=2017-09-18T00:00:00.000&Fields=PartNo,Description,Picture,AvailableStock,SellPrice&Include=Total&format=json
Note the &format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
Using IN_MainQuery
An alternative to using the v_Jiwa_Inventory_Item_ListQuery is to simply use the IN_MainQuery.
All tables have a corresponding Query class. For example, the table IN_Main has a class IN_MainQuery. The IN_MainQuery class is the DTO used for query operations against the IN_Main table. By setting various properties of an instance of this class, a filtered, ordered set of results can be obtained.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var IN_MainQueryRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_MainQuery() { PartNoStartsWith = "a", OrderBy = "PartNo", Take = 25 }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_Main> IN_MainQueryResponse = client.Get(IN_MainQueryRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/IN_Main?PartNoStartsWith=a&OrderBy=PartNo&Take=25"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/IN_Main -d '{"PartNoStartsWith":"a","OrderBy":"PartNo","Take":"25"}'
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/IN_Main?PartNoStartsWith=a&OrderBy=PartNo&Take=25&format=json
Note the &format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var IN_MainQueryRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_MainQuery() { PartNoStartsWith = "a", OrderBy = "PartNo", Take = 25, Fields = "InventoryID,PartNo,Description,Picture" }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_Main> IN_MainQueryResponse = client.Get(IN_MainQueryRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/IN_Main?PartNoStartsWith=a&OrderBy=PartNo&Take=25&Fields=InventoryID,PartNo,Description,Picture"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/IN_Main -d '{"PartNoStartsWith":"a","OrderBy":"PartNo","Take":"25","Fields":"InventoryID,PartNo,Description,Picture"}'
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/IN_Main?PartNoStartsWith=a&OrderBy=PartNo&Take=25&Fields=InventoryID,PartNo,Description,Picture&format=json
Note the &format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var IN_MainQueryRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_MainQuery() { PartNoStartsWith = "a", OrderBy = "PartNo", Take = 25, Skip = 25, Fields = "InventoryID,PartNo,Description,Picture" }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_Main> IN_MainQueryResponse = client.Get(IN_MainQueryRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/IN_Main?PartNoStartsWith=a&OrderBy=PartNo&Take=25&Skip=25&Fields=InventoryID,PartNo,Description,Picture"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/IN_Main -d '{"PartNoStartsWith":"a","OrderBy":"PartNo","Take":"25","Skip":"25","Fields":"InventoryID,PartNo,Description,Picture"}'
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/IN_Main?PartNoStartsWith=a&OrderBy=PartNo&Take=25&Skip=25&Fields=InventoryID,PartNo,Description,Picture&format=json
Note the &format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
Read a product
In order to read a product, the InventoryID must be provided. Note this is a full read of the inventory business logic - so it will include associated elements such as notes, documents, prices and so on.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryGETRequest() { InventoryID = "000000000K00000000BQ" }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryItem inventoryItem = client.Get(inventoryGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing the full inventory item DTO model from the business logic - see the meta data page for the InventoryGETRequest for more detail.
Create a new product
You don't need to provide anything to create a product - a PartNo and InventoryID will be generated for you - however it's usual practice to provide a PartNo. All other fields can be provided, but are not mandatory. The response DTO will contain the generated InventoryID, and all other fields of the product.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryPOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryPOSTRequest { PartNo = "NewPartNo", Description = "A new product", DefaultPrice = 10.50M, Picture = Convert.FromBase64String("R0lGODlhPQBE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rnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==") }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryItem inventoryItem = client.Post(inventoryPOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { PartNo = "NewPartNo", Description = "A new product", DefaultPrice = 10.50, Picture = Convert.FromBase64String("R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKl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FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==") }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory -d '{"PartNo":"NewPartNo","Description":"A new product","DefaultPrice":10.50,"FileBinary":"iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAIAAAAyxktbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTM0A1t6AAAG60lEQVRIS5WWh1NUVxTG948w0djHiRUsIMZKJpKJGY2IsCygixSpIgtLILARAbEhsKi7i6AI0jJjQSQIqIAC0gMoIlItYIEFFVASo2DLb3kbZJzUM8ybu+/d+51zvvOdcxG9/3t79+7d27dv37x58/r161evXv02Yr+P2LNnz548eaLVah89etTV1cUe/Zkx9jE0mx48eJCbmxcdrQwJCfHz83NxcZNIbGxtbe3sNjk4OHh4ePBSofgRU4y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lBIRUXF8+fPKYl0szTwh8DPZ8ymFREo+svLy6OxcaZrmYRjCc3NLRp1rLVYIhHbksd8wwXr1683X2++erWZtbW1ufkGdJaSksKB3bv3VFZWIYOkpBPzDReuWL7y/PnzOEBtQIGuUqljY2OJWAednJzc1tamVqlnzZxjaGBYWFjIeYRRVlrmtW07rQ8JgFK6vr5+tUrztdk3c+cY8FSpVOwMDg4uLy8HByNRNzd3YQTqoJEhsy3h2PHPxk+e8OmkaVNnTJ86Y9EiI2KfO9tg2dJlCxcYGRktNjYynjfH0NBgofFCk7KycjxBrpmZWWpqKmoBZ2ho2NnRhbGlcyJAC5LKyvp5xXLT8eMmTZwwhT/cCM/JE6dNHD+Vp8zbp6CgsK2tnWZDqYQWeSAqOjpamDYY1fPx8RkVqw76xIkTVOnmzZvr1n0nk/msW7sueMdOsZXkQESUifGStLS0ivIKsVgMM2zmJLfPuXNZaODIkSOjuOjVXmpPiMJPTM810wPiuWK4ljw9txUVFeOffAMDgxAPn7y2eSOsjo7O4qLirc6uNjZ2aJlGQ6mQiRy51Wg9AVQwPSHCzUaO+fkFvr5yqVS6auWXDlscJRJJQEAA/iiadLM9g5TxT36MfEYKgwkV0krsZJYKjI+aDvro0aPcHcw2pEoI7BCo1Gq5bloRDy0jzGU6kBldW1vHPOALuLTb/v37YUOAG2sigCIiIpA6I4LW4DLt6OhApKwRL2fQE9AjV+3dy5cvczUTb8ONhhhljKurK55Gr5WPTAftJ/dDsPQrVzhTm/CJEYooAGVhCuflXcjNze3svA/7FDwuLs7ZyZkgyEMP81emIyQuLv5sxlkWVJ8rAx+cwQETDh/A8R7DGVLjvxHaj5cjx//JdNCkv9XZ5fTp03A9thQIAzhopesk1rY2NjZH449Bnf7zv5kOGuMAOrG0tPL2lnFrMFX27dvPHYoxySgm1AsD9r+bHlowokZP/AdCoRApXMOD/tv/tffv/wAyAr/0hHrPvgAAAABJRU5ErkJggg=="}'
The response returned from the above request will be a json document representing the full inventory item DTO model from the business logic - see the meta data page for the InventoryPOSTRequest for more detail.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryPOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryPOSTRequest { PartNo = "NewPartNo", Description = "A new product", DefaultPrice = 10.50M }; inventoryPOSTRequest.Notes.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.Notes.Note() { NoteText = "Note text 1" }); inventoryPOSTRequest.Notes.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.Notes.Note() { NoteText = "Note text 2" }); JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryItem inventoryItem = client.Post(inventoryPOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { PartNo = "NewPartNo", Description = "A new product", DefaultPrice = 10.50, Notes = new List<object>() { new { NoteText = "Note text 1" }, new { NoteText = "Note text 2" } } }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory -d '{"PartNo":"NewPartNo","Description":"A new product","DefaultPrice":10.50,"Notes":[{"NoteText":"Note text 1"}, {"NoteText":"NoteText 2"}]}'
The response returned from the above request will be a json document representing the full inventory item DTO model from the business logic - see the meta data page for the InventoryPOSTRequest for more detail.
Update an existing product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryPATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryPATCHRequest { InventoryID = "000000000K00000000BQ", Description = "A new description", Picture = Convert.FromBase64String("R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ8aB/f39Wsl+LFt8dgU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oKQwswGijBV4C6SiTUmpphMspJx9unX4KaimjDv9aaXOEBteBqmuuxgEHoLX6Kqx+yXqqBANsgCtit4FWQAEkrNbpq7HSOmtwag5w57GrmlJBASEU18ADjUYb3ADTinIttsgSB1oJFfA63bduimuqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==") }; inventoryPATCHRequest.Notes.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.Notes.Note() { NoteText = "A new note added" }); inventoryPATCHRequest.Notes.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.Notes.Note() { NoteID = "cb39806c-1b52-411b-a3ba-e16b6281ea63", NoteText = "A modified note text" }); JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryItem inventoryItem = client.Patch(inventoryPATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Description = "A new description", Picture = Convert.FromBase64String("R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ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KX5RQGOZowxaZwYA+JaoKQwswGijBV4C6SiTUmpphMspJx9unX4KaimjDv9aaXOEBteBqmuuxgEHoLX6Kqx+yXqqBANsgCtit4FWQAEkrNbpq7HSOmtwag5w57GrmlJBASEU18ADjUYb3ADTinIttsgSB1oJFfA63bduimuqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=="), Notes = new List<object>() { new { NoteText = "A new note added" }, new { NoteID = "cb39806c-1b52-411b-a3ba-e16b6281ea63", NoteText = "A modified note text" } } }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ -d '{"Description":"A new description","Notes":[{"NoteText":"A new note added"},{"NoteID":"cb39806c-1b52-411b-a3ba-e16b6281ea63","NoteText":"A modified note text"}]}'
The response returned from the above request will be a json document representing the full inventory item DTO model from the business logic - see the meta data page for the InventoryPOSTRequest for more detail.
Delete a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDELETERequest{ InventoryID = "000000000K00000000BQ" }; client.Delete(inventoryDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ", "DELETE", ""); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/000000000K00000000BQ
Stock Levels
The stock levels are contained in the DTO response returned when you Read A Product. The WarehouseSOHs property is a list of WarehouseSOH records for each warehouse, containing the stock level information.
Another method available is the v_Jiwa_Inventory_Item_ListQuery as described previously - this returns a filtered list of products, including stock levels.
Alternatively, you can use the Autoquery for the IN_WarehouseSOH table to retrieve a filtered list, returning a row per product per warehouse:
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var IN_WarehouseSOHQueryRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_WarehouseSOHQuery() { InventoryIDIn = new string[] { "000000000K00000000BQ", "000000000K00000000BV", "000000000K00000000C5" }, IN_LogicalID = "ZZZZZZZZZZ0000000000" }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_WarehouseSOH> IN_WarehouseSOHQueryResponse = client.Get(IN_WarehouseSOHQueryRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/IN_WarehouseSOH?InventoryIDIn=000000000K00000000BQ,000000000K00000000BV,000000000K00000000C5&IN_LogicalID=ZZZZZZZZZZ0000000000"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/IN_WarehouseSOH -d '{"InventoryIDIn": [ "000000000K00000000BQ", "000000000K00000000BV", "000000000K00000000C5"], "IN_LogicalID":"ZZZZZZZZZZ0000000000" }'
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/IN_WarehouseSOH?InventoryIDIn=000000000K00000000BQ,000000000K00000000BV,000000000K00000000C5&IN_LogicalID=ZZZZZZZZZZ0000000000&format=json
Note the &format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
Custom Fields
Whilst custom fields can be retrieved, or modified as part of the normal inventory item GET, POST and PATCH operations, you can also use the following requests.
Get a list of Inventory Custom Fields
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCustomFieldsGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCustomFieldsGETManyRequest(); var InventoryCustomFieldsGETManyResponse = client.Get(InventoryCustomFieldsGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/CustomFields"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/CustomFields
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/CustomFields?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing the a list of the DTO model for a custom field - see the meta data page for the InventoryCustomFieldsGETManyRequest for more detail.
Get a list of custom field values for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCustomFieldsGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCustomFieldValuesGETManyRequest() { InventoryID = "000000000K00000000BQ" }; var InventoryCustomFieldsGETManyResponse = client.Get(InventoryCustomFieldsGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a list of the Custom Field Value DTO model - see the meta data page for the InventoryCustomFieldValuesGETManyRequest for more detail.
Get a custom field value for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCustomFieldValueGETRequest= new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCustomFieldValueGETRequest() { InventoryID = "000000000K00000000BQ", SettingID = "b450e24b-0b83-4650-b812-311f26dfeeb2" }; var InventoryCustomFieldValueGETResponse= client.Get(InventoryCustomFieldValueGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues/b450e24b-0b83-4650-b812-311f26dfeeb2"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues/b450e24b-0b83-4650-b812-311f26dfeeb2
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues/b450e24b-0b83-4650-b812-311f26dfeeb2?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing the Custom Field Value DTO model - see the meta data page for the InventoryCustomFieldValueGETRequest for more detail.
Update a custom field value for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCustomFieldValuePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCustomFieldValuePATCHRequest() { InventoryID = "000000000K00000000BQ", SettingID = "b450e24b-0b83-4650-b812-311f26dfeeb2", Contents = "New Contents" }; var InventoryCustomFieldValuePATCHResponse = client.Patch(InventoryCustomFieldValuePATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Contents = "New Contents" }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues/b450e24b-0b83-4650-b812-311f26dfeeb2", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/CustomFieldValues/b450e24b-0b83-4650-b812-311f26dfeeb2 -d '{"Contents":"New Contents"}'
The response returned from the above request will be a json document representing the full inventory item DTO model from the business logic - see the meta data page for the InventoryPOSTRequest for more detail.
Prices
Price Query
Retrieve a price for a product, given the InventoryID, DebtorID, WarehouseID, date and quantity. This uses the Jiwa pricing business logic to determine the price based on the Price Scheme associated with the Debtor, and all prices involved in that price scheme.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryPriceGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryPriceGETRequest { InventoryID = "000000000K00000000BQ", DebtorID = "0000000061000000001V", IN_LogicalID = "ZZZZZZZZZZ0000000000", Date = DateTime.Now, Quantity = 6 }; var InventoryPriceGETResponse = client.Get(InventoryPriceGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Pricing/0000000061000000001V/ZZZZZZZZZZ0000000000/2017-09-14/6"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Pricing/0000000061000000001V/ZZZZZZZZZZ0000000000/2017-09-14/6
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Pricing/0000000061000000001V/ZZZZZZZZZZ0000000000/2017-09-14/6?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing the DTO model from the business logic - see the meta data page for the InventoryPriceGETRequest for more detail.
Debtor Specific Prices
Get all debtor specific prices for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorSpecificPricesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorSpecificPricesGETManyRequest { InventoryID = "000000000K00000000BQ" }; List<JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPrice> inventoryDebtorPrices = client.Get(InventoryDebtorSpecificPricesGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a list of the inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorSpecificPricesGETManyRequest for more detail.
Get a single debtor specific price for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorSpecificPriceGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorSpecificPriceGETRequest { InventoryID = "000000000K00000000BQ", DebtorSpecificPriceID = "0000000011000000000Z" }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPrice inventoryDebtorPrice = client.Get(InventoryDebtorSpecificPriceGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/0000000011000000000Z"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/0000000011000000000Z
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/0000000011000000000Z?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a inventory debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorSpecificPriceGETRequest for more detail.
Add a new debtor specific price for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorSpecificPricePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorSpecificPricePOSTRequest { InventoryID = "000000000K00000000BQ", DebtorID = "0000000061000000001V", Mode = JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPrice.PriceModes.None, Amount = 150.00M, UseQuantityPriceBreak= true, QuantityPriceBreak = 15, StartDate = DateTime.Now }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPrice inventoryDebtorPrice = client.Post(InventoryDebtorSpecificPricePOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { DebtorID = "0000000061000000001V", Mode = 2, Amount = 150.00M, UseQuantityPriceBreak = true, QuantityPriceBreak = 15, StartDate = DateTime.Now }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices -d '{"InventoryID ":"000000000K00000000BQ", "DebtorID":"0000000061000000001V", "OPMode":2, "Amount":150, "UseQuantityPriceBreak":"true", "QuantityPriceBreak":15, "StartDate":"2017-09-15" }'
The response returned from the above request will be a json document representing a inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorSpecificPricePOSTRequest for more detail.
Update an existing debtor specific price
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorSpecificPricePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorSpecificPricePATCHRequest { InventoryID = "000000000K00000000BQ", DebtorSpecificPriceID = "3791217a18204bcb8813", Amount = 160.50M }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPrice inventoryDebtorPrice = client.Patch(InventoryDebtorSpecificPricePATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Amount = 160.50M }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/3791217a18204bcb8813", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/3791217a18204bcb8813 -d '{"Amount":160.50}'
The response returned from the above request will be a json document representing a inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorSpecificPricePATCHRequest for more detail.
Delete a debtor specific price
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorSpecificPriceDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorSpecificPriceDELETERequest { InventoryID = "000000000K00000000BQ", DebtorSpecificPriceID = "3791217a18204bcb8813" }; client.Delete(InventoryDebtorSpecificPriceDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/3791217a18204bcb8813", "DELETE", ""); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorSpecificPrices/3791217a18204bcb8813
Debtor Classification Prices
Get all debtor classification prices for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorClassificationPricesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorClassificationPricesGETManyRequest { InventoryID = "000000000K00000000BQ" }; List<JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorClassificationPrice> inventoryDebtorClassificationPrices = client.Get(InventoryDebtorClassificationPricesGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a list of the inventory item debtor classification price DTO model from the business logic - see the meta data page for the InventoryDebtorClassificationPricesGETManyRequest for more detail.
Get a single debtor classification price for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorClassificationPriceGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorClassificationPriceGETRequest { InventoryID = "000000000K00000000BQ", DebtorClassificationPriceID = "0000000011000000000X" }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorClassificationPrice inventoryDebtorClassificationPriceGETResponse = client.Get(InventoryDebtorClassificationPriceGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a inventory debtor classification price DTO model from the business logic - see the meta data page for the InventoryDebtorClassificationPriceGETRequest for more detail.
Add a new debtor classification price for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorClassificationPricePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorClassificationPricePOSTRequest { InventoryID = "000000000K00000000BQ", DebtorClassificationID = "00000000A8000000000C", Mode = JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorClassificationPrice.PriceModes.None, Amount = 200.00M, UseQuantityPriceBreak = true, QuantityPriceBreak = 15, StartDate = DateTime.Now }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorClassificationPrice inventoryDebtorClassificationPrice = client.Post(InventoryDebtorClassificationPricePOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { DebtorClassificationID = "00000000A8000000000C", Mode = 2, Amount = 200.00M, UseQuantityPriceBreak = true, QuantityPriceBreak = 15, StartDate = DateTime.Now }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices -d '{"InventoryID ":"000000000K00000000BQ", "DebtorClassificationID":"00000000A8000000000C", "OPMode":2, "Amount":200, "UseQuantityPriceBreak":"true", "QuantityPriceBreak":15, "StartDate":"2017-09-15" }'
The response returned from the above request will be a json document representing a inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorSpecificPricePOSTRequest for more detail.
Update an existing debtor classification price
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorClassificationPricePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorClassificationPricePATCHRequest { InventoryID = "000000000K00000000BQ", DebtorClassificationPriceID = "0000000011000000000X", Amount = 250.45M }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorClassificationPrice inventoryDebtorClassificationPrice = client.Patch(InventoryDebtorClassificationPricePATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Amount = 250.45M }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X-d '{"Amount":250.45}'
The response returned from the above request will be a json document representing a inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorSpecificPricePATCHRequest for more detail.
Delete a debtor classification price
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorClassificationPriceDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorClassificationPriceDELETERequest { InventoryID = "000000000K00000000BQ", DebtorClassificationPriceID = "0000000011000000000X"}; client.Delete(InventoryDebtorClassificationPriceDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X", "DELETE", ""); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorClassificationPrices/0000000011000000000X
Debtor Price Group Prices
Get all debtor price group prices for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorPriceGroupPricesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorPriceGroupPricesGETManyRequest { InventoryID = "000000000K00000000BQ" }; List<JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPriceGroupInventorySpecific> debtorGroupPrice = client.Get(InventoryDebtorPriceGroupPricesGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrice?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a list of the inventory item debtor classification price DTO model from the business logic - see the meta data page for the InventoryDebtorPriceGroupPricesGETManyRequest for more detail.
Get a single debtor price group price for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorPriceGroupPriceGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorPriceGroupPriceGETRequest { InventoryID = "000000000K00000000BQ", DebtorPriceGroupInventorySpecificID = "804a5fb1-e7ac-4759-94a3-04ed1938560e" }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPriceGroupInventorySpecific debtorGroupPrice = client.Get(InventoryDebtorPriceGroupPriceGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/804a5fb1-e7ac-4759-94a3-04ed1938560e"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/804a5fb1-e7ac-4759-94a3-04ed1938560e
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/804a5fb1-e7ac-4759-94a3-04ed1938560e?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a inventory debtor classification price DTO model from the business logic - see the meta data page for the InventoryDebtorClassificationPriceGETRequest for more detail.
Add a new debtor price group price for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorPriceGroupPricePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorPriceGroupPricePOSTRequest { InventoryID = "000000000K00000000BQ", DebtorPriceGroupID = "703AB465-604C-46B5-98A3-2D3F01E0CDE3", Mode = JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPriceGroupInventorySpecific.PriceModes.None, Amount = 11.23M, UseQuantityPriceBreak = true, QuantityPriceBreak = 21, StartDate = DateTime.Now }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPriceGroupInventorySpecific debtorGroupPrice = client.Post(InventoryDebtorPriceGroupPricePOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { DebtorPriceGroupID = "703AB465-604C-46B5-98A3-2D3F01E0CDE3", Mode = 2, Amount = 11.23M, UseQuantityPriceBreak = true, QuantityPriceBreak = 21, StartDate = DateTime.Now }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices -d '{"InventoryID ":"000000000K00000000BQ", "DebtorPriceGroupID":"703AB465-604C-46B5-98A3-2D3F01E0CDE3", "OPMode":2, "Amount":11.23, "UseQuantityPriceBreak":"true", "QuantityPriceBreak":21, "StartDate":"2017-09-15" }'
The response returned from the above request will be a json document representing a inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorPriceGroupPricePOSTRequest for more detail.
Update an existing debtor price group price
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorPriceGroupPricePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorPriceGroupPricePATCHRequest { InventoryID = "000000000K00000000BQ", DebtorPriceGroupInventorySpecificID = "07d602d8-0b4d-4ed3-b1a5-012945c76707", Amount = 15.99M }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventoryDebtorPriceGroupInventorySpecific debtorGroupPrice = client.Patch(InventoryDebtorPriceGroupPricePATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Amount = 15.99M }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/07d602d8-0b4d-4ed3-b1a5-012945c76707", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/07d602d8-0b4d-4ed3-b1a5-012945c76707 -d '{"Amount":15.99}'
The response returned from the above request will be a json document representing a inventory item debtor specific price DTO model from the business logic - see the meta data page for the InventoryDebtorPriceGroupPricePATCHRequest for more detail.
Delete a debtor price group price
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDebtorPriceGroupPriceDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDebtorPriceGroupPriceDELETERequest { InventoryID = "000000000K00000000BQ", DebtorPriceGroupInventorySpecificID = "07d602d8-0b4d-4ed3-b1a5-012945c76707"}; client.Delete(InventoryDebtorPriceGroupPriceDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/07d602d8-0b4d-4ed3-b1a5-012945c76707", "DELETE", ""); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/000000000K00000000BQ/DebtorPriceGroupPrices/07d602d8-0b4d-4ed3-b1a5-012945c76707
Quantity Break / Tier Pricing
Quantity break / tier pricing is achieved by the use of Debtor Classification Prices or Debtor Group Prices with a null classification or group (which signifies all classifications or any debtor groups), and with a quantity break set.
Selling Prices
Reading the Selling Prices for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventorySellingPriceGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventorySellingPriceGETRequest { InventoryID = "000000000K00000000BQ"}; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventorySellingPrices sellPrices = client.Get(InventorySellingPriceGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/SellingPrices"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/SellingPrices
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/SellingPrices?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a inventory selling prices DTO model from the business logic - see the meta data page for the InventorySellingPriceGETRequest for more detail.
Updating the Selling Prices for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventorySellingPricePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventorySellingPricePATCHRequest { InventoryID = "000000000K00000000BQ", CurrentPriceDate = DateTime.Now, ForwardPriceDate = DateTime.Now.AddDays(30) }; InventorySellingPricePATCHRequest.SellPrices.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventorySellingPrice { SellingPriceID = "P1", Price = 10.55M, ForwardPrice = 11.55M }); JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.InventorySellingPrices sellPrices = client.Patch(InventorySellingPricePATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { CurrentPriceDate = DateTime.Now, ForwardPriceDate = DateTime.Now.AddDays(30), SellPrices = new[] { new { SellingPriceID = "P1", Price = 10.55M, ForwardPrice = 11.55M } } }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/SellingPrices", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/SellingPrices -d '{"CurrentPriceDate":"2017-09-18","ForwardPriceDate":"2017-10-18","SellingPrices":[{"SellingPriceID":"P1","Price":10.55,"ForwardPrice":11.55}]}'
The response returned from the above request will be a json document representing a inventory item selling price DTO model from the business logic - see the meta data page for the InventorySellingPricePATCHRequest for more detail.
Notes
Get all notes for a product
While you could always use the IN_NotesQuery class to return all notes with a given InventoryID - There is also a GET method for retrieving all notes for a given InventoryID.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryNotesGETManyRequest= new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryNotesGETManyRequest() { InventoryID = "000000000K00000000BQ" }; var inventoryNotesGETManyResponse = client.Get(inventoryNotesGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a list of the inventory item note DTO model from the business logic - see the meta data page for the InventoryNotesGETManyRequest for more detail.
Get a specific note for a product
With a provided InventoryID, and a NoteID a single note can be retrieved.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryNotesGETRequest= new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryNotesGETRequest() { InventoryID = "000000000K00000000BQ", NoteID = "8F25C1BF-532A-4304-A44F-078AC5D1C54E" }; var inventoryNotesGETResponse= client.Get(inventoryNotesGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a inventory item note DTO model from the business logic - see the meta data page for the InventoryNoteGETRequest for more detail.
Add a new note
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryNotePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryNotePOSTRequest() { InventoryID = "000000000K00000000BQ", NoteText = "This is a new note" }; var inventoryNotesPOSTResponse = client.Post(inventoryNotePOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { NoteText = "This is a new note" }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes -d '{"NoteText":"This is a new note"}'
The response returned from the above request will be a json document representing a inventory item note DTO model from the business logic - see the meta data page for the InventoryNotePOSTRequest for more detail.
Update an existing note
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryNotePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryNotePATCHRequest() { InventoryID = "000000000K00000000BQ", NoteID = "8F25C1BF-532A-4304-A44F-078AC5D1C54E", NoteText = "This is an updated note" }; var inventoryNotesPOSTResponse = client.Patch(inventoryNotePOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { NoteText = "This is an updated note" }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E -d '{"NoteText":"This is an updated note"}'
The response returned from the above request will be a json document representing a inventory item note DTO model from the business logic - see the meta data page for the InventoryNotePATCHRequest for more detail.
Delete a note for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryNoteDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryNoteDELETERequest() { InventoryID = "000000000K00000000BQ", NoteID = "8F25C1BF-532A-4304-A44F-078AC5D1C54E" }; var client.Delete(inventoryNoteDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E", "DELETE", ""); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Notes/8F25C1BF-532A-4304-A44F-078AC5D1C54E
Documents
Get all documents for a product
While you could always use the IN_DocumentsQuery class to return all documents with a given InventoryID - There is also a GET method for retrieving all documents for a given InventoryID.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryDocumentsGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDocumentsGETManyRequest() { InventoryID = "000000000K00000000BQ" }; var inventoryDocumentsGETManyResponse = client.Get(InventoryDocumentsGETManyRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a list of the inventory item document DTO model from the business logic - see the meta data page for the InventoryDocumentsGETManyRequest for more detail.
Get a specific document for a product
With a provided InventoryID, and a DocumentID a single document can be retrieved.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryDocumentGETRequest= new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDocumentGETRequest() { InventoryID = "000000000K00000000BQ", DocumentID = "87E73C5A-896C-4EF2-8323-3DFCA0C2B042" }; var inventoryDocumentGETResponse= client.Get(inventoryDocumentGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/87E73C5A-896C-4EF2-8323-3DFCA0C2B042"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/87E73C5A-896C-4EF2-8323-3DFCA0C2B042
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/87E73C5A-896C-4EF2-8323-3DFCA0C2B042?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing a inventory item document DTO model from the business logic - see the meta data page for the InventoryDocumentGETRequest for more detail.
Add a new document
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryDocumentPOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDocumentPOSTRequest() { InventoryID = "000000000K00000000BQ", Description = "A new document", PhysicalFileName = "Test.png", FileBinary = Convert.FromBase64String("R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGR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oICbTcIJGQAZcNmdmUc210hs35nCyJ58fgmIKX5RQGOZowxaZwYA+JaoKQwswGijBV4C6SiTUmpphMspJx9unX4KaimjDv9aaXOEBteBqmuuxgEHoLX6Kqx+yXqqBANsgCtit4FWQAEkrNbpq7HSOmtwag5w57GrmlJBASEU18ADjUYb3ADTinIttsgSB1oJFfA63bduimuqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==") }; var inventoryDocumentPOSTResponse = client.Post(inventoryDocumentPOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { InventoryID = "000000000K00000000BQ", Description = "A new document", PhysicalFileName = "Test.png", FileBinary = Convert.FromBase64String("R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ8aB/f39Wsl+LFt8dgUE9PT5x5aHBwcP+AgP+WltdgYMyZfyywz78AAAAAAAD///8AAP9mZv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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mtwag5w57GrmlJBASEU18ADjUYb3ADTinIttsgSB1oJFfA63bduimuqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==") } ); responsebody = webClient.UploadString("http://localhost/Inventory/000000000K00000000BQ/Documents", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents -d '{"Description":"A new document", "PhysicalFileName":"Test.png", "FileBinary": "R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ8aB/f39Wsl+LFt8dgUE9PT5x5aHBwcP+AgP+WltdgYMyZfyywz78AAAAAAAD///8AAP9mZv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=="}'
The response returned from the above request will be a json document representing a inventory item document DTO model from the business logic - see the meta data page for the InventoryDocumentPOSTRequest for more detail.
Update an existing document
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryDocumentPATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDocumentPATCHRequest() { InventoryID = "000000000K00000000BQ", DocumentID = "3b15e611-d78c-49bb-8818-7eaa46fd2200", FileBinary = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAIAAAAyxktbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTM0A1t6AAAG60lEQVRIS5WWh1NUVxTG948w0djHiRUsIMZKJpKJGY2IsCygixSpIgtLILARAbEhsKi7i6AI0jJjQSQIqIAC0gM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449Bnf7zv5kOGuMAOrG0tPL2lnFrMFX27dvPHYoxySgm1AsD9r+bHlowokZP/AdCoRApXMOD/tv/tffv/wAyAr/0hHrPvgAAAABJRU5ErkJggg==") }; var inventoryDocumentPATCHResponse = client.Patch(inventoryDocumentPATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { FileBinary = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAIAAAAyxktbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTM0A1t6AAAG60lEQVRIS5WWh1NUVxTG948w0djHiRUsIMZKJpKJGY2IsCygixSpIgtLILARAbEhsKi7i6AI0jJjQSQIqIAC0gMoIlItYIEFFVASo2DLb3kbZJzUM8ybu+/d+51zvvOdcxG9/3t79+7d27dv37x58/r161evXv02Yr+P2LNnz548eaLVah89etTV1cUe/Zkx9jE0mx48eJCbmxcdrQwJCfHz83NxcZNIbGxtbe3sNjk4OHh4ePBSofgRU4yYXC4PClL09PToIf60D9DE2N7eLpf7ubm6hYaEqdWa0tKypqamW7du8ezs7CQ6zj9+/Li3t/fOnTtNTc2DzwdJi5xqamr8/QPIRo81Yh+gz5zJ8PDwvH79enN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7y/PnzOEBtQIGuUqljY2OJWAednJzc1tamVqlnzZxjaGBYWFjIeYRRVlrmtW07rQ8JgFK6vr5+tUrztdk3c+cY8FSpVOwMDg4uLy8HByNRNzd3YQTqoJEhsy3h2PHPxk+e8OmkaVNnTJ86Y9EiI2KfO9tg2dJlCxcYGRktNjYynjfH0NBgofFCk7KycjxBrpmZWWpqKmoBZ2ho2NnRhbGlcyJAC5LKyvp5xXLT8eMmTZwwhT/cCM/JE6dNHD+Vp8zbp6CgsK2tnWZDqYQWeSAqOjpamDYY1fPx8RkVqw76xIkTVOnmzZvr1n0nk/msW7sueMdOsZXkQESUifGStLS0ivIKsVgMM2zmJLfPuXNZaODIkSOjuOjVXmpPiMJPTM810wPiuWK4ljw9txUVFeOffAMDgxAPn7y2eSOsjo7O4qLirc6uNjZ2aJlGQ6mQiRy51Wg9AVQwPSHCzUaO+fkFvr5yqVS6auWXDlscJRJJQEAA/iiadLM9g5TxT36MfEYKgwkV0krsZJYKjI+aDvro0aPcHcw2pEoI7BCo1Gq5bloRDy0jzGU6kBldW1vHPOALuLTb/v37YUOAG2sigCIiIpA6I4LW4DLt6OhApKwRL2fQE9AjV+3dy5cvczUTb8ONhhhljKurK55Gr5WPTAftJ/dDsPQrVzhTm/CJEYooAGVhCuflXcjNze3svA/7FDwuLs7ZyZkgyEMP81emIyQuLv5sxlkWVJ8rAx+cwQETDh/A8R7DGVLjvxHaj5cjx//JdNCkv9XZ5fTp03A9thQIAzhopesk1rY2NjZH449Bnf7zv5kOGuMAOrG0tPL2lnFrMFX27dvPHYoxySgm1AsD9r+bHlowokZP/AdCoRApXMOD/tv/tffv/wAyAr/0hHrPvgAAAABJRU5ErkJggg==") } ); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/3b15e611-d78c-49bb-8818-7eaa46fd2200", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/3b15e611-d78c-49bb-8818-7eaa46fd2200 -d '{"FileBinary":"iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAIAAAAyxktbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTM0A1t6AAAG60lEQVRIS5WWh1NUVxTG948w0djHiRUsIMZKJpKJGY2IsCygixSpIgtLILARAbEhsKi7i6AI0jJjQSQIqIAC0gMoIlItYIEFFVASo2DLb3kbZJzUM8ybu+/d+51zvvOdcxG9/3t79+7d27dv37x58/r161evXv02Yr+P2LNnz548eaLVah89etTV1cUe/Zkx9jE0mx48eJCbmxcdrQwJCfHz83NxcZNIbGxtbe3sNjk4OHh4ePBSofgRU4yYXC4PClL09PToIf60D9DE2N7eLpf7ubm6hYaEqdWa0tKypqamW7du8ezs7CQ6zj9+/Li3t/fOnTtNTc2DzwdJi5xqamr8/QPIRo81Yh+gz5zJ8PDwvH79enNz8+3bt8G6e/fu/fv37927xwIHfCotLb148VJ+fn5jIy9ulZeVt7W2CWxcunTp4MGDY5nRQxcVFYWHh0MosRNaa2tbXV0dh2GT3bxkz+DgIF6fPn0Kv8XFxXV119LTf2poaGi82Tg8PEz4wcE7iUkAxHTQvA0LC+vr62NNcRobGwU4EiTSkW06q6qqGhoa4j1ALF68eNHS0lJZWUlthGCvXbsWGhoKmrBfB80mf39/drMeGBjg5MuXL3nyk8CFkDFeEq9SqXRycrKzs1MEKXDMfnIVNrBwcHCEd+GnC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YY1fPx8RkVqw76xIkTVOnmzZvr1n0nk/msW7sueMdOsZXkQESUifGStLS0ivIKsVgMM2zmJLfPuXNZaODIkSOjuOjVXmpPiMJPTM810wPiuWK4ljw9txUVFeOffAMDgxAPn7y2eSOsjo7O4qLirc6uNjZ2aJlGQ6mQiRy51Wg9AVQwPSHCzUaO+fkFvr5yqVS6auWXDlscJRJJQEAA/iiadLM9g5TxT36MfEYKgwkV0krsZJYKjI+aDvro0aPcHcw2pEoI7BCo1Gq5bloRDy0jzGU6kBldW1vHPOALuLTb/v37YUOAG2sigCIiIpA6I4LW4DLt6OhApKwRL2fQE9AjV+3dy5cvczUTb8ONhhhljKurK55Gr5WPTAftJ/dDsPQrVzhTm/CJEYooAGVhCuflXcjNze3svA/7FDwuLs7ZyZkgyEMP81emIyQuLv5sxlkWVJ8rAx+cwQETDh/A8R7DGVLjvxHaj5cjx//JdNCkv9XZ5fTp03A9thQIAzhopesk1rY2NjZH449Bnf7zv5kOGuMAOrG0tPL2lnFrMFX27dvPHYoxySgm1AsD9r+bHlowokZP/AdCoRApXMOD/tv/tffv/wAyAr/0hHrPvgAAAABJRU5ErkJggg=="}'
The response returned from the above request will be a json document representing a inventory item document DTO model from the business logic - see the meta data page for the InventoryDocumentPATCHRequest for more detail.
Delete a document for a product
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var inventoryDocumentDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryDocumentDELETERequest() { InventoryID = "000000000K00000000BQ", DocumentID = "3b15e611-d78c-49bb-8818-7eaa46fd2200" }; client.Delete(InventoryDocumentDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/3b15e611-d78c-49bb-8818-7eaa46fd2200", "DELETE", ""); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/000000000K00000000BQ/Documents/3b15e611-d78c-49bb-8818-7eaa46fd2200
Categories
Get a list of all categories
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var IN_CategoriesRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_CategoriesQuery(); ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_Categories> IN_CategoriesResponse = client.Get(IN_CategoriesRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/IN_Categories"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/IN_Categories
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/IN_Categories?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
Get a list of a specific category number
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var IN_CategoriesRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_CategoriesQuery() { CategoryNo = 1}; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.IN_Categories> IN_CategoriesResponse = client.Get(IN_CategoriesRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Queries/IN_Categories?CategoryNo=1"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Queries/IN_Categories?CategoryNo=1
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Queries/IN_Categories?CategoryNo=1&format=json
Note the &format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
Get a specific category
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCategoryGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCategoryGETRequest() { CategoryID = "000000000E00000000ZJ" }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.Category.InventoryCategory Category = client.Get(InventoryCategoryGETRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); responsebody = webClient.DownloadString("https://api.jiwa.com.au/Inventory/Categories/000000000E00000000ZJ"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X GET https://api.jiwa.com.au/Inventory/Categories/000000000E00000000ZJ
Navigate to the auth URL and provide the username and password as parameters:
https://api.jiwa.com.au/auth?username=admin&password=password
This authenticates the user and creates a cookie, so a subsequent request can be made:
https://api.jiwa.com.au/Inventory/Categories/000000000E00000000ZJ?format=json
Note the ?format=json
in the above URL this overrides the content type returned. For browsers the default content type is HTML - if a content type override is omitted, then a HTML razor view of the data will be returned instead of json. xml and csv are also valid overrides for the content type to be returned.
The response returned from the above request will be a json document representing the category DTO model from the business logic - see the meta data page for the InventoryCategoryGETRequest for more detail.
Create a category
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCategoryPOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCategoryPOSTRequest() { Description = "A new category", CategoryNo = 1 }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.Category.InventoryCategory Category = client.Post(InventoryCategoryPOSTRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Description = "A new category", CategoryNo = 1 }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/Categories", "POST", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X POST https://api.jiwa.com.au/Inventory/Categories -d '{"Description":"A new category", "Category":1}'
The response returned from the above request will be a json document representing the category DTO model from the business logic - see the meta data page for the InventoryCategoryPOSTRequest for more detail.
Update a category
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCategoryPATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCategoryPATCHRequest() { CategoryID = "3acb85d7ad4d4b878d5e", Description = "A modified category" }; JiwaFinancials.Jiwa.JiwaServiceModel.Inventory.Category.InventoryCategory Category = client.Patch(InventoryCategoryPATCHRequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Description = "A modified category" }); responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/Categories/3acb85d7ad4d4b878d5e", "PATCH", json); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X PATCH https://api.jiwa.com.au/Inventory/Categories/3acb85d7ad4d4b878d5e -d '{"Description":"A modified category"}'
The response returned from the above request will be a json document representing the category DTO model from the business logic - see the meta data page for the InventoryCategoryPATCHRequest for more detail.
Delete a category
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var InventoryCategoryDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.InventoryCategoryDELETERequest() { CategoryID = "3acb85d7ad4d4b878d5e" }; client.Delete(InventoryCategoryDELETERequest);
using (var webClient = new System.Net.WebClient()) { // Authenticate webClient.QueryString.Add("username", "Admin"); webClient.QueryString.Add("password", "password"); string responsebody = webClient.DownloadString("https://api.jiwa.com.au/auth"); // Above returns something like this: {"SessionId":"0hKBFAnutUk8Mw6YY6DN","UserName":"api","DisplayName":"","ResponseStatus":{}} // Deserialise response into a dynamic - below requires the Newtonsoft.Json nuget package var authResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responsebody); var sessionId = authResponse.SessionId; webClient.Headers.Add(System.Net.HttpRequestHeader.Cookie, string.Format("ss-id={0}", sessionId)); webClient.Headers[System.Net.HttpRequestHeader.ContentType] = "application/json"; responsebody = webClient.UploadString("https://api.jiwa.com.au/Inventory/Categories/3acb85d7ad4d4b878d5e", "DELETE"); }
curl -H 'Accept: application/json' -H 'Content-Type: application/json' -X GET https://api.jiwa.com.au/auth -d '{"username":"Admin","password":"password"}'
Returns the following authentication response, containing the SessionId which subsequent requests will need to include in the cookie "ss-id"
{"SessionId":"6w1nLX8r0sIrJHClX9Vj","UserName":"Admin","DisplayName":"","ResponseStatus":{}}
Then, with the SessionId now known, the route can be called:
curl -H 'Accept: application/json' -H 'Content-Type: application/json' --cookie 'ss-id=6w1nLX8r0sIrJHClX9Vj' -X DELETE https://api.jiwa.com.au/Inventory/Categories/3acb85d7ad4d4b878d5e