It is possible to create a service through the api

Oliver Wood
Contributor
February 27, 2024

In the schemas i can see there is by default a Services schema, you add manually services to this or you can add services through service desk manually and they are pulled into this schema

what i cant do is to create a service via an api call, if i use the asset api i get a forbidden 403 and the  Services schema is locked and readonly.

Is there a way to create a service via an api call.

 

2 answers

0 votes
Samuel Weiss
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!
June 29, 2024

Yes, its possible with GraphQL.

https://developer.atlassian.com/platform/atlassian-graphql-api/graphql/ 

Here a sample:

mutation CreateService ($input:CreateDevOpsServiceInput!) {
createDevOpsService(input: $input) {
success
}
}

Variable:
{
"input": {
"cloudId": "yourCloudId-a457-4b6e-ac0b-....",
"name": "Name of Service",
"description": "Description",
"properties": [
{
"key": "stakeholders",
"value": {}
}
],
"serviceTier": {
"level": 3
},
"serviceType": {
"key": "BUSINESS_SERVICES"
}
}
}

 

0 votes
Zoey Wang
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2024

Hi @Oliver Wood 

 

This should be able to help you 

https://confluence.atlassian.com/jirakb/how-to-create-assets-objects-via-rest-api-based-on-different-attribute-type-1157475506.html  

shows step by step asset creation via REST api. 

Any other questions please call out. 

Oliver Wood
Contributor
February 28, 2024

Thank you very much for that, however i know i can create objects via api  to schemas i have created, but the Services(SVC) comes out of the box and when i try to create an object in that schema error i get a 403 forbidden error.

So my question was is it possible to create services in that schema via api or is it the fact that its locked down means it not possible to do so?

Keith Croxford
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!
April 9, 2024

I'm running into the same problem.  403 with this type of error response

{"errorMessages":["Sorry, you do not have permission to perform this action. PermissionInsightException: User REDACTED didn't have correct permission (create object) for object type: NUMBER"],"errors":{}}

Keith Croxford
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!
April 9, 2024

Based on some web request captures, I do see that it is possible to use the graph API  ( operationName":"gqlJiraJsmServicesCreateDevOpsServiceMutation") to POST and create the service object, however I cannot find any documentation that shows this as a supported approach. 

 

 

Zoey Wang
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 9, 2024

Hi @Oliver Wood / @Keith Croxford 

It may be possible to post Services via Opsgenie Service API.

Haven't tried that before.

Please note: "Create service request is used to add new services for teams and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted."

Hope it helps.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events