Hello all,
I'm trying to get informations from an external application using rest api calls.
the first thing I've to do is posting my credentials to get a session id. Then, i'll have to use this session id to make a new request.
I can authenticate and I'm receiving an answer , this is good.
but I've some problems trying to undersant how the answer build it and howto manage it.
So, first, here's the answer I receive after having done my post :
{
"statusCode": 200,
"headers": {
"Connection": "keep-alive",
"requestId": "e04170f7c88f4bcd7eadb86b9abd1ecd",
"Date": "Wed, 21 Jun 2023 06:11:06 GMT",
"Set-Cookie": "JSESSIONID=47A3ED11FCE1B1162965CF6C35B6581C; Path=/WebUntis; HttpOnly; Secure; SameSite=None,schoolname=\"_Z3ltX2JpZWwtYmllbm5l\"; Expires=Wed, 05-Jul-2023 06:11:06 GMT; Secure; SameSite=None",
"Server": "nginx",
"Pragma": "no-cache",
"Cache-Control": "no-store, must-revalidate, no-cache, pre-check=0, post-check=0",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Access-Control-Allow-Headers": "Accept, Origin, X-Requested-With, Content-Type, Last-Modified",
"Access-Control-Allow-Origin": "*",
"Content-Length": "134",
"Content-Type": "application/json-rpc; charset=UTF-8"
},
"body": {
"$content-type": "application/json-rpc; charset=UTF-8",
"$content": "eyJqc29ucnBjIjoiMi4wIiwiaWQiOiJBd2Vzb21lIiwicmVzdWx0Ijp7InNlc3Npb25JZCI6IjQ3QTNFRDExRkNFMUIxMTYyOTY1Q0Y2QzM1QjY1ODFDIiwicGVyc29uVHlwZSI6MiwicGVyc29uSWQiOjQxMjksImtsYXNzZUlkIjowfX0="
}
}
thanks to @lbendlin
So I added a 'Compose' action to get the body part of the answer and I received the 'decoded' version of the $content variable :
According to the answer, it seems that the compose action automatically decode the $content value ?
"base{\"jsonrpc\":\"2.0\",\"id\":\"Awesome\",\"result\":{\"sessionId\":\"47A3ED11FCE1B1162965CF6C35B6581C\",\"personType\":2,\"personId\":4129,\"klasseId\":0}}"
Next step is , beacause my idea is to really going step by step to understand what's happen for each operation. So I 'm trying to get the content of the 'result' object
I tried to add a new compose action with the following formula :
body('Compose')?['base']?['result']
or
body('Compose')?['result']
but the result is empty. According to the information of the previous step, the content is jsonrpc and not json. could it be the reason ? In this case, is there a way to convert jsonrpc to json ?
Thanks to all for your help .)