Adding a JSON Body in a HTTP Request Body

Hello Everyone,
I have a JSON body like this:
{
“query”:{
“language”:“cmis”,
“query”:“select * from cmis:folder where cmis:creationDate >= ‘2023-07-14T00:00.00Z’ AND cmis:creationDate <= ‘2023-07-21T23:59.00Z’ AND CONTAINS(‘SITE:za’) order by cmis:creationDate ASC”
},
“paging”:{
“maxItems”:100000,
“skipCount”:0
},
“include”:[
“allowableOperations”,
“aspectNames”,
“properties”
]
}

And I have added it into a File and mapped it to JsonBody variable of type string then used the variable in the Body section

@julio.magaia
From your question, it’s not clear what the exact problem is. However, I’ll provide some general guidance on how to handle JSON in UiPath.

First, make sure your JSON is correctly formatted. The JSON you provided seems to have some special characters that might cause issues. Here’s a corrected version:

{
  "query": {
    "language": "cmis",
    "query": "select * from cmis:folder where cmis:creationDate >= '2023-07-14T00:00.00Z' AND cmis:creationDate <= '2023-07-21T23:59.00Z' AND CONTAINS('SITE:za') order by cmis:creationDate ASC"
  },
  "paging": {
    "maxItems": 100000,
    "skipCount": 0
  },
  "include": [
    "allowableOperations",
    "aspectNames",
    "properties"
  ]
}

To use this JSON in UiPath:

  1. Save the JSON in a text file. Make sure the file is saved with the .json extension.
  2. Use the Read Text File activity in UiPath to read the JSON file. This will store the JSON as a string in a variable.
  3. In the Properties panel of the Read Text File activity, set the Output property to a new variable. This will be the variable that holds your JSON string.
  4. Use this variable in the Body property of the HTTP Request activity.

Yes I did do as you suggest

But I get error 400 suggesting that the body is empty while it is not

That looks like Alfresco Search API :nerd_face:

Yes it is, why doesn’t work in this case?