How can I create a form, and create a task on a ClickUp task

1.6k Views Asked by At

For few days I am trying to use the ClickUp API. The goal is: We have a form, and when the form is submitted, it creates a task on a space on ClickUp.

It is a PHP form, and even with the API Doc here, I am not able to understand how it is working. I found this: https://jsapi.apiary.io/apis/clickup20/reference/0/tasks/create-task.html

But it requires some access token, from the user, but normally, It's not supposed to work like that.

Here the script that I have taken from the doc:

    <?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.clickup.com/api/v2/list/17229593/task");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_POSTFIELDS, "{
  \"name\": \"New Task Name\",
  \"content\": \"New Task Content\",
  \"assignees\": [
    183
  ],
  \"tags\": [
    \"tag name 1\"
  ],
  \"status\": \"Open\",
  \"priority\": 3,
  \"due_date\": 1508369194377,
  \"due_date_time\": false,
  \"time_estimate\": 8640000,
  \"start_date\": 1567780450202,
  \"start_date_time\": false,
  \"notify_all\": true,
  \"parent\": null,
  \"custom_fields\": [
    {
      \"id\": \"0a52c486-5f05-403b-b4fd-c512ff05131c\",
      \"value\": 23
    },
    {
      \"id\": \"03efda77-c7a0-42d3-8afd-fd546353c2f5\",
      \"value\": \"Text field input\"
    }
  ]
}");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Authorization: "access_token"",
  "Content-Type: application/json"
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);

When I try that, I get the error 500, and when I go to the API's link, I get an Auth problem.

Is someone know something about this API?

0

There are 0 best solutions below