Choose your language:
    Update a collaborator
    Parameters
    isActive  boolean  Optional

    Whether the user is active or not

    role  role.id  Required

    Role

    Returns
    Returns a user object.

    Examples

    Example code:
    const { SiteClient } = require('datocms-client');
    async function run() {
    const client = new SiteClient('YOUR-API-TOKEN');
    const userId = '312';
    const user = await client.user.update(userId, {
    isActive: true,
    role: '34'
    });
    console.log(user);
    }
    run();
    Returned output:
    > node example.js
    {
    "id": "312",
    "email": "mark.smith@example.com",
    "is2faActive": true,
    "fullName": "Mark Smith",
    "isActive": true,
    "meta": {
    "last_access": "2018-03-25T21:50:24.914Z"
    },
    "role": "34"
    }