Error doing a POST request Omnis 8.1.3

An an.bayens at justsoftware.be
Wed Jan 10 15:40:22 EST 2018


Hi Alex,

Thanks for the quick response. I've added quotes to the MerchangeOrderNo en removed the square brackets and the combination of both made it work.

Met vriendelijke groeten,
An Bayens
Product Manager
 
Stationsstraat 266, B-1700 Dilbeek
T. +32 2 567 21 71
Helpdesk: +32 2 568 14 54

an.bayens at optimizegroup.be <mailto:an.bayens at optmizegroup.be>
www.justsoftware.be <http://www.justsoftware.be/> | www.optimizegroup.be <http://www.optimizegroup.be/>
 

 <http://www.justsoftware.be/>
 
 <http://www.justsoftware.be/> <http://www.justsoftware.be/nieuws/531-kmo-portefeuille> <https://www.facebook.com/optimizegroupBE> <https://www.linkedin.com/company/optimize-group> <https://www.linkedin.com/company/optimize-group> <https://twitter.com/groupoptimize> <https://plus.google.com/114613785888034261968> Follow us on your favorite social media sites! <https://plus.google.com/114613785888034261968>


> Op 10 jan. 2018, om 21:27 heeft Alex Clay <aclay at mac.com> het volgende geschreven:
> 
> Hi An,
> 
>> [     {         "MerchantOrderNo": 1001598,         "OrderId": 1     } ] 
> 
> is different from:
> 
>> {
>> "MerchantOrderNo": "string",
>> "OrderId": 0
>> }
> 
> in two regards. First, you might need to force the value for MerchantOrderNo to be a string so it's quoted:
> 
>> [     {         "MerchantOrderNo": "1001598',         "OrderId": 1     } ] 
> 
> 
> Second, the square brackets denote an array. The error message you shared suggests the API will be ok with an array, but if changing the string type doesn't help try stripping off the square brackets:
> 
>> {         "MerchantOrderNo": "1001598',         "OrderId": 1     } 
> 
> 
> Alex
> 
> 
>> On Jan 10, 2018, at 15:17, An <an.bayens at justsoftware.be <mailto:an.bayens at justsoftware.be>> wrote:
>> 
>> Hi All,
>> 
>> After making a huge step thanks to Bruno I've now ran in to a new error.
>> 
>> As content for my post I send this in JSON format. 
>> 
>> [     {         "MerchantOrderNo": 1001598,         "OrderId": 1     } ] 
>> 
>> This is created using following code:
>> Do OJSON.$listorrowtojson(iList,,errorText) Returns iContentBinary
>> Do OJSON.$formatjson(iContentBinary) Returns iContentChar
>> Calculate iContentChar as replaceall(iContentChar,kCr,' ')
>> 
>> 
>> This matches with the API reference which say's it should be this
>> {
>> "MerchantOrderNo": "string",
>> "OrderId": 0
>> }
>> 
>> But I get following error message. Can it be that this is also something that changed using the new OW3 Worker Object?
>> {
>>   "StatusCode": 400,
>>   "Success": false,
>>   "Message": "Some fields did not pass validation, see ValidationErrors for details.",
>>   "ValidationErrors": {
>>       "model": [
>>           "Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'MM.WebApi.App.ViewModels.OrderAcknowledgementViewModel' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath '', line 1, position 1."
>>       ]
>>   }
>> }
>> 
>> Thanks very much for helping a Omnis newbie :)
>> 
>> 
>> Met vriendelijke groeten,
>> An Bayens
>> Product Manager
>> 
>> Stationsstraat 266, B-1700 Dilbeek
>> T. +32 2 567 21 71
>> Helpdesk: +32 2 568 14 54
>> 
>> an.bayens at optimizegroup.be <mailto:an.bayens at optimizegroup.be> <mailto:an.bayens at optmizegroup.be <mailto:an.bayens at optmizegroup.be>>
>> www.justsoftware.be <http://www.justsoftware.be/> <http://www.justsoftware.be/ <http://www.justsoftware.be/>> | www.optimizegroup.be <http://www.optimizegroup.be/> <http://www.optimizegroup.be/ <http://www.optimizegroup.be/>>
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com <http://lists.omnis-dev.com/>



More information about the omnisdev-en mailing list