Fetching tasks on SaaS offering via curl

Hi,

I’m trying to retrieve a simple task list from the Camunda Platform 8 Saas offering via curl.

Unfortunately, all examples call endpoints of local environments

So, do you have an example for the SaaS offering to retrieve the authentication token and then fetch the task list via curl?

Tobias

Hey @tobiasschaefer

I think the important part is this in the overview documentation

From Camunda Platform 8 onwards the endpoint is https://${REGION}.tasklist.camunda.io:443/${CLUSTER_ID}/graphql

Say your Zeebe address is: XXXX-YYY-WWW-ZZZ-5b4f0a64f311.bru-2.zeebe.camunda.io:443 then your region is bru-2 and the clusterId XXXX-YYY-WWW-ZZZ-5b4f0a64f311

For fetching the token you should use: ‘https://login.cloud.camunda.io/oauth/token

Like this:

curl -X POST --header 'content-type: application/json' --data '{"client_id": "<client-id>", "client_secret":"<client-secret>","audience":"<audience>","grant_type":"client_credentials"}' 'https://login.cloud.camunda.io/oauth/token'

Greets
Chris

1 Like

Hi @Zelldon ,

thanks - the missing part for me was the URL to fetch the token: https://login.cloud.camunda.io/oauth/token

In case someone is interested. This worked for me (replacing some data with …)

Fetch token:

curl -X POST --header 'content-type: application/json' --data '{"client_id": "p-LEeMzUR..........", "client_secret":"vMxvQtrswhwU........","audience":"tasklist.camunda.io","grant_type":"client_credentials"}' 'https://login.cloud.camunda.io/oauth/token'
{"access_token":"eyJhbGciOiJSUzI1NiIsInR5c.........","scope":"99a92e78-6a93-48fa-8663-0ea86c2f352f","expires_in":86400,"token_type":"Bearer"}

Fetch tasks:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5c........" -d '{"query": "{tasks(query:{}){name}}"}' https://bru-2.tasklist.camunda.io:443/99a92e78-6a93-........./graphql
{
  "data" : {
    "tasks" : [ {
      "name" : "Say Hello"
    }, {
      "name" : "Say Hello"
    }, {
      "name" : "Say Hello"
    }, {
      "name" : "Say Hello"
    }, {
      "name" : "Say Hello"
    } ]
  }
}

Cheers
Tobias

2 Likes