Hi
I am using graphql and the Atlassian Developer to perform two main tasks:
1. Extract details of a given Goal and a given Metric showing a Custom Field
2. Update a Metric Performance
The eventual objective is to automate the update of Metrics from our Business Metrics held in google sheets.
My first problem is trying to access the list of Custom Fields and identify the custom field I need to update.
I have the following GraphQL which extracts a given Goal (I have obscured the ARI):
query GoalQuery2 {
goals_byIds(goalIds: "ari:cloud:townsquare:xxxxxxxxx:goal/55541a4f-7a34-4d10-9170-154ea141cf2b") @optIn(to: "Townsquare")
{
name
status {
value
}
progress {
percentage
type
}
}
}
The above works and produces the following result:
{
"data": {
"goals_byIds": [
{
"name": "Increase new customers who graduate to paying subscribers",
"status": {
"value": "pending"
},
"progress": {
"percentage": 0.04713804713804714,
"type": "AVERAGE_SUCCESS_MEASURE_ROLLUP"
}
}
]
},
"extensions": {
"gateway": {
"request_id": "db620beb-37d4-4bf9-a9f5-5d3eff47b9c2",
"trace_id": "db620beb37d44bf9a9f55d3eff47b9c2",
"crossRegion": false,
"edgeCrossRegion": false
}
}
When I then include the code to pull the Custom Field
query GoalQuery2 {
goals_byIds(goalIds: "ari:cloud:townsquare:xxxxxxxgoal/55541a4f-7a34-4d10-9170-154ea141cf2b")
@optIn(to: "Townsquare")
{
name
status {
value
}
progress {
percentage
type
}
customFields {
edges {
node
}
}
}
}
It fails as follows:
{
"errors": [
{
"message": "Validation error (SubselectionRequired@[goals_byIds/customFields/edges/node]) : Subselection required for type 'TownsquareCustomField' of field 'node'",
"locations": [
{
"line": 14,
"column": 10
}
],
"extensions": {
"classification": "ValidationError",
"errorSource": "GRAPHQL_GATEWAY",
"statusCode": 400
}
}
],
"extensions": {
"gateway": {
"request_id": "4c790695-6aa3-495c-90a9-5d4e7f781c18",
"trace_id": "4c7906956aa3495c90a95d4e7f781c18",
"crossRegion": false,
"edgeCrossRegion": false
}
}
}
Can you help me to find the correct syntax please?
Also another second question:
2. I could only get the code above to work based on the Goal UUID which is hard for me to find (I had to use a web browser in dev mode to find it). Is there an easier way to run a graphQL to list all Goals Key and then use that? Or is there a way in graphQL to list all the Goals UUID?
Thank you for any help you can give