Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying posting a JSON through tRestClient component. Below are the parameters which i have set in component settings:
HTTP Method: POST, Content Type: JSON, Accept Type: Any
Input Schema: Repository (Json metadata)
Request is based upon Bearer Token so selected OAuth2 Bearer and provided the token value.
Did not give any query parameter and HTTP Headers.
Talend version - 8.0.1
java - zulu 17
Please help!
Error as below:
Starting job API_testing at 12:47 29/04/2022.
[statistics] connecting to socket on port 3452
[statistics] connected
[WARN ] 12:47:08 org.apache.cxf.transport.http.HTTPConduit- WWW-Authenticate response header is not set
Exception in component tRESTClient_1 (API_testing)
javax.ws.rs.WebApplicationException: HTTP 401 Unauthorized
at pim_integration.api_testing_0_1.API_testing.tFileInputJSON_1Process(API_testing.java:2492)
at pim_integration.api_testing_0_1.API_testing.runJobInTOS(API_testing.java:3286)
at pim_integration.api_testing_0_1.API_testing.main(API_testing.java:3048)
[statistics] disconnected
Job API_testing ended at 12:47 29/04/2022. [Exit code = 1]
Hi, you can try to set no auth and add a header named "Authorization"
with value : "bearer yourtokenhere".
eg:
Header name :
"Authorization"
Header value :
"bearer 1456465456121545d54"
Send me love and kudos
Thankyou for the response!
I tried that and now it gives there is an issue with JSON file. However when I validate it in JSON viewers, it seems to be correct.
Below is the job output and JSON format I am using:
| tLogRow_3 |
|=--------+-----------------------------------------------------=|
|errorCode|errorMessage |
|=--------+-----------------------------------------------------=|
|400 |{"code":400,"message":"Invalid json message received"}
{
"identifier": "123",
"enabled": true,
"family": "AC",
"categories": [],
"groups": [],
"parent": null,
"values": {}
}
I think you need to check what JSON message format is expected by API, try this JSON string with other client tool such as Postman.
The same JSON is working on Postman
This is how I am using the JSON metadata in tRestClient component. PFB the snips.
Please help!
you have to use a tWriteJsonField with one column output named string to the tRestCLient
https://help.talend.com/r/en-US/7.3/processing/tsplitrow-tfixedflowinput-tlogrow-tlogrow-procedure-standard-component-drop
I already did that steps present in this link. PFB the request posted in community:
https://community.talend.com/s/feed/0D55b00007Db54DCAR
Regards,
Shivam
Hi,
Could you please send me a link or doc to refer for giving JSON as context variable or input parameter to tRest component instead of hardcoding it in HTTP Body.
you just have to connect the tWriteJSONFields component to the tRestClient component with a main link and in the tWriteJsonFields you just have one field in the Output named string of type String.