Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everybody!
Can you help me, I would like to use standard
org.talend.sdk.component.api.service.http.HttpClient
to submit POST request to an endpoint.
I see example where body in JsonObject:
Is there way to configure HttpClient to post www-form-urlencoded parameters in request body.
Thank you very much!
Yes it is... I took closer look at
org.talend.sdk.component.runtime.manager.service.http.RequestParser#parse
and concluded my method could be like this
@Codec(encoder = {XWWWFormURLEncoder.class}) @Request(method = "POST", path = "/o/oauth2/token") public Response<JsonObject> getAccessToken( @Header("Content-Type") String contentType, OAuthDataStore oAuthDataStore);
where I had to add own body encoder implementation.
Fortunately Talend has good documentation and fluent lambda style code so to figure out this wasn't trouble at all.
Yes it is... I took closer look at
org.talend.sdk.component.runtime.manager.service.http.RequestParser#parse
and concluded my method could be like this
@Codec(encoder = {XWWWFormURLEncoder.class}) @Request(method = "POST", path = "/o/oauth2/token") public Response<JsonObject> getAccessToken( @Header("Content-Type") String contentType, OAuthDataStore oAuthDataStore);
where I had to add own body encoder implementation.
Fortunately Talend has good documentation and fluent lambda style code so to figure out this wasn't trouble at all.