Camunda Platform REST API

Goal

In this lab you will get to know the REST API provided by Camunda Platform by using a REST client. The list of all API calls is in the docs.

Users who are experienced with a REST client can skip this exercise and do exercise 11 with the REST API.

Short description

  • Open a rest client and get all process definitions.
  • Start a process instance of the Twitter-QA process.
  • Query for tasks.
  • Claim and complete the tasks.
  • Check the result on Twitter.
  • Check the completed process instance.

Detailed steps

  1. Download, install, and open a REST client like Postman: www.getpostman.com/ for Chrome or RESTClient for Firefox: German, English

  2. The entry point for the REST API is: localhost:8080/engine-rest/ which you’ll use as your base URL.

  3. Query for all process definitions with a GET request to ensure that the Twitter QA Process is available. Camunda Docs Reference to GET Process Definitions. For GETs you can also simply put the REST API URL in a browser http://localhost:8080/engine-rest/process-definition though the response won’t be as nicely formatted. You should see a JSON response with all of the process definitions along with each version that has been deployed:

       [
           {
               "id": "TwitterQA:1:495e4a7a-5007-11e9-9b72-00155db2b504",
               "key": "TwitterQA",
               "category": "http://bpmn.io/schema/bpmn",
               "description": null,
               "name": "TwitterQA",
               "version": 1,
               "resource": "Your name - Exercise 1.bpmn",
               "deploymentId": "4942d338-5007-11e9-9b72-00155db2b504",
               "diagram": null,
               "suspended": false,
               "tenantId": null,
               "versionTag": null,
               "historyTimeToLive": null,
               "startableInTasklist": true
           }
           ]
    
  4. Using POST, start a process instance of the latest version and pass in the content variable. Camunda Docs Reference to POST Start Process. Your POST should look something like this (Postman screen shot). Be sure to use a Content-Type of application/json in the Header.

  5. Take a look either in Tasklist or Cockpit to ensure a process has been started via REST.

  6. Use a GET request to query for the user task of the process instance. Camunda Docs Reference to GET Tasks. Did you find the task?

  7. Be sure to copy the id of the task you want to claim from the response of the previous task query REST API call. Use the id in the POST request to claim the task for the user demo. Camunda Docs Reference to POST Claim a task. The user id is passed in as a JSON object in the Body of a request. Remember how to do that? If the call was successful you’ll get a 204 response code.

  8. Use a POST request to complete the task using the id from earlier. Be sure pass in the approved boolean variable as a JSON object in the Body of the request. Camunda Docs Reference to POST Complete a task. Be sure to check the documentation for the proper JSON object format.

  9. Check the result on Twitter. Did the tweet get published?

  10. Use a GET request to see the completed process instance history. Camunda Docs Reference to GET Process instance history. Now you’re familiar with Camunda REST APIs.

On this Page: