Scheduling asynchronous jobs

Endpoints

Requests should be sent to

https://us1.pusherplatform.io/services/chatkit_scheduler/v1/:instance_id

appended with the right endpoint for the resource you're interested in. Your instance ID is available from your application dashboard. It is the third component of your instance locator, for examplev1:us1:your-instance-id.

Delete a user

This endpoint requires a su token, more information on tokens can be found here.

PUT /users/:user_id

Users are deleted through an asynchronous delete job. When submitting a request to this endpoint, a job will be created which will perform the resource deletion in the background. See the core concepts for more details on deletion.

Response body

{
  "id": "some_id",
  "status": "in_progress"
}

A JSON object containing the following keys:

  • id: the id of the newly-created job. This can be used to query the status of the delete job.
  • status: the current status of the job.

Note that a successful response does not mean the resource has been deleted. The resource will be completely deleted when the status of the job is "completed".

Response codes

200400404503

Example request

curl -X PUT \
https://us1.pusherplatform.io/services/chatkit_scheduler/v1/:instance_id/users/:user_id

Delete a room

This endpoint requires a su token, more information on tokens can be found here.

PUT /rooms/:room_id

Rooms are deleted through an asynchronous delete job. When submitting a request to this endpoint, a job will be created which will perform the resource deletion in the background. See the core concepts for more details on deletion.

Response body

{
  "id": "some_id",
  "status": "in_progress"
}

A JSON object containing the following keys:

  • id: the id of the newly-created job. This can be used to query the status of the delete job.
  • status: the current status of the job.

Note that a successful response does not mean the resource has been deleted. The resource will be completely deleted when the status of the job is "completed".

Response codes

200400404503

Example request

curl -X PUT \
https://us1.pusherplatform.io/services/chatkit_scheduler/v1/:instance_id/users/:user_id

Job status

This endpoint requires a su token, more information on tokens can be found here.

GET /status/:job_id

You can query the status of a job by passing in the job id returned when requesting the resource deletion. The status can be one of:

  • in_progress: The job is still in progress. In this state the resource cannot be updated, but some remnants, such as messages, may still be visible.
  • completed: The job is completed, and no trace of the resource remains.
  • failed: An internal failure caused the deletion of the resource to fail. You may repost the job for re-processing.

Response body

{
  "id": "some_id",
  "status": "in_progress"
}

A JSON object containing the following keys:

  • id: the id of the newly-created job. This can be used to query the status of the delete job.
  • status: the current status of the job.

Response codes

200400404503

Example request

curl -X GET \
https://us1.pusherplatform.io/services/chatkit_scheduler/v1/:instance_id/status/:job_id