on 09-13-2017 8:41 AM
Dear Gurus
I have a requirement where i am suppose to poll a website using REST Get sender adapter to get the orders every 30 mins.
And the requirement to avoid duplicates by using the Json path in Unique ID field as the request payloads is JSON. Am trying to use ID under Order to remove duplicates in polling. Following is the JSON structure website is using:
{
"success": "true",
"result_count": 45,
"results_per_page": 200,
"page": 1,
"data": [
{
"Order": {
"id": "19541231",
"created": "2017-07-27 11:57:13",
"modified": "2017-07-27 17:27:26",
},
"Order": {
"id": "19543211",
"created": "2017-07-27 11:57:13",
"modified": "2017-07-27 17:27:26",
},
"Order": {
"id": "19512112",
"created": "2017-07-27 11:57:13",
"modified": "2017-07-27 17:27:26",
},
}
]
}
*******************************************************
Now if i put these JSON paths i am getting following issues:
1. Unique ID Element = $.data [*].Order.id
result
When we gave * in the unique ID Element .Error
While processing inbound message Java.lang.NumberFormatException:For input
String:”*”:for Input String:”*”
2. Unique ID Element = $.data [0].Order.id
result
When we gave 0 in the unique ID Element For the
First Poll we are getting first 200 records.
3. Unique ID Element = $.data [0].Order.id
result
For the second Poll we are not getting any
records.
4. Unique ID Element = $.data [0].Order.id
result
When we added 2 new orders in API & and then
poll --->we are getting first 200 records again by adding the newly added 2
records on the top & rest 198 old records which we received in the first
poll as website that i am polling puts new orders on their first page. Duplicates are still not removing.
***************************************************************
Please help with some Ideas as to how to format the JSON path to get the duplicate issue resolved.
Regards
Naina
Hi All
Anyone who also suffered because of this....kindly help
Naina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naina,
First of all, you should probably reconsider your expectations in terms of response time towards a public support forum where busy people help out fellow members voluntarily. A follow-up after 11 minutes seems a little pushy, don't you think? 🙂
Having said that, I think your problem is with the JSON that you are trying to parse rather than the JSON Path. The example you provided is not a valid JSON message. I have taken the liberty of reformatting it a little to make it valid:
{
"success": "true",
"result_count": 45,
"results_per_page": 200,
"page": 1,
"data": [
{
"Order": {
"id": "19541231",
"created": "2017-07-27 11:57:13",
"modified": "2017-07-27 17:27:26"
}
},
{
"Order": {
"id": "19543211",
"created": "2017-07-27 11:57:13",
"modified": "2017-07-27 17:27:26"
}
},
{
"Order": {
"id": "1951213",
"created": "2017-07-27 11:57:13",
"modified": "2017-07-27 17:27:26"
}
}
]
}
Now if I apply $.data[*].Order.id I get the order IDs returned:
Regards,
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Patrick
Am sorry if i sounded pushy...
This structure issue is not there...i accidentally removed , from the JSON....the format is correct only, also it is giving correct results when tested using online JSON test tools.
The problem is when i put this path in Unique ID element of sender rest(GET) polling adapter, there it fails
Naina
OK, I'm afraid I will not be able to test that as I don't have a PI system at my disposal in my current engagement. I just saw the JSON and it looked off, so I did a quick test with an online validator. I'm sure somebody else will be able to advise. Good luck resolving the issue.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.