Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create a new request via REST

Atlassianist
Contributor
August 10, 2023

Hallo, 

i would like to write a JSON-Body allowing me to create a new issue voa Postman ...

As a test I have read an existing request from the same Service Management Projekt I would like to create the request in ... 

=============

{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "10127",
"self": "https://myjirasystem/rest/api/2/issue/10127",
"key": "key-4",
"fields": {
"issuetype": {
"self": "https://myjirasystem/rest/api/2/issuetype/10101",
"id": "10101",
"description": "Von Jira Service Management erstellt.",
"iconUrl": "https://myjirasystem/secure/viewavatar?size=xsmall&avatarId=10641&avatarType=issuetype",
"name": "Serviceanfrage", [REQUESTED]
"subtask": false,
"avatarId": 10641
},
"timespent": 900,
"project": {
"self": "https://myjirasystem/rest/api/2/project/10203",
"id": "10203",
"key": "PROJECTNAME",
"name": "PROJECTNAME",
"projectTypeKey": "service_desk",
"avatarUrls": {
"48x48": "https://myjirasystem/secure/projectavatar?avatarId=10324",
"24x24": "https://myjirasystem/secure/projectavatar?size=small&avatarId=10324",
"16x16": "https://myjirasystem/secure/projectavatar?size=xsmall&avatarId=10324",
"32x32": "https://myjirasystem/secure/projectavatar?size=medium&avatarId=10324"
}
},
"customfield_10230": null,
"customfield_10231": [
{
"self": "https://myjirasystem/rest/api/2/user?username=sampleuser@maildomain.com",
"name": "sampleuser@maildomain.com",
"key": "JIRAUSER13520",
"emailAddress": "sampleuser@maildomain.com",
"avatarUrls": {
"48x48": "https://myjirasystem/secure/useravatar?ownerId=JIRAUSER13520&avatarId=10650",
"24x24": "https://myjirasystem/secure/useravatar?size=small&ownerId=JIRAUSER13520&avatarId=10650",
"16x16": "https://myjirasystem/secure/useravatar?size=xsmall&ownerId=JIRAUSER13520&avatarId=10650",
"32x32": "https://myjirasystem/secure/useravatar?size=medium&ownerId=JIRAUSER13520&avatarId=10650"
},
"displayName": "SAMPLEUSER",
"active": true,
"timeZone": "Europe/Berlin"
}
],
"fixVersions": [],
"customfield_10111": null,
"aggregatetimespent": 900,
"resolution": null,
"customfield_10310": {
"self": "https://myjirasystem/rest/api/2/customFieldOption/10307",
"value": "Monitoring",
"id": "10307",
"disabled": false
},
"customfield_10234": null,
"customfield_10225": null,
"customfield_10302": null,
"customfield_10226": null,
"customfield_10303": "INC1234567", [REQUESTED]
"customfield_10227": null,
"customfield_10304": "mailaddress", [REQUESTED]
"customfield_10107": "0|i000pr:",
"customfield_10305": "cellphone", [REQUESTED]
"customfield_10108": null,
"customfield_10306": "SITE", [REQUESTED]
"customfield_10109": null,
"customfield_10307": "Configuration ITEM", [REQUESTED]
"customfield_10308": "Service Name", [REQUESTED]
"resolutiondate": null,
"customfield_10309": "DESCRIPTION ", [REQUESTED]
"workratio": -1,
"lastViewed": null,
"watches": {
"self": "https://myjirasystem/rest/api/2/issue/PROJECTNAME-4/watchers",
"watchCount": 1,
"isWatching": false
},
"created": "2023-08-08T16:18:43.875+0200",
"customfield_10100": null,
"customfield_10221": null,
"priority": {
"self": "https://myjirasystem/rest/api/2/priority/4",
"iconUrl": "https://myjirasystem/images/icons/priorities/low.svg",
"name": "Niedrig",
"id": "4"
},
"customfield_10101": null,
"customfield_10222": null,
"customfield_10102": null,
"customfield_10223": null,
"customfield_10224": {
"errorMessage": "Sie sind nicht berechtigt, die Liste benutzerdefinierter SLA-Felder abzurufen",
"i18nErrorMessage": {
"i18nKey": "sd.sla.field.service.permission.error.fetch",
"parameters": []
}
},
"labels": [
"Stichwört"
],
"customfield_10103": null,
"customfield_10214": null,
"customfield_10215": null,
"customfield_10217": null,
"customfield_10218": null,
"timeestimate": 0,
"aggregatetimeoriginalestimate": null,
"versions": [],
"customfield_10219": null,
"issuelinks": [],
"assignee": {
"self": "https://myjirasystem/rest/api/2/user?username=assignee%40maildomain.com",
"name": "ASSIGNEE",
"key": "JIRAUSER13602",
"emailAddress": "assigne@maildomain.com",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/5df9710cbf12f9f956db0d936b8beb99?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/5df9710cbf12f9f956db0d936b8beb99?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/5df9710cbf12f9f956db0d936b8beb99?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/5df9710cbf12f9f956db0d936b8beb99?d=mm&s=32"
},
"displayName": "ASSIGNEE",
"active": true,
"timeZone": "Europe/Berlin"
},
"updated": "2023-08-08T16:18:43.929+0200",
"status": {
"self": "https://myjirasystem/rest/api/2/status/1",
"description": "Der Vorgang ist offen und bereit, dass der Bearbeiter mit der Arbeit daran beginnen kann.",
"iconUrl": "https://myjirasystem/images/icons/statuses/open.png",
"name": "Offen",
"id": "1",
"statusCategory": {
"self": "https://myjirasystem/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "default",
"name": "Zu erledigen"
}
},
"components": [],
"timeoriginalestimate": null,
"description": "Langbeschriebung / Description", [REQUESTED]
"customfield_10210": null,
"customfield_10211": null,
"customfield_10212": null,
"customfield_10213": null,
"archiveddate": null,
"timetracking": {
"remainingEstimate": "0h",
"timeSpent": "0,25h",
"remainingEstimateSeconds": 0,
"timeSpentSeconds": 900
},
"customfield_10203": null,
"customfield_10204": [],
"customfield_10205": null,
"customfield_10206": null,
"attachment": [],
"aggregatetimeestimate": 0,
"customfield_10208": null,
"customfield_10209": null,
"summary": "Kurzbeschreibung / Zusammenfassung", [REQUESTED]
"creator": {
"self": "https://myjirasystem/rest/api/2/user?username=AUTOR",
"name": "AUTOR",
"key": "JIRAUSER10000",
"emailAddress": "support@maildomain.com",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=32"
},
"displayName": "AUTOR",
"active": true,
"timeZone": "Europe/Berlin"
},
"subtasks": [],
"reporter": {
"self": "https://myjirasystem/rest/api/2/user?username=AUTOR",
"name": "AUTOR",
"key": "JIRAUSER13603",
"emailAddress": "AUTOR@maildomain.com",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/e59b2e031b703ebc4ff363f76615bc93?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/e59b2e031b703ebc4ff363f76615bc93?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/e59b2e031b703ebc4ff363f76615bc93?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/e59b2e031b703ebc4ff363f76615bc93?d=mm&s=32"
},
"displayName": "AUTOR",
"active": true,
"timeZone": "Europe/Berlin"
},
"customfield_10000": "{}",
"aggregateprogress": {
"progress": 900,
"total": 900,
"percent": 100
},
"customfield_10200": null,
"customfield_10201": null,
"customfield_10202": [
{
"self": "https://myjirasystem/rest/api/2/user?username=sampleuser@maildomain.com",
"name": "sampleuser@maildomain.com",
"key": "JIRAUSER13520",
"emailAddress": "sampleuser@maildomain.com",
"avatarUrls": {
"48x48": "https://myjirasystem/secure/useravatar?ownerId=JIRAUSER13520&avatarId=10650",
"24x24": "https://myjirasystem/secure/useravatar?size=small&ownerId=JIRAUSER13520&avatarId=10650",
"16x16": "https://myjirasystem/secure/useravatar?size=xsmall&ownerId=JIRAUSER13520&avatarId=10650",
"32x32": "https://myjirasystem/secure/useravatar?size=medium&ownerId=JIRAUSER13520&avatarId=10650"
},
"displayName": "SAMPLEUSER",
"active": true,
"timeZone": "Europe/Berlin"
}
],
"environment": null,
"duedate": "2023-03-01",
"progress": {
"progress": 900,
"total": 900,
"percent": 100
},
"comment": {
"comments": [],
"maxResults": 0,
"total": 0,
"startAt": 0
},
"votes": {
"self": "https://myjirasystem/rest/api/2/issue/PROJECTNAME-4/votes",
"votes": 0,
"hasVoted": false
},
"worklog": {
"startAt": 0,
"maxResults": 20,
"total": 1,
"worklogs": [
{
"self": "https://myjirasystem/rest/api/2/issue/10127/worklog/10104",
"author": {
"self": "https://myjirasystem/rest/api/2/user?username=AUTOR",
"name": "AUTOR",
"key": "JIRAUSER10000",
"emailAddress": "support@maildomain.com",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=32"
},
"displayName": "AUTOR",
"active": true,
"timeZone": "Europe/Berlin"
},
"updateAuthor": {
"self": "https://myjirasystem/rest/api/2/user?username=AUTOR",
"name": "AUTOR",
"key": "JIRAUSER10000",
"emailAddress": "support@maildomain.com",
"avatarUrls": {
"48x48": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=48",
"24x24": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=24",
"16x16": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=16",
"32x32": "https://www.gravatar.com/avatar/71ed2f8875cfbf350e86e197b5da78e1?d=mm&s=32"
},
"displayName": "AUTOR",
"active": true,
"timeZone": "Europe/Berlin"
},
"comment": "Arbeitsbeschriebung",
"created": "2023-08-08T16:18:43.829+0200",
"updated": "2023-08-08T16:18:43.829+0200",
"started": "2023-08-08T16:15:00.000+0200",
"timeSpent": "15m",
"timeSpentSeconds": 900,
"id": "10104",
"issueId": "10127"
}
]
},
"archivedby": null
}
}

================

I estimate that I can use the same JSON format and delete the fields / values which are not necessary ...

I have used [REQUESTED] where I think the fields are necessary ...

Is it correct / useful to create a JSON-BODY on this way?

Thank you for your opinion and reply. 

Regards

A.

 

 

 

 

 

2 answers

2 votes
Kai Becker
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 10, 2023

Hi @Atlassianist 

thanks for your question. Using the response from a get of an existing request is not recommended, as there will be a lot of fields and values, that are not necessary.

I would highly recommend starting with the base version from the documentation and add the additional fields you wish to set during create.

 

Kind regards,
Kai

Atlassianist
Contributor
August 10, 2023 edited

Hi Kai, 

do you have such a basic JSON-Body I could customise?

In the Docu I see the commands however no example for the entire JSON-Structure ...

{
"_expands": [
"participant",
"status",
"sla",
"requestType",
"serviceDesk"
],
"issueId": "107001",
"issueKey": "HELPDESK-1",
"requestTypeId": "11001",
"serviceDeskId": "10001",

Thank you very much for a small example ...

Best Regards

A.

Atlassianist
Contributor
August 10, 2023

I try to customise this example meant to be used in the cloud:

{
    "fields": {
        "project": {
            "id": "10205"
        },
        "summary": "Something's wrong",
        "issuetype": {
            "id": "10100"
        },
        "priority": {
            "id": "1"
        },
        "components": [
            {
                "id": "10000"
            }
        ],
        "customfield_10202": "sda/getithelp"
    }
}
Kai Becker
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 10, 2023

Hi @Atlassianist 

there is no need to set the issuetype as it it is derived from the customer request type.

The basic request should be the following:

{
"serviceDeskId": "10",
"requestTypeId": "25",
"requestFieldValues": {
"summary": "Request JSD help via REST",
"description": "I need a new mouse for my Mac"
}

 What are the field you want to fill during create? Best way would be to just look up their structure using your GET response and add them to the json

Atlassianist
Contributor
August 14, 2023

Thank you Kai, it has worked :-)

0 votes
Jasmine Flower
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 3, 2025 edited

It's better to start with Jira's API documentation and customize a minimal JSON instead of using a full response from an existing issue. FM WhatsApp download

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Upcoming Jira Service Management Events