Hi Perry,
Thanks for the feedback - the FixPrice being ignored is now logged as
DEV-6465. However, you'll only see any use for that if you're sending a jiwa-stateful request header with your POST or PATCH, and then performing subsequent PATCH operations also with a jiwa-stateful request header - the FixPrice property of the sales order line is not persisted to the database. If your intent is to ensure the price supplied in the operation is the one that is used, then that is already the case - unless I'm missing something?
As for the date, you have a few options. If you provide it in an unambiguous format eg: "2018-01-08 11:34:49 AM", then it'll certainly work as expected.
ServiceStack defaults to the .NET DataContractSerializer way of serialising / deserialising datetimes - it looks like this:
{"InitiatedDate":"\/Date(1515371689000-0000)\/","DebtorAccountNo":"1001"}
The above was the result of this C#:
- Code: Select all
var so = new JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrder { DebtorAccountNo = "1001", InitiatedDate = new DateTime(2018, 01, 08, 11, 34, 49) };
string body = so.ToJson<JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrder>();
And when the above is POSTed to the SalesOrders route, the date is correct.
I'd suggest using a serialisation framework to generate the JSON - the above is using ServiceStack.Text (it provides extension methods like .ToJson() above), but you can use others like Json.NET, Microsoft's DataContractJsonSerializer.
You can also control the DateHandler the REST API Service uses to format dates which are serialised - you can override this in your own plugin which implements IJiwaRESTAPIPlugin:
- Code: Select all
namespace JiwaFinancials.Jiwa.JiwaServiceModel
{
public class RESTAPIPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
{
public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost AppHost, Funq.Container Container, JiwaApplication.Manager JiwaApplicationManager)
{
ServiceStack.Text.JsConfig.DateHandler = DateHandler.ISO8601;
}
}
}
This above will cause the ISO8601 format to be used - which probably would suit you if you're trying to keep human readable values in the JSON - but if you're generating that JSON manually you'll have to format the datetime correctly to ISO8601 format. You just need to create a new plugin with the above and enable it and it will cause our REST API plugin to use that DateHandler - no need to edit the standard REST API plugin.
The valid values for the DateHandler property can be seen in the
sourcecode of JSConfig.cs.
EDIT: I should mention that it appears as though you're manually constructing the JSON being sent - I wouldn't recommend that - instead create an object and serialise that to JSON... how was that JSON you provided generated?
Mike