Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello.
I have a simple job with a json file structed like this:
[
{
"sku" : "A",
"warehouse" : "NY",
"qty" : 2
},
{
"sku" : "B",
"warehouse" : "CA",
"qty" : 3
},
{
"sku" : "C",
"warehouse" : "LA",
"qty" : 1
}
]
That I would like to post on a website using trestclient with one request only instead one request per line.
My job is:
tfileinputjson -> txmlMap -> trestclient
Is possible to make one request only?
Hello.
Stocks file is the struture in json.
If I use it as raw, I have no answer from API:
200||{"data":[{"status":"error","error":"No data received","erp_transaction_id":null}]}
Can you show me the job design and how the components are configured please? You should not be sending no data unless there is something wrong with how the components are configured. If the components are configured correctly, then we will need to look at what your API is expecting.
Hello.
From a csvfileinput I am generating json file(stocks.json) with the required structure.
Then I am trying to make the post using the stocks.json file to the API
This is the json file input:
This is the txmlmap:
Thank you
The tXMLMap is the wrong component. That produces XML and not JSON.
I was hoping you would show me the job where you tried my suggestion. The way you're doing the above will not work at all if your API requires JSON.
Hello
If i do your suggestion I have this response:
200||{"data":[{"status":"error","error":"No data received","erp_transaction_id":null}]}
This i what I did:
This is the tmap config:
I am stuck....
You need to send JSON to the "string" column. "body" is for XML, "string" is for JSON. Although XML looks like a String, it is handled differently. JSON is just handled as a String.
Hello.
I did that now and I have this response:
statusCode body string
200||{"data":[{"status":"error","error":"No data received","erp_transaction_id":null}]}
This is my job:
My tmap:
I've tested the raw data that is inside the file on postman and works fine.
Can you add a tLogRow between your tMap and tRESTClient. This will show you what is being sent to the tRESTClient. I presume that the tFileInputRaw is set to "Read the file as a string".
The one component we have not looked at yet is the tRESTClient. Can you show me how that is configured?
Hello.
yes, tFileInputraw is set to read as string.
trestclient:
And with the the tlogrow between tmap and trestclient we have this:
Let me know if you need anything else.
Once again, thank you
OK, everything is looking OK from what I can see. Do you have any documentation for the API that I can look at? The number of records that were included in the JSON file are quite a lot. I suspect that the error message is misleading. Can you test this by reducing the number of records to 1, then try 2, 3, 4, etc, and see what you get?