Productsup
Platform API

Sites

List, create, copy, edit, and delete sites using the Platform API.

10 min read

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

FieldTypeDescription
projectIdintegerProject to list sites for

Get a site by its tag

GET https://platform-api.productsup.io/platform/v2/sites/<tagName>:<tagValue>

FieldTypeDescription
tagNamestringName of the tag for the site
tagValuestringValue 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>

FieldTypeDescription
siteIdintegerSite to retrieve

Response fields

FieldTypeDescription
successbooleanIndicates request status
SitesarrayList of sites

Site fields

FieldTypeDescription
idstringSite identifier
titlestringName of the site
statusstringSee site status values
project_idstringIdentifier of the project this site belongs to
import_schedulestringA cron entry that sets the scheduling for data import
id_columnstringName of the column used as an identifier
processing_statusstringStatus of the site's latest job (Running or Done)
created_atdateDate of creation
linksarraySee link fields
NameDescription
selfLink to the current site
tagsLink to the list of tags belonging to the site
projectLink to the project

Site status values

ValueDescription
activeThe site is fully operational. Data can be pushed via the API and the site imports and exports.
paused_uploadThe site can receive data and import it, but does not export.
disabledThe 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 day

When 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

FieldTypeDescription
projectIdintegerProject under which to add the site. Required unless set in the request body.

HTTP headers

NameValue
Content-Typeapplication/json

Request body fields

FieldTypeDescription
titlestringName of the site
referencestringTextual site reference, consisting of tagName:tagValue. Must be unique per account.
project_idintegerProject under which to add the site. Required unless provided in the URL.
id_columnstringColumn used as an identifier when importing data. Defaults to id if omitted. Pass an empty string to leave the identifier column unset.
statusstringSee site status values
import_schedulestringA 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

FieldTypeDescription
successbooleanIndicates request status
SitesarrayList 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

FieldTypeDescription
projectIdintegerProject that contains the site
siteIdintegerSite to edit

HTTP headers

NameValue
Content-Typeapplication/json

Request body fields

FieldTypeDescription
idintegerSite to edit
project_idintegerProject that contains the site
titlestringName of the site
id_columnstringColumn used as an identifier when importing data. Pass an empty string to leave the identifier column unset.
statusstringSee site status values
import_schedulestringA cron entry that sets the scheduling for data import

Response fields

FieldTypeDescription
successbooleanIndicates request status
SitesarrayList 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

FieldTypeDescription
siteIdintegerSite to delete

Response fields

FieldTypeDescription
successbooleanIndicates 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

FieldTypeDescription
siteIdintegerThe site whose configuration you are copying

HTTP headers

NameValue
Content-Typeapplication/json

Request body fields

FieldTypeDescription
site_namestringName of the new site
project_idstringProject to copy the site into. Defaults to the project of the source site.
copy_exportbooleanCopy all export configurations to the new site. Defaults to false.
copy_schedule_and_triggerbooleanCopy all schedules and triggers to the new site. Defaults to false.
copy_shared_settingbooleanCopy 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

On this page

Still stuck?

Reach out to our support team and we’ll help you get unstuck.

Contact support