Passing JSON inside the HTTP Request

Hello,
I am trying to connect to Jira by using their REST API. The application wizard works fine if I want to retrieve information from Jira using (GET).
But I need to create an Issue inside that instance for which I need to pass some JSON text (POST) . I tried using attachments and I tried to paste the json inside the body. Since both didn´t work I passed the JSON to a String variable by using a “Read text file” activity and then I added that variable with its data to the body of the http request.

How should I transfer that data to Jira? My question is also applicable to other instances: How should I pass a Json.txt inside UIPath to reach the API? Should I quote everything?

This is a sample JSON-Code Atlassian provides which can be passed. I of course adjusted it to my own project.

{
"update": {
    "worklog": [
        {
            "add": {
                "timeSpent": "60m",
                "started": "2011-07-05T11:05:00.000+0000"
            }
        }
    ]
},
"fields": {
    "project": {
        "id": "10000"
    },
    "summary": "something's wrong",
    "issuetype": {
        "id": "10000"
    },
    "assignee": {
        "name": "homer"
    },
    "reporter": {
        "name": "smithers"
    },
    "priority": {
        "id": "20000"
    },
    "labels": [
        "bugfix",
        "blitz_test"
    ],
    "timetracking": {
        "originalEstimate": "10",
        "remainingEstimate": "5"
    },
    "security": {
        "id": "10000"
    },
    "versions": [
        {
            "id": "10000"
        }
    ],
    "environment": "environment",
    "description": "description",
    "duedate": "2011-03-11",
    "fixVersions": [
        {
            "id": "10001"
        }
    ],
    "components": [
        {
            "id": "10000"
        }
    ],
    "customfield_30000": [
        "10000",
        "10002"
    ],
    "customfield_80000": {
        "value": "red"
    },
    "customfield_20000": "06/Jul/11 3:25 PM",
    "customfield_40000": "this is a text field",
    "customfield_70000": [
        "jira-administrators",
        "jira-software-users"
    ],
    "customfield_60000": "jira-software-users",
    "customfield_50000": "this is a text area. big text.",
    "customfield_10000": "09/Jun/81"
}

}

Can you try with replacing every " with “” and let me know ?

We tried a different approach and assigned the json like this to a variable which we added as the body to the http request:

“{ ““fields””: { ““project””: { ““key””: ““TEST”” }, … }}”

That´s how the json can be passed and it works

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.