Sites
List, create, copy, edit, and delete sites using the Platform API.
A site is the smallest entity in the platform hierarchy, below projects. Each site has one data source and can have multiple exports and channels.
Get
Use a GET request to list all sites in your account or retrieve a specific site.
Get all sites for your account
GET https://platform-api.productsup.io/platform/v2/sites
curl https://platform-api.productsup.io/platform/v2/sites{
"success": true,
"Sites": [
{
"id": "123",
"title": "site 1",
"created_at": "2015-01-01 11:22:33",
"project_id": "321",
"links": [...]
},
...
]
}Get all sites for a specific project
GET https://platform-api.productsup.io/platform/v2/projects/<projectId>/sites
| Field | Type | Description |
|---|---|---|
projectId | integer | Project to list sites for |
Get a site by its tag
GET https://platform-api.productsup.io/platform/v2/sites/<tagName>:<tagValue>
| Field | Type | Description |
|---|---|---|
tagName | string | Name of the tag for the site |
tagValue | string | Value of the tag for the site |
See Site tags for more information about managing tags.
Get a site by its identifier
GET https://platform-api.productsup.io/platform/v2/sites/<siteId>
| Field | Type | Description |
|---|---|---|
siteId | integer | Site to retrieve |
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates request status |
Sites | array | List of sites |
Site fields
| Field | Type | Description |
|---|---|---|
id | string | Site identifier |
title | string | Name of the site |
status | string | See site status values |
project_id | string | Identifier of the project this site belongs to |
import_schedule | string | A cron entry that sets the scheduling for data import |
id_column | string | Name of the column used as an identifier |
processing_status | string | Status of the site's latest job (Running or Done) |
created_at | date | Date of creation |
links | array | See link fields |
Links fields and values
| Name | Description |
|---|---|
self | Link to the current site |
tags | Link to the list of tags belonging to the site |
project | Link to the project |
Site status values
| Value | Description |
|---|---|
active | The site is fully operational. Data can be pushed via the API and the site imports and exports. |
paused_upload | The site can receive data and import it, but does not export. |
disabled | The site blocks any data sent via the API. Neither imports nor exports run. |
Cron entry
The scheduling format consists of an optional timezone and one or more scheduling expressions. If no timezone is provided, the platform uses its default timezone. All PHP timezones are supported. Separate the timezone and schedule entries with newline characters. To remove a schedule, supply an empty value.
TZ=Europe/Berlin
H 2,6,19,22 * * 2,4,6 # Run at 02:XX, 06:XX, 16:XX, and 19:XX on Tuesday, Thursday, and Saturday
H * * * * # Run at a random minute every hour
1 3,8,21 */2 * * # Run at 03:01, 08:01, and 21:01 every second dayWhen submitting the schedule via the API, encode newlines as \n:
TZ=Europe/Berlin\nH 2,6,19,22 * * 2,4,6\nH * * * *\n1 3,8,21 */2 * *The H value in the minute position assigns a random minute. Use H for all schedules to avoid bottlenecks caused by multiple jobs starting at the same time.
The cron format is limited to what the platform supports. To retrieve the string representation of a schedule you configured manually in the platform, send a GET request to the site and inspect the import_schedule attribute.
Create
Use a POST request to create a new site.
curl -d '{"title":"example site","reference":"myReferenceKey:myReference1234","id_column":"uniqueIdentifier","import_schedule":"8 * * * *"}' \
https://platform-api.productsup.io/platform/v2/projects/321/sites{
"success": true,
"Sites": [{
"id": 125,
"title": "example site",
"created_at": "2015-07-30 12:54:52",
"project_id": 321,
"import_schedule": "8 * * * *",
"links": [...]
}]
}Create site
POST https://platform-api.productsup.io/platform/v2/sites
POST https://platform-api.productsup.io/platform/v2/projects/<projectId>/sites
URL parameters
| Field | Type | Description |
|---|---|---|
projectId | integer | Project under which to add the site. Required unless set in the request body. |
HTTP headers
| Name | Value |
|---|---|
Content-Type | application/json |
Request body fields
| Field | Type | Description |
|---|---|---|
title | string | Name of the site |
reference | string | Textual site reference, consisting of tagName:tagValue. Must be unique per account. |
project_id | integer | Project under which to add the site. Required unless provided in the URL. |
id_column | string | Column used as an identifier when importing data. Defaults to id if omitted. Pass an empty string to leave the identifier column unset. |
status | string | See site status values |
import_schedule | string | A cron entry that sets the scheduling for data import |
The id and created_at fields must be empty in the request body. Providing values for these fields either overwrites them or causes an error.
References and site tags
A reference lets you use a textual identifier of your choice for a site, so you do not need to store the numeric site ID. A reference consists of a tagName and a tagValue in the format tagName:tagValue.
See Site tags for examples of managing tags.
The reference for a site must be unique across your account.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates request status |
Sites | array | List of sites |
Edit
Use a PUT request to edit an existing site.
curl -d '{"id":1,"project_id":1,"title":"My test site","import_schedule":"TZ=Europe/Berlin\nH 2,6,19,22 * * 2,4,6"}' \
https://platform-api.productsup.io/platform/v2/projects/1/sites/1{
"success": true,
"Sites": [{
"id": 1,
"title": "My test site",
"created_at": "2015-07-30 12:54:52",
"project_id": 1,
"import_schedule": "TZ=Europe\/Berlin\nH 2,6,19,22 * * 2,4,6\nH * * * *",
"links": [...]
}]
}Update site
PUT https://platform-api.productsup.io/platform/v2/sites/<siteId>
PUT https://platform-api.productsup.io/platform/v2/projects/<projectId>/sites/<siteId>
URL parameters
| Field | Type | Description |
|---|---|---|
projectId | integer | Project that contains the site |
siteId | integer | Site to edit |
HTTP headers
| Name | Value |
|---|---|
Content-Type | application/json |
Request body fields
| Field | Type | Description |
|---|---|---|
id | integer | Site to edit |
project_id | integer | Project that contains the site |
title | string | Name of the site |
id_column | string | Column used as an identifier when importing data. Pass an empty string to leave the identifier column unset. |
status | string | See site status values |
import_schedule | string | A cron entry that sets the scheduling for data import |
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates request status |
Sites | array | List of sites |
Delete
Delete site
DELETE https://platform-api.productsup.io/platform/v2/sites/<siteId>
curl -X DELETE https://platform-api.productsup.io/platform/v2/sites/125{"success":true}URL parameters
| Field | Type | Description |
|---|---|---|
siteId | integer | Site to delete |
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates the success of the action |
Copy
Use a POST request to copy a site's configuration to a new site.
curl --location --request POST 'https://platform-api.productsup.io/platform/v2/sites/1/copy' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: value' \
--data-raw '{
"site_name": "example copy site",
"project_id": "2",
"copy_export": true,
"copy_schedule_and_trigger": true,
"copy_shared_setting": true
}'{
"success": true,
"Sites": [{
"id": "2",
"title": "example copy site",
"created_at": "2023-07-27 12:54:52",
"project_id": "2",
"import_schedule": "8 * * * *",
"links": [...]
}]
}Copy site
POST https://platform-api.productsup.io/platform/v2/sites/<siteId>/copy
URL parameters
| Field | Type | Description |
|---|---|---|
siteId | integer | The site whose configuration you are copying |
HTTP headers
| Name | Value |
|---|---|
Content-Type | application/json |
Request body fields
| Field | Type | Description |
|---|---|---|
site_name | string | Name of the new site |
project_id | string | Project to copy the site into. Defaults to the project of the source site. |
copy_export | boolean | Copy all export configurations to the new site. Defaults to false. |
copy_schedule_and_trigger | boolean | Copy all schedules and triggers to the new site. Defaults to false. |
copy_shared_setting | boolean | Copy the data flow configuration to the new site. Applies only to sites that subscribe to elements from another site (consumer sites). Defaults to false. |
Response fields
See response fields and site fields.
How is this guide?