Logic Apps - When an HTTP request is received > Intialize variable

hbaw 21 Reputation points
2022-07-11T19:35:34.12+00:00

Hi,

I am struggling to initialise variables from the JSON response triggerbody. they return as null.

219625-screenshot-2022-07-11-at-202941.png

(1) When a HTTP Request is received (GET)

with JSON Schema:
{
"properties": {
"WorkType": {
"type": "string"
}
},
"type": "object"
}

(2) Initialize a variable..

219652-screenshot-2022-07-11-at-204150.png

        "Initialize_variable": {  
            "inputs": {  
                "variables": [  
                    {  
                        "name": "Test",  
                        "type": "string",  
                        "value": "@triggerBody()?['WorkType']"  
                    }  
                ]  
            },  

Output is null

I am sending objects by appending parameters in the JSON Schema to the url as below
https://azureprod?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0
&sig=sigkey
&WorkType=Personalproject
&Urgency=3
etc..

I need to extract several values from the JSON in this manner, performing a few functions and then packaging a response.

Thank you very much for your help as I am stumped

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
0 comments No comments
{count} votes

Accepted answer
  1. Kamlesh Kumar 3,866 Reputation points
    2022-07-12T03:30:53.143+00:00

    Hi @hbaw ,

    Welcome to Microsoft Q&A Platform. Thank you for the question.

    I would suggest to initialize the variable and then set the variable like below screenshot. And you have the JSON schema so you can add the fields and can use for several values.

    219629-image.png

    Regards,
    Kamlesh Kumar
    BizTalk Techie

    Please don't forget to click on 205836-130616-image.png or upvote 205759-130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is How

    Want a reminder to come back and check responses? Here is how to subscribe to a Notification

    If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.