Author |
Message
|
devamar28 |
Posted: Fri Jan 06, 2017 10:33 am Post subject: Mapping the response back to request |
|
|
Novice
Joined: 04 Jan 2017 Posts: 10
|
I have the below scenario
I'm sending a JSON Request with 50 records each time and each record has a unique id: below is sample request
The Request and Response are sequential and I'm using POST service to send the JSON Request using WMB.
Request
Code: |
{
"objects": [
{
"AccountNumber": "A00000024",
"UOM": "TRANS-OB_PO_BASE",
"Quantity": 15,
"StartDateTime": "2016-10-20T05:41:36.000+02:00",
"EndDateTime": "2016-20-20T05:41:36.000+02:00",
"WarehouseID__c": "WarehouseId12345",
"UniqueID__c" : "UniqueId123456"
},
{
"AccountNumber": "A000023424",
"UOM": "TRANS-OB_PO_BASE",
"Quantity": 15,
"StartDateTime": "2016-10-20T05:41:36.000+02:00",
"EndDateTime": "2016-20-20T05:41:36.000+02:00",
"WarehouseID__c": "WarehouseId12345",
"UniqueID__c" : "UniqueId123456"
}
],
"type": "Usage"
} |
For each request I get a response back and below is the sample response
Response:
Code: |
[
{
"Success": true,
"Id": "UniqueId123456"
},
{
"Errors": [
{
"Code": "INVALID_VALUE",
"Message": "The AccountID is invalid."
}
],
"Success": false
}
] |
I have to upload the status whether it was a success or failure for each record based on the response. Success record will bring me back the Unique ID which was given but failure record doesn't include the unique ID in the response. Can any one please help me with the logic on how to map the response back to request in order to find which record (Unique ID) failed? |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 06, 2017 11:13 am Post subject: Re: Mapping the response back to request |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
devamar28 wrote: |
Can any one please help me with the logic on how to map the response back to request in order to find which record (Unique ID) failed? |
Seriously?
I charge for writing code and you're (presumably) paid to. This isn't difficult.
If the problem is that the response is not in the same order as the request, that's a problem for whoever's sending the request. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
devamar28 |
Posted: Fri Jan 06, 2017 11:42 am Post subject: |
|
|
Novice
Joined: 04 Jan 2017 Posts: 10
|
I'm learning WMB from scratch and planning to become a WMB developer, I'm bombarding myself with all the tasks one could find, the other day it was SwA and today this. I will be getting better if not today some day until then I will be practicing! |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 06, 2017 11:44 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Don't think of it as a WMB problem.
Think of it as a general coding problem.
Solve it that way, then turn it into WMB code. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 06, 2017 11:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
devamar28 wrote: |
I will be getting better if not today some day until then I will be practicing! |
I'm sure.
But we're not a training resource. We're a very bad way of getting training. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 06, 2017 11:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Don't think of it as a WMB problem.
Think of it as a general coding problem.
Solve it that way, then turn it into WMB code. |
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
devamar28 |
Posted: Fri Jan 06, 2017 2:22 pm Post subject: |
|
|
Novice
Joined: 04 Jan 2017 Posts: 10
|
mqjeff wrote: |
Don't think of it as a WMB problem.
Think of it as a general coding problem.
Solve it that way, then turn it into WMB code. |
Thank you! |
|
Back to top |
|
 |
|