Pass params in tRestClient Talend - talend

I'm trying to pass params to a tRestClient but it's not taking this params :
Any help please ?
Thx

Related

PowerQuery missing supports for windows authentification and REST API POST body

I've discovered the hard way that PowerQuery (Powerbi & excel) Web.Contents function doesn't support a body payload when using Windows authentification.
with similar query
let
body = "{""json"" : ""payload""}",
Data= Web.Contents("http://xxxx/api/Query",[Content=Text.ToBinary(body),Headers=[#"Content-Type"="application/json"]]),
DataRecord = Json.Document(Data)
...
pretty stocked this lonely support and I suspect I'm missing an important aspect. Is there a recommanded way ? My google search were pretty un-successful.
Should I generate some kind of token with a first GET and then make a POST with body + token in anonymous ?
Do you have to use Windows authentication? How about using something like this with Anonymous authentication:
let
AuthKey = "mytoken",
url="http://xxxx/api/Query",
body = "{""json"" : ""payload""}",
Source = Json.Document(Web.Contents(url,[
Headers = [#"Authorization"=AuthKey ,
#"Content-Type"="application/json"],
Content = Text.ToBinary(body)
]
))
in
Source
Will this solve your problem?

gatling Form Parameters : How to pass custom form-data to post request

I am new to gatling scripting. I am trying to execute a performance testing against one of our application's POST api. This POST request API required to pass the form-data.
EG : Print-Screen of the postman collection of the request body
For that I have prepared a gatling code piece as below :
.exec(http("POST Explore JSON")
.post("/sunrise/explore_json/")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Referer", "https://example.com/sunrise/dashboard/dummy_dashboard/")
.header("x-csrftoken", "${csrf_token1}")
.queryParam("form_data","{\"slice_id\":4}")
//.formParam("form_data","datasource":"2__table") ----------> Tried Method 1
//.formParamSeq(Seq(("form_data", "datasource":"2__table"))) ----------> Tried Method 2
//.formParamMap(Map("form_data" -> "datasource":"2__table")) ----------> Tried Method 3
//.form("""form_data={"datasource":"2__table"}""") ----------> Tried Method 4
Unfortunately gatling is not passing the form data as I want,currently how gatling pass the form data is :
form_data: {"datasource":"2__table"}
The way I want to pass is : (Please note I have removed the ":" & the following "space")
form_data={"datasource":"2__table"}
I have tried many many ways, but I could not successfully pass form data as above
Is there any way that I can pass as form_data={"datasource":"2__table"} ?
Try this
.formParam("form_data", "{\"datasource\":\"2__table\"}")
I would like to share, how we have fixed this issue,I guess it is another way representing form_data ?
.exec(http("POST Explore JSON")
.post("/sunrise/explore_json/")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Referer","https://example.com/sunrise/dashboard/dummy_dashboard/")
.header("x-csrftoken", "${csrf_token1}")
.queryParam("form_data","{\"slice_id\":4}")
.bodyPart(StringBodyPart("form_data", s"""{"datasource":"2__table"}"""))
.check(status.is(200))
I was facing the same 'problem', you can try to use the '.formParam' after yours request.
For more information and examples look this:
Gatling Documentation: Form Parameters

How to pass a global variable to the HTTP body (form-data)?

I am currently using Katalon Studio (V 6.1.4) to test webservices and i am just starting with katalon.
My question is how can i pass a global variable to the HTTP body?
Thanks in advance
There is a detailed tutorial about this topic: https://docs.katalon.com/katalon-studio/docs/parameterize-a-web-service-object.html#query-parameters
You need to use code like this:
findTestObject('myTestObject', [('yourParam') : GlobalVariables.yourGlobalVar]))

Passing input parameters to API

I am creating a Yii2 project. But instead of writing the logics in the controller I am trying to call APIs from the controller as described here:
yii2-call-api-method-from-backend-controllers
Can I pass input parameters to the called API ? If so pls mention how to.
Thanks in advance
To add get parameters during api call, try:
$res = Yii::$app->runAction('api/user/get_call',['a'=>'sth','b' => 'sth_else']);
To add post parameters is a bit trickier. You have to set body parameters before call:
Yii::$app->request->setBodyParams(['a' => 'sth', 'b' => 'sth_else']);
$res = Yii::$app->runAction('api/user/post_call');

Got an error in the IBM Bluemix Weather Insights API used. Kindly help me out

I am referencing the documentation page here:
https://developer.ibm.com/bluemix/2015/10/23/ibm-insights-weather-available-in-bluemix/
But I'm getting the following error :
{"metadata":{"version":"1","transaction_id":"1:677162605","status_code":404},"success":
false,"errors":[{"error":{"code":"AGW-0114","message":"Failed to parse apiname"}}]}
My Constructed URL is :
https://****:*****#twcservice.mybluemix.net/api/weather/v2/forecast/&format=JSON&geocode=11.9310,%2079.7852&language=en-US&units=e
Kindly help me with this issue .
The constructed url needs to be like this:
https://twcservice.mybluemix.net/api/weather/v2/forecast/hourly/24hour?format=JSON&geocode=11.9310%2C79.7852&language=en-US&units=e
The differences are:
call the REST API /forecast/hourly/24hour rather than just /forecast
Add the ? at the end of the API so you pass the parameters
Add the %2C in the geocode to represent the ,
See swagger doc here