How to pass CloudId to GraphQL mutation
Asked by Denis Rousselle:

#### Hello,
<br />
In order to speed up the creation of Jira projects and Confluence spaces, I generated the following mutation: {#toc-hId-372573450}

mutation ConfluenceLegacy_createSpace{  

confluenceLegacy_createSpace (  

input: {  

additionalSettings: {  

jiraProject: {  

jiraProjectKey: "DOAGRAPQLT"  

jiraProjectName: "GraphQL Test"  

jiraServerId: "ari:cloud:jira:\<cloudID\>"  

}  

spaceTypeSettings: {  

enabledContentTypes: {  

isBlogsEnabled: true  

isDatabasesEnabled: true  

isEmbedsEnabled: true  

isFoldersEnabled: true  

isLivePagesEnabled: true  

isWhiteboardsEnabled: true  

}  

enabledFeatures: {  

isAnalyticsEnabled: true  

isAppsEnabled: true  

isAutomationEnabled: true  

isCalendarsEnabled: true  

isContentManagerEnabled: true  

isQuestionsEnabled: false  

isShortcutsEnabled: true  

}  

}  

}  

copySpacePermissionsFromSpaceKey: "TEMPLATE"  

initialPermissionOption: COPY_FROM_SPACE  

spaceKey: "DOAGRAPQLT"  

spaceName: "GraphQL Test"  

spaceTemplateKey: "TEMPLATE"  

}  

) @optIn(to: "ConfluenceLegacyRN") {  

containsExternalCollaborators  

creatorAccountId  

dataClassificationTags  

defaultClassificationLevelId  

externalCollaboratorAndGroupCount  

externalCollaboratorCount  

hasDefaultClassificationLevel  

homepageId  

id  

isExportEnabled  

key  

name  

status  

totalBlogpostsWithoutClassificationLevelOverride  

totalContentWithoutClassificationLevelOverride  

totalPagesWithoutClassificationLevelOverride  

type  

admins(accountType: CUSTOMER) {  

displayName  

operations {  

operation  

targetType  

links {  

base  

context  

}  

}  

permissionType  

}  

}  

}  

#### But I have an error, the cloud id is missing {#toc-hId--1434881013}

<br />

```

{

    "errors": [

        {

            "message": "Cannot route request: cannot extract cloud id",

            "locations": [],

            "extensions": {

                "service": "confluence_legacy",

                "errorSource": "GRAPHQL_GATEWAY",

                "statusCode": 400,

                "agg": {

                    "severity": "NORMAL",

                    "ugcPiiSafe": true

                },

                "classification": "CloudIdIsMissingException"

            }

        }

    ],

    "data": {

        "confluenceLegacy_createSpace": null

    },

    "extensions": {

        "gateway": {

            "request_id": "efc8ca8d15f541c0a28e0359ef62eb04",

            "crossRegion": false,

            "edgeCrossRegion": false

        }

    }

}
```

#### The GraphQL schema does not appear to require a cloudId field
<br />
![GraphQL space create.png](/t5/image/serverpage/image-id/345509i02A86B019B545DFD/image-size/large?v=v2&px=999 "GraphQL space create.png")
Is there a special way to pass the cloud Id when mutating with GraphQL? {#toc-hId-1052631820}

#### I tried several ways and I still get the same error.
Can someone help me? {#toc-hId--754822643}

#### Thank you {#toc-hId-1732690190}


Answers:
author: Oliver Siebenmarck _Polymetis Apps_
body: Hi [@Denis Rousselle](/t5/user/viewprofilepage/user-id/4235023) ,

I cannot resist a good GraphQL puzzle, so I spent some time with this. I believe you're not doing anything wrong really, much rather it could be that this particular mutation is not working currently. To quote the documentation:
> The field is extremely unstable. It can go through changes at any moment, and its execution can be slow and/or unreliable. Clients should use it with care and at their own risk

While I've found Atlassian's REST APIs to be generally quite stable, [even when called 'beta'](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#version), when they say something is experimental in GraphQL, they really mean it.

That being said: I believe you're trying to use GraphQL to create a related space in Confluence, let me offer a different solution that might also work for you:

```
mutation createConfluenceRelationship($fromAri: ID!, $toAri: ID!) {
 devOps {
  ariGraph {
   createRelationships(
    input: {
     relationships: {
      type: "project-documentation-entity", 
      from: $fromAri, 
      to: $toAri
     }
    }
   )
   {
    success
    errors {
     message
    }
   }
  }
 }
}
```

The $fromAri and $toAri would be Jira and Confluence respectively. Not sure if this is a perfect fit for your case, but hopefully it gets you going into the right direction.

Best regards,  
Oliver


author: Denis Rousselle
body: I wonder if this part of GraphQL is not addressed to Jira Server, it's still strange to have one and the same place to use both versions


Tags: cloud

graphql

id

jira-cloud