Queue

To queue a request with NextCron, simply send a POST request to the NextCron API with a JSON payload containing the job details. The API endpoint for publishing jobs is https://api.nextcron.co/v1/publish.

Here's an example using the Axios library in Node.js:

import axios from 'axios';

axios.post('https://api.nextcron.co/v1/publish', {
  "topic": "create-todo",
  "target": "https://webhook.site/07e28015-5be9-465d-8621-86d360706317",
  "method": "POST",
  "data": {
    "title": "foo",
    "body": "bar",
    "userId": 1
  }
}, {
  headers: {
    'X-NextCron-Token': "<insert_your_api_token>"
  }
});

You'll need to replace <insert_your_api_token> with your actual API key.

Once the request is queued, NextCron will forward it to the target URL using the same method, body, headers, and query parameters.

Last updated