web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trying to understand t...
Power Automate
Answered

Trying to understand the RESP API process but need help to understand 1-2 points

(0) ShareShare
ReportReport
Posted on by 331

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 .)

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    I think if you just replace the "base" and " forward slash" with empty string, you should get a JSON string. Try this expression

     

    json(replace(replace(outputs('Compose_2'),'\',''),'base',''))

     

    SudeepGhatakNZ_0-1687396332573.png

     

     

  • forstera Profile Picture
    331 on at

    hello @SudeepGhatakNZ  and thanks very much for your help.

     

    In the meantime, I've found a solution. Your proposition goes in the same way. If I correctly understand, I can't work directly with  a json-rpc object. So I need to convert it first.
    I tried your solution but I got the following error :

    InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Object'.

     

    I tried with the following function and it worked :

    string(outputs('HTTP')?['body'])

    With that, I got an object I was able to parse but I wonder if there's a better way because I need 3 operations to retrieve my information ...

    forstera_0-1687408682053.png

    Thanks for your help 🙂

  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    @forstera ,

    The output of http action is an object, so yes, in your case the following expression should be used

     

    string(outputs('HTTP')?['body'])

     

     You can extract the session id with just one expression

     

    outputs('HTTP')?['body']['result']['sessionid']

     

  • forstera Profile Picture
    331 on at

    @SudeepGhatakNZ  Thanks very much. So I made a test :

    The output of my HTTP request is the following :

     "statusCode": 200,
     "headers": {
     "Connection": "keep-alive",
     "requestId": "6d07589e7da5e0e02961e84570b2da70",
     "Date": "Thu, 22 Jun 2023 04:54:16 GMT",
     "Set-Cookie": "JSESSIONID=EE8DBC905D5A74B58389FF99BAAC7023; Path=/WebUntis; HttpOnly; Secure; SameSite=None,schoolname=\"_Z3ltX2JpZWwtYmllbm5l\"; Expires=Thu, 06-Jul-2023 04:54:16 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": "eyJqc29ucnBjIjoiMi4wIiwiaWQiOiJBd2Vzb21lIiwicmVzdWx0Ijp7InNlc3Npb25JZCI6IkVFOERCQzkwNUQ1QTc0QjU4Mzg5RkY5OUJBQUM3MDIzIiwicGVyc29uVHlwZSI6MiwicGVyc29uSWQiOjQxMjksImtsYXNzZUlkIjowfX0="
     }
    }

    So I tried your propostion :

    outputs('HTTP')?['body']['result']['sessionid']

     but I get the following error  (content should be converted first ? ) :

    Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language expression 'outputs('HTTP')?['body']['result']['sessionid']' cannot be evaluated because property 'result' doesn't exist. 
    Property selection is not supported on content of type 'application/json-rpc; 

    Thanks for your help 🙂

     

  • Verified answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    @forstera , correction

    json(string(outputs('HTTP')?['body']))['result']['sessionid']

     

  • forstera Profile Picture
    331 on at

    @SudeepGhatakNZ  thank you very much for your help.

    I already tried your solution and if I remember I could not make a

     

    outputs('Compose_3')?['body']['result']['sessionid']

     

    on a string object. So I made the following :

    forstera_0-1687411591768.png

    json(string(outputs('HTTP')?['body']))

    and then

    forstera_1-1687411618380.png

    and I got my information

    I tried to make the whole in 1 operation but it failed ...

     

     

  • forstera Profile Picture
    331 on at

    hello @SudeepGhatakNZ  and sorry, I didn't see your correction .

    This one is working very fine, thanks very much for your help

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard