Skip to main content
POST
/
v1
/
custom-kpi-datasets
/
{dataset_id}
/
campaigns
Create Campaign
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    period_start: '2023-12-25',
    period_end: '2023-12-25',
    deadline: '2023-12-25',
    assignment_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
  })
};

fetch('https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/campaigns', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "period_start": "2023-12-25",
  "period_end": "2023-12-25",
  "deadline": "2023-12-25",
  "created_at": "2023-11-07T05:31:56Z",
  "locked_at": "2023-11-07T05:31:56Z",
  "created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "updated_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "updated_at": "2023-11-07T05:31:56Z",
  "campaign_assignments": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "campaign_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "assignment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "assignment": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "data_owner_email": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "facility_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "data_owner_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "updated_at": "2023-11-07T05:31:56Z"
      },
      "created_at": "2023-11-07T05:31:56Z",
      "last_invited_at": "2023-11-07T05:31:56Z",
      "status": "awaiting",
      "updated_at": "2023-11-07T05:31:56Z"
    }
  ]
}

Authorizations

x-api-key
string
header
required

Headers

x-organization-id
string
x-api-key
string
x-user-id
string

Path Parameters

dataset_id
string<uuid>
required

Body

application/json

Request schema for creating a new campaign within a dataset.

name
string
required

The campaign name.

Required string length: 1 - 255
period_start
string<date>
required
period_end
string<date>
required
deadline
string<date>
required
assignment_ids
string<uuid>[]

Subset of dataset assignments to link. Omit or leave empty to add recipients later.

Response

Successful Response

Campaign with the campaign-assignments included.

id
string<uuid>
required

The campaign id.

dataset_id
string<uuid>
required

The parent dataset id.

name
string
required
period_start
string<date>
required
period_end
string<date>
required
deadline
string<date>
required
created_at
string<date-time>
required
locked_at
string<date-time>
created_by
string<uuid>
updated_by
string<uuid>
updated_at
string<date-time>
campaign_assignments
CampaignAssignmentSch · object[]