Search code examples
azuremicrosoft-graph-apiazure-logic-appsworkflow-definition-language

How to use "@odata.id" in JSON body when using the HTTP action in Azure Logic Apps?


I'm using Azure Logic Apps to call out to the Microsoft Graph API using the HTTP - HTTP action. For this API I need to execute a POST request with the following body:

{
   "@odata.id": "<guid>"
}

When I try to save the Logic App, this error shows:

Failed to save logic app <redacted>. The template validation failed: 'The template action '<redacted>' at line '1' and column '144589' is not valid: "Unable to parse template language expression 'odata.id': expected token 'LeftParenthesis' and actual 'Dot'.".'.

How can I use this attribute in my JSON payload?

EDIT: as requested, a screenshot of the part of the Logic App that generates the error on Saving. dot in attribute triggers save error


Solution

  • From this article:

    Logic Apps workflow definitions with the Workflow Definition Language schema

    If you have a literal string that starts with the @ character, prefix the @ character with another @ character as an escape character: @@

    So in your case, this should work:

    {
      "@@odata.id": "your value here"
    }