How to call REST method

Hi,
I am trying to interact with Camunda through its REST interface, hence I would like to know if Camunda provide (official) REST client?

Hi,
according to what I know so far, there is no official rest api client for camunda, or some rest UI on the web.
But there are some other “sources”, take a look at this post.

Hope it helps.
Cheers,
Lukas

I came up with the following java code, but it does not seem to be right.
First of all, the documentation for task creation https://docs.camunda.org/manual/7.8/reference/rest/task/post-create/
does not tell me how to associate the newly created task to particular process. How do I create task for a give process?

public void createTask() {
    Client client = ClientBuilder.newClient();
    WebTarget webTarget = client.target(BASE_ADDRESS).path("engine-rest");
    
    String url = "task";
    TaskDto newTask = new TaskDto();
    newTask.setDescription("Test");

    String json = JSON(newTask).toString();

    Response response = webTarget.path(url).request().post(Entity.entity(json, MediaType.APPLICATION_JSON), Response.class);
    System.out.println("The status is " + response.getStatus());
}

I managed to have it working, but the question remains.
I guess I have to prepend process id to the webTarget path?

public static final String BASE_ADDRESS = “http://localhost:8080/engine-rest/”;

public void createTask() {
    Client client = ClientBuilder.newClient();
    WebTarget webTarget = client.target(BASE_ADDRESS);
    webTarget = webTarget.path("engine").path("default");
            
    String url = "task/create";
    TaskDto newTask = new TaskDto();
    newTask.setDescription("Test");

    String json = JSON(newTask).toString();

    Response response = webTarget.path(url).request().post(Entity.entity(json, MediaType.APPLICATION_JSON), Response.class);
    System.out.println("The status is " + response.getStatus());
}

We are currently building client api’s which are scheduled to be released with 7.9 end of May: https://camunda.com/learn/community/#roadmap

1 Like