How to pass JSON in HTTP POST request body?

I would like to pass the following JSON in HTTP request body. How do I do it ?

[
{
“uid”: “”,
“subscriptions”: [
{
“name”: “Dashboards_AverageRunningTime”
},
{
“name”: “Dashboards_DailyTotalJobs”
},
{
“name”: “Dashboards_DailyAverageQueuedTime”
},
{
“name”: “Dashboards_DailyTotalRunningTime”
},
{
“name”: “Dashboards_FailuresByWorkspace”
}
],
“repositories”: [
{
“name”: “Dashboards”
}
],
“cleanupTasks”: [
{
“name”: “Delete_Dashboard_Reports”,
“category”: “Utilities”
},
{
“name”: “Delete_Dashboard_Temp_Files”,
“category”: “Utilities”
}
],
“topics”: [
{
“name”: “SAMPLE_TOPIC”
}
],
“schedules”: [
{
“name”: “DashboardStatisticsGathering”,
“category”: “Dashboards”
}
],
“name”: “FME_PROJECT_TEST”,
“description”: “Test Project”,
“readme”: “readme”,
“workspaces”: [
{
“name”: “austinApartments.fmw”,
“repositoryName”: “Samples”
},
{
“name”: “austinDownload.fmw”,
“repositoryName”: “Samples”
},
{
“name”: “earthquakesextrusion.fmw”,
“repositoryName”: “Samples”
}
],
“version”: “1.0.0”,
“fmeHubPublisherUid”: “”
}
]

Thanks in advance

Hi @beyogish

Could you try like that:
TestPostHTTP.xaml (8.2 KB)

These are all the settings:


Your string needs to be formatted before it can be placed as the parameter:

  • it needs to be contained between two double quotes
  • each quote character needs to be escaped with another quote sign ""
  • no line breaks, it has to be one continuous string
"[{""uid"": """",""subscriptions"": [{""name"": ""Dashboards_AverageRunningTime""},{""name"": ""Dashboards_DailyTotalJobs""},{""name"": ""Dashboards_DailyAverageQueuedTime""},{""name"": ""Dashboards_DailyTotalRunningTime""},{""name"": ""Dashboards_FailuresByWorkspace""}],""repositories"": [{""name"": ""Dashboards""}],""cleanupTasks"": [{""name"": ""Delete_Dashboard_Reports"",""category"": ""Utilities""},{""name"": ""Delete_Dashboard_Temp_Files"",""category"": ""Utilities""}],""topics"": [{""name"": ""SAMPLE_TOPIC""}],""schedules"": [{""name"": ""DashboardStatisticsGathering"",""category"": ""Dashboards""}],""name"": ""FME_PROJECT_TEST"",""description"": ""Test Project"",""readme"": ""readme"",""workspaces"": [{""name"": ""austinApartments.fmw"",""repositoryName"": ""Samples""},{""name"": ""austinDownload.fmw"",""repositoryName"": ""Samples""},{""name"": ""earthquakesextrusion.fmw"",""repositoryName"": ""Samples""}],""version"": ""1.0.0"",""fmeHubPublisherUid"": """"}]"

And this is the output:
image

If I didn’t get everything right, I hope this post will at least make someone correct me :slight_smile:

5 Likes

If you want to keep the formatting of the original JSON structure that you posted, would suggest saving it to Text File then use the “Read Text File” Activity in order to get it into a String Variable and then the “Body” Property on the HTTP Activity to the String Variable. You could also use Place Holders within the JSON File {placeholderX} and that way you can easily parse it and replace the place holders with actual values.
It works for me! :slight_smile:

Hello,
Check out this very fast simple VB.NET that create JSON in 1 line:
startUiPathFromSalesforce/CreateJSON.txt at master · cristinegulescu/startUiPathFromSalesforce · GitHub
And the movie for demo:

Thanks,
Cristian