- Created by Mike Sheen, last modified on Sept 22, 2017
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 60 Next »
Sales Orders
Get a filtered list of sales orders
Using v_Jiwa_SalesOrder_ListQuery
A view, v_Jiwa_SalesOrder_List is provided with a corresponding query class v_Jiwa_SalesOrder_ListQuery to facilitate retrieving a filtered, paginated list of sales orders. The data returned includes data from several tables to bring together customer, sales order, delivery information from one query.
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 salesOrderListRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.v_Jiwa_SalesOrder_ListQuery() { PhysicalWarehouseDescription = "New South Wales", LogicalWarehouseDescription = "Main", Fields = "InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID,DebtorAccountNo,DebtorName",OrderBy = "InvoiceNo", Include = "Total", Take = 25 }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.v_Jiwa_SalesOrder_List> salesOrderListResponse = client.Get(salesOrderListRequest);
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/SalesOrderList?PhysicalWarehouseDescription=New South Wales&LogicalWarehouseDescription=Main&Fields=InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID,AccountNo,DebtorName&OrderBy=InvoiceNo&Include=Total&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/SalesOrderList?PhysicalWarehouseDescription=New%20South%20Wales&LogicalWarehouseDescription=Main&Fields=InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID,AccountNo,DebtorName&OrderBy=InvoiceNo&Include=Total&Take=25
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/SalesOrderList -d '{"PhysicalWarehouseDescription":"New South Wales", "LogicalWarehouseDescription":"Main","Fields":"InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID,AccountNo,DebtorName", "OrderBy":"InvoiceNo", "Include":"Total", "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/SalesOrderList?PhysicalWarehouseDescription=New%20South%20Wales&LogicalWarehouseDescription=Main&Fields=InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID,DebtorAccountNo,DebtorName&OrderBy=InvoiceNo&Include=Total&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.
With the above example, simply setting the Skip property of the request DTO to 25 will have the effect of retrieving the next 25 records. Because we include in the request Include=Total, the response will contain a property, Total, which is the count of the total number of records matching the query.
Using SO_MainQuery
An alternative to using the v_Jiwa_SalesOrder_ListQuery is to simply use the SO_MainQuery.
All tables have a corresponding Query class. For example, the table SO_Main has a class SO_MainQuery. The SO_MainQuery class is the DTO used for query operations against the SO_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 salesOrderListRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.Tables.SO_MainQuery() { Fields = "InvoiceID, InvoiceNo, InvoiceInitDate, DebtorID", OrderBy = "InvoiceNo", Take = 25, Include = "Total" }; ServiceStack.QueryResponse<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.SO_Main> salesOrderListResponse = client.Get(salesOrderListRequest);
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/SO_Main?Fields=InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID&OrderBy=InvoiceNo&Take=25&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/SO_Main?&Fields=InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID&OrderBy=InvoiceNo&Include=Total&Take=25
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/SO_Main -d '{"Fields":"InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID", "OrderBy":"InvoiceNo", "Include":"Total", "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/SO_Main?Fields=InvoiceID,InvoiceNo,InvoiceInitDate,DebtorID&OrderBy=InvoiceNo&Include=Total&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.
Read a Sales Order
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderGETRequest { InvoiceID = "000000000800000000NK" }; var salesOrderGETResponse = client.Get(salesOrderGETRequest);
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/SalesOrders/000000000800000000NK"); }
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/SalesOrders/000000000800000000NK
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/SalesOrders/000000000800000000NK?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.
Create a new Sales Order
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderPOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderPOSTRequest() { DebtorID = "00000000080000000002", InitiatedDate = DateTime.Now, OrderNo = "1234", SOReference = "Test order" }; salesOrderPOSTRequest.Lines.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderLine { PartNo = "1170", QuantityOrdered = 5 }); salesOrderPOSTRequest.Lines.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderLine { CommentLine = true, CommentText = "This is a comment line" }); salesOrderPOSTRequest.Lines.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderLine { InventoryID = "000000000K00000000BV", QuantityOrdered = 2, DiscountedPrice = 15.67M, CustomFieldValues = new List<JiwaFinancials.Jiwa.JiwaServiceModel.CustomFields.CustomFieldValue> { new JiwaFinancials.Jiwa.JiwaServiceModel.CustomFields.CustomFieldValue { SettingID = "1ae102b94dc54dfc8a45 ", Contents = "Fragile - do not drop" } } }); salesOrderPOSTRequest.Payments.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderPayment { PaymentRef = "S454873-J5", AmountPaid = 50.00M }); var salesOrderPOSTResponse = client.Post(salesOrderPOSTRequest);
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 = "00000000080000000002", InitiatedDate = DateTime.Now, OrderNo = "1234", SOReference = "Test order", Lines = new List<object> { new { PartNo = "1170", QuantityOrdered = 5 }, new { CommentLine = true, CommentText = "This is a comment line" }, new { InventoryID = "000000000K00000000BV", QuantityOrdered = 2, DiscountedPrice = 15.67M, CustomFieldValues = new List<object> { new { SettingID = "1ae102b94dc54dfc8a45 ", Contents = "Fragile - do not drop" } } } }, Payments = new List<object> { new { PaymentRef = "S454873-J5", AmountPaid = 50.00M } } }); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders", "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/SalesOrders -d '{"DebtorID":"00000000080000000002","InitiatedDate":"2017-09-20","OrderNo":"1234","SOReference":"Test order","Lines":[{"PartNo":"1170","QuantityOrdered":5},{"CommentLine":"true","CommentText":"This is a comment line"},{"InventoryID":"000000000K00000000BV","QuantityOrdered":2,"DiscountedPrice:15.67,"CustomFieldValues":[{"SettingID":"1ae102b94dc54dfc8a45 ", "Contents":"Fragile - do not drop"}]}],"Payments":[{"PaymentRef":"S454873-J5","AmountPaid":50.00}]}'
The response returned from the above request will be a json document representing the full sales order DTO model from the business logic - see the meta data page for the SalesOrderPOSTRequest for more detail.
Note(1): The DebtorID or DebtorAccountNo can be provided. If both are provided, then the DebtorID will be used to resolve the debtor.
Note(2): The sales order line added can provide either the InventoryID, or the PartNo. If both are provided, then the InventoryID will be used to resolve the inventory item.
Note(3): When sales order lines are added, omitting the price will cause Jiwa to determine the price per normal pricing scheme logic.
Note(4): The last line added in the above example sets a custom line field value for a setting with ID "1ae102b94dc54dfc8a45"
Note(5): When adding payments if the PaymentType is omitted, then the default payment type configured in Jiwa is used.
Update an existing Sales Order
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderPATCHRequest() { InvoiceID = "babce67cdbf64f778536", ExpectedDeliveryDate = DateTime.Now.AddDays(5) }; salesOrderATCHRequest.Lines.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderLine { PartNo = "1172", QuantityOrdered = 5 }); salesOrderATCHRequest.Lines.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderLine { InvoiceLineID = "88a358a2822e4319b9b9", QuantityOrdered = 10, CustomFieldValues = new List<JiwaFinancials.Jiwa.JiwaServiceModel.CustomFields.CustomFieldValue> { new JiwaFinancials.Jiwa.JiwaServiceModel.CustomFields.CustomFieldValue { SettingID = "1ae102b94dc54dfc8a45 ", Contents = "Adjustment requested by phone" } } }); salesOrderATCHRequest.Notes.Add(new JiwaFinancials.Jiwa.JiwaServiceModel.Notes.Note { NoteText = "Customer telephoned and asked for another few hours of labour" }); var salesOrderATCHResponse = client.Patch(salesOrderATCHRequest);
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 { ExpectedDeliveryDate = DateTime.Now.AddDays(5), Lines = new List<object> { new { PartNo = "1172", QuantityOrdered = 5 }, new { InvoiceLineID = "88a358a2822e4319b9b9", QuantityOrdered = 10, CustomFieldValues = new List<object> { new { SettingID = "1ae102b94dc54dfc8a45 ", Contents = "Adjustment requested by phone" } } } }, Notes = new List<object> { new { NoteText = "Customer telephoned and asked for another few hours of labour" } } }); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/babce67cdbf64f778536", "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/SalesOrders/babce67cdbf64f778536 -d '{"ExpectedDeliveryDate":"2017-09-20","Lines":[{"PartNo":"1172","QuantityOrdered":5},{"InvoiceLineID":"88a358a2822e4319b9b9","QuantityOrdered":10,"CustomFieldValues":[{"SettingID":"1ae102b94dc54dfc8a45 ", "Contents":"Adjustment requested by phone"}]}],"Notes":[{"NoteText":"Customer telephoned and asked for another few hours of labour"}]}'
The response returned from the above request will be a json document representing the full sales order DTO model from the business logic - see the meta data page for the SalesOrderPATCHRequest for more detail.
Note(1): The DebtorID or DebtorAccountNo can be provided. If both are provided, then the DebtorID will be used to resolve the debtor.
Note(2): A sales order line can update an existing line by providing the InvoiceLineID property. New lines are appended by omitting InvoiceLineID.
Note(3): A new sales order line added can provide either the InventoryID, or the PartNo. If both are provided, then the InventoryID will be used to resolve the inventory item.
Note(4): When sales order lines are added, omitting the price will cause Jiwa to determine the price per normal pricing scheme logic.
Note(5): The last line added in the above example sets a custom line field value for a setting with ID "1ae102b94dc54dfc8a45"
Note(6): When adding notes if the NoteType is omitted, then the default note type configured in Jiwa is used.
Custom Fields
List all custom fields for sales orders
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var SalesOrderCustomFieldsGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderCustomFieldsGETManyRequest(); var salesOrderCustomFieldsGETManyResponse = client.Get(SalesOrderCustomFieldsGETManyRequest);
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/SalesOrders/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/SalesOrders/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/SalesOrders/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 SalesOrderCustomFieldsGETManyRequest for more detail.
Get All Custom Field Values for a Single Sales Order
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var SalesOrderCustomFieldValuesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderCustomFieldValuesGETManyRequest { InvoiceID = "babce67cdbf64f778536" }; var salesOrderCustomFieldValuesGETManyResponse = client.Get(SalesOrderCustomFieldValuesGETManyRequest);
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/SalesOrders/babce67cdbf64f778536/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/SalesOrders/babce67cdbf64f778536/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/SalesOrders/babce67cdbf64f778536/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 the a list of the DTO model for a custom field value - see the meta data page for the SalesOrderCustomFieldValuesGETManyRequest for more detail.
Get a Single Custom Field Value for a Sales Order and Custom Field
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var SalesOrderCustomFieldValueGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderCustomFieldValueGETRequest { InvoiceID = "babce67cdbf64f778536", SettingID = "b5432521f1fd46bb9245" }; var salesOrderCustomFieldValueGETResponse = client.Get(SalesOrderCustomFieldValueGETRequest);
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/SalesOrders/babce67cdbf64f778536/CustomFieldValues/b5432521f1fd46bb9245"); }
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/SalesOrders/babce67cdbf64f778536/CustomFieldValues/b5432521f1fd46bb9245
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/SalesOrders/babce67cdbf64f778536/CustomFieldValues/b5432521f1fd46bb9245?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 for a custom field value - see the meta data page for the SalesOrderCustomFieldValueGETRequest for more detail.
Update a Single Custom Field Value for a Sales Order and Custom Field
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var SalesOrderCustomFieldValuePATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderCustomFieldValuePATCHRequest { InvoiceID = "babce67cdbf64f778536", SettingID = "b5432521f1fd46bb9245 ", Contents = "New Contents" }; var salesOrderCustomFieldValuePATCHResponse = client.Get(SalesOrderCustomFieldValuePATCHRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Contents = "New Contents"} ); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/babce67cdbf64f778536/CustomFieldValues/b5432521f1fd46bb9245 /", "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/SalesOrders/babce67cdbf64f778536/CustomFieldValues/b5432521f1fd46bb9245%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 -d '{"Contents":"New Contents"}'
The response returned from the above request will be a json document representing the DTO model for a custom field value - see the meta data page for the SalesOrderCustomFieldValuePATCHRequest for more detail.
Sales Order History (Snapshot)
Retrieve a list of sales order histories
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistorysGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistorysGETManyRequest { InvoiceID = "000000000800000000NK"}; var salesOrderHistorysGETManyResponse = client.Get(salesOrderHistorysGETManyRequest);
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/SalesOrders/000000000800000000NK/Historys"); }
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/SalesOrders/000000000800000000NK/Historys
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/SalesOrders/000000000800000000NK/Historys?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.
Retrieve a sales order history
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistorysGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistorysGETRequest { InvoiceID = "000000000800000000NK", InvoiceHistoryID = "000000000800000000NL"}; var salesOrderHistorysGETResponse = client.Get(salesOrderHistorysGETRequest);
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/SalesOrders/000000000800000000NK/Historys/000000000800000000NL"); }
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/SalesOrders/000000000800000000NK/Historys/000000000800000000NL
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/SalesOrders/000000000800000000NK/Historys/000000000800000000NL?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.
Update a sales order history
Note that to update some fields of the sales order history, you need to not use the SalesOrderHistorysPATCHRequest on /SalesOrders/{InvoiceID}/Historys/{InvoiceHistoryID} but instead use the SalesOrderPATCHRequest - this will pass the values through to the current snaphot number of the sales order. See Update An Existing Sales Order.
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistorysPATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistorysPATCHRequest { InvoiceID = "000000000800000000NK", InvoiceHistoryID = "000000000800000000NL", Status = JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrderHistory.SalesOrderHistoryStatuses.e_SalesOrderHistoryStatusReadyForPicking}; var salesOrderHistorysPATCHResponse = client.Patch(salesOrderHistorysPATCHRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Status = 2 }); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/000000000800000000NK/Historys/000000000800000000NL", 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 GET https://api.jiwa.com.au/SalesOrders/000000000800000000NK/Historys/000000000800000000NL -d '{"Status":2}'
Custom Fields
List all custom fields for sales order historys
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldsGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldsGETManyRequest(); var salesOrderHistoryCustomFieldsGETManyResponse = client.Get(salesOrderHistoryCustomFieldsGETManyRequest);
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/SalesOrders/Historys/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/SalesOrders/Historys/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/SalesOrders/Historys/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 SalesOrderHistoryCustomFieldsGETManyRequest for more detail.
Get All Custom Field Values for a Single Sales Order History
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldValuesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldValuesGETManyRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e" }; var salesOrderHistoryCustomFieldValuesGETManyResponse = client.Get(salesOrderHistoryCustomFieldValuesGETManyRequest);
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/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 the a list of the DTO model for a custom field value - see the meta data page for the SalesOrderHistoryCustomFieldValuesGETManyRequest for more detail.
Get a Single Custom Field Value for a Sales Order history and Custom Field
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldValuesGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldValuesGETRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e", SettingID = "3231d2153d124a8ab2ad " }; var salesOrderHistoryCustomFieldValuesGETResponse = client.Get(salesOrderHistoryCustomFieldValuesGETRequest);
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad /"); }
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20?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 for a custom field value - see the meta data page for the SalesOrderHistoryCustomFieldValuesGETRequest for more detail.
Update a Single Custom Field Value for a Sales Order history and Custom Field
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldValuesPATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldValuesPATCHRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e", SettingID = "3231d2153d124a8ab2ad ", Contents = "New Contents" }; var salesOrderHistoryCustomFieldValuesPATCHResponse = client.Patch(salesOrderHistoryCustomFieldValuesPATCHRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Contents = "New Contents"} ); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad /", "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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 -d '{"Contents":"New Contents"}'
The response returned from the above request will be a json document representing the DTO model for a custom field value - see the meta data page for the SalesOrderHistoryCustomFieldValuesPATCHRequest for more detail.
Lines
Read all lines for a sales order
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLinesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLinesGETManyRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e" }; var salesOrderLinesGETManyResponse = client.Get(salesOrderLinesGETManyRequest);
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines"); }
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines?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 sales order line
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLineGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLineGETRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e", InvoiceLineID = "abf2263e7a6c438b8cdf" }; var salesOrderLineGETResponse = client.Get(salesOrderLineGETRequest);
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines/abf2263e7a6c438b8cdf"); }
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines/abf2263e7a6c438b8cdf
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines/abf2263e7a6c438b8cdf?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.
Add a line to a sales order
Inventory Item
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLinePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLinePOSTRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e", PartNo = "1170", QuantityOrdered = 5, DiscountedPrice = 15.45M }; var salesOrderLinePOSTResponse = client.Post(salesOrderLinePOSTRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { PartNo = "1170", QuantityOrdered = 5, DiscountedPrice = 15.45M }); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines", "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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/Lines -d '{"PartNo":"1170", "QuantityOrdered":5, "DiscountedPrice":15.45}'
Comment Line
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLinePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLinePOSTRequest { InvoiceID = "32417fa3bc1c451ea2ba", InvoiceHistoryID = "5f4a173d84c54ee7ab11", CommentLine = true, CommentText = "This is a comment line" }; var salesOrderLinePOSTResponse = client.Post(salesOrderLinePOSTRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { CommentLine = true, CommentText = "This is a comment line" }); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/32417fa3bc1c451ea2ba/Historys/5f4a173d84c54ee7ab11/Lines", "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/SalesOrders/32417fa3bc1c451ea2ba/Historys/5f4a173d84c54ee7ab11/Lines -d '{"CommentLine":"true", "CommentText":"This is a comment line"}'
Update a sales order line
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLinePOSTRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLinePATCHRequest { InvoiceID = "32417fa3bc1c451ea2ba", InvoiceHistoryID = "5f4a173d84c54ee7ab11", InvoiceLineID = "adc8696b69564431bd6c", QuantityOrdered = 6 }; var salesOrderLinePOSTResponse = client.Patch(salesOrderLinePOSTRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { QuantityOrdered = 6 }); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/32417fa3bc1c451ea2ba/Historys/5f4a173d84c54ee7ab11/Lines/adc8696b69564431bd6c", "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/SalesOrders/32417fa3bc1c451ea2ba/Historys/5f4a173d84c54ee7ab11/Lines/adc8696b69564431bd6c -d '{"QuantityOrdered":6}'
Delete a sales order line
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLineDELETERequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLineDELETERequest { InvoiceID = "32417fa3bc1c451ea2ba", InvoiceHistoryID = "5f4a173d84c54ee7ab11", InvoiceLineID = "adc8696b69564431bd6c" }; var salesOrderLineDELETEResponse = client.Patch(salesOrderLineDELETERequest);
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/SalesOrders/32417fa3bc1c451ea2ba/Historys/5f4a173d84c54ee7ab11/Lines/adc8696b69564431bd6c", "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/SalesOrders/32417fa3bc1c451ea2ba/Historys/5f4a173d84c54ee7ab11/Lines/adc8696b69564431bd6c
Custom Fields
List all custom fields for sales order lines
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderLineCustomFieldsGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderLineCustomFieldsGETManyRequest(); var salesOrderLineCustomFieldsGETManyResponse = client.Get(salesOrderLineCustomFieldsGETManyRequest);
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/SalesOrders/Lines/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/SalesOrders/Lines/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/SalesOrders/Historys/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 SalesOrderHistoryCustomFieldsGETManyRequest for more detail.
Get All Custom Field Values for a Single Sales Order History
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldValuesGETManyRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldValuesGETManyRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e" }; var salesOrderHistoryCustomFieldValuesGETManyResponse = client.Get(salesOrderHistoryCustomFieldValuesGETManyRequest);
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/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 the a list of the DTO model for a custom field value - see the meta data page for the SalesOrderHistoryCustomFieldValuesGETManyRequest for more detail.
Get a Single Custom Field Value for a Sales Order history and Custom Field
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldValuesGETRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldValuesGETRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e", SettingID = "3231d2153d124a8ab2ad " }; var salesOrderHistoryCustomFieldValuesGETResponse = client.Get(salesOrderHistoryCustomFieldValuesGETRequest);
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad /"); }
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20?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 for a custom field value - see the meta data page for the SalesOrderHistoryCustomFieldValuesGETRequest for more detail.
Update a Single Custom Field Value for a Sales Order history and Custom Field
var client = new ServiceStack.JsonServiceClient("https://api.jiwa.com.au"); var authResponse = client.Get(new ServiceStack.Authenticate() { UserName = "admin", Password = "password" }); var salesOrderHistoryCustomFieldValuesPATCHRequest = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrderHistoryCustomFieldValuesPATCHRequest { InvoiceID = "5244dd5e199749f4b6fe", InvoiceHistoryID = "29a71d4380c5437b972e", SettingID = "3231d2153d124a8ab2ad ", Contents = "New Contents" }; var salesOrderHistoryCustomFieldValuesPATCHResponse = client.Patch(salesOrderHistoryCustomFieldValuesPATCHRequest);
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)); string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { Contents = "New Contents"} ); responsebody = webClient.UploadString("https://api.jiwa.com.au/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad /", "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/SalesOrders/5244dd5e199749f4b6fe/Historys/29a71d4380c5437b972e/CustomFieldValues/3231d2153d124a8ab2ad%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 -d '{"Contents":"New Contents"}'
The response returned from the above request will be a json document representing the DTO model for a custom field value - see the meta data page for the SalesOrderHistoryCustomFieldValuesPATCHRequest for more detail.
Notes
Documents
Processing a Sales Order
- No labels