Choose your language:
    Promote an environment to primary
    Returns
    Returns a environment object.

    Examples

    Example code:
    const SiteClient = require('datocms-client').SiteClient;
    const client = new SiteClient('YOUR-API-TOKEN');
    const environmentId = 'main';
    client.environment.promote(environmentId)
    .then((environment) => {
    console.log(environment);
    })
    .catch((error) => {
    console.error(error);
    });
    Returned output:
    > node example.js
    {
    "id": "main",
    "meta": {
    "status": "ready",
    "created_at": "2020-04-21T07:57:11.124Z",
    "last_data_change_at": "2020-04-21T07:57:11.124Z",
    "primary": true
    }
    }