Link Search Menu Expand Document

Updated Thu Sep 23rd 2021, 14:49 UTC

Update User

PUT /users/:user

Note: This endpoint is still under active development, and may change without warning.

Updating a user

Examples

Updating another user as an admin

Request

PUT /users/PWApBE3

Body

{
  "name": "Not Chuck",
  "email": "not+chuck@textus.example",
  "settings": {
    "notifications": {
      "email": true,
      "audio": true
    }
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/PWApBE3
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true,
      "audio": true
    },
    "customSettings": {}
  },
  "memberships": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/users/wqyODPA/memberships",
    "members": [
      {
        "@type": "Membership",
        "@context": "/contexts/Membership.jsonld",
        "id": "/users/wqyODPA/memberships/PWApBE3",
        "role": "user",
        "user": "/users/wqyODPA",
        "account": {
          "@type": "Account",
          "@context": "/contexts/Account.jsonld",
          "id": "/accounts/my_account",
          "name": "Example Account"
        }
      }
    ],
    "totalItems": 1
  }
}

Adding a membership to another user as an admin

Request

PUT /users/PWApBE3

Body

{
  "name": "Not Chuck",
  "email": "not+chuck@textus.example",
  "memberships": [
    {
      "role": "user",
      "account": "/accounts/my_account"
    },
    {
      "role": "support",
      "account": "/accounts/my_account_child"
    }
  ]
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/PWApBE3
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true
    },
    "customSettings": {}
  },
  "memberships": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/users/PWApBE3/memberships",
    "members": [
      {
        "@type": "Membership",
        "@context": "/contexts/Membership.jsonld",
        "id": "/users/PWApBE3/memberships/jVq0Kwz",
        "role": "user",
        "user": "/users/PWApBE3",
        "account": {
          "@type": "Account",
          "@context": "/contexts/Account.jsonld",
          "id": "/accounts/my_account",
          "name": "Example Account"
        }
      },
      {
        "@type": "Membership",
        "@context": "/contexts/Membership.jsonld",
        "id": "/users/PWApBE3/memberships/AP1yemE",
        "role": "support",
        "user": "/users/PWApBE3",
        "account": {
          "@type": "Account",
          "@context": "/contexts/Account.jsonld",
          "id": "/accounts/my_account_child",
          "name": "My Account Child"
        }
      }
    ],
    "totalItems": 2
  }
}

Removing a membership from a user as an admin

Request

PUT /users/PWApBE3

Body

{
  "name": "Not Chuck",
  "email": "not+chuck@textus.example",
  "memberships": []
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/PWApBE3
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true
    },
    "customSettings": {}
  },
  "memberships": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/users/PWApBE3/memberships",
    "members": [],
    "totalItems": 0
  }
}

Updating ones own user profile

Request

PUT /users/wqyODPA

Body

{
  "name": "Chuck Norris",
  "email": "chuck@textus.example",
  "notifications": {
    "email": false,
    "audio": false
  },
  "defaultMessagingAccount": "my_account",
  "settings": {
    "notifications": {
      "email": false,
      "audio": false
    }
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/wqyODPA
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": false,
      "audio": false
    },
    "customSettings": {},
    "defaultMessagingAccount": "/accounts/my_account"
  },
  "memberships": "/users/wqyODPA/memberships"
}

User creates a custom schema value

Request

PUT /users/wqyODPA

Body

{
  "settings": {
    "customSettings": {
      "/textus/user_schema/calendar": "https://calend.ly/chuck-norris"
    }
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/wqyODPA
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true
    },
    "customSettings": {
      "/textus/user_schema/calendar": "https://calend.ly/chuck-norris"
    }
  },
  "memberships": "/users/wqyODPA/memberships"
}

User updates a custom schema value

Request

PUT /users/wqyODPA

Body

{
  "settings": {
    "customSettings": {
      "/textus/user_schema/calendar": "https://calend.ly/my_new_url"
    }
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/wqyODPA
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true
    },
    "customSettings": {
      "/textus/user_schema/calendar": "https://calend.ly/my_new_url"
    }
  },
  "memberships": "/users/wqyODPA/memberships"
}

User removes a custom schema value

Request

PUT /users/wqyODPA

Body

{
  "settings": {
    "customSettings": {
      "/textus/user_schema/calendar": null,
      "/textus/user_schema/second-field": null
    }
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/wqyODPA
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true
    },
    "customSettings": {}
  },
  "memberships": "/users/wqyODPA/memberships"
}

User schedules analytics email

Request

PUT /users/wqyODPA

Body

{
  "name": "Chuck Norris",
  "email": "chuck@textus.example",
  "settings": {
    "analyticsReports": [
      {
        "account": "/accounts/my_account",
        "schedule": "FREQ=MONTHLY;BYDAY=1FR",
        "timePeriod": "previous_month",
        "reports": ["users_by_organization", "message_deliverability"]
      }
    ]
  }
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /users/wqyODPA
     -d '{json: "body"}' 

Response

Status

200

Response Type

User

Example
{
  "@type": "User",
  "@context": "/contexts/User.jsonld",
  "id": "/users/wqyODPA",
  "name": "Chuck Norris",
  "firstName": "Chuck",
  "lastName": "Norris",
  "email": "chuck@textus.example",
  "avatar": null,
  "automatedActor": false,
  "hasPassword": false,
  "discarded": false,
  "settings": {
    "notifications": {
      "email": true
    },
    "customSettings": {},
    "analyticsReports": [
      {
        "account": "/accounts/my_account",
        "schedule": "FREQ=MONTHLY;BYDAY=1FR",
        "timePeriod": "previous_month",
        "reports": [
          "users_by_organization",
          "message_deliverability"
        ]
      }
    ]
  },
  "memberships": "/users/wqyODPA/memberships"
}

© 2021 TextUs