Update

PUT /users/:user

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 '{
  "name": "Not Chuck",
  "email": "not+chuck@textus.example",
  "settings": {
    "notifications": {
      "email": true,
      "audio": true
    }
  }
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "customSettings": {},
    "notifications": {
      "email": true,
      "audio": true
    }
  },
  "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 '{
  "name": "Not Chuck",
  "email": "not+chuck@textus.example",
  "memberships": [
    {
      "role": "user",
      "account": "/accounts/my_account"
    },
    {
      "role": "support",
      "account": "/accounts/my_account_child"
    }
  ]
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "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 '{
  "name": "Not Chuck",
  "email": "not+chuck@textus.example",
  "memberships": [{}]
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "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 '{
  "name": "Chuck Norris",
  "email": "chuck@textus.example",
  "notifications": {
    "email": false,
    "audio": false
  },
  "defaultMessagingAccount": "my_account",
  "settings": {
    "notifications": {
      "email": false,
      "audio": false
    }
  }
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "customSettings": {},
    "notifications": {
      "email": false,
      "audio": false
    },
    "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 '{
  "settings": {
    "customSettings": {
      "/textus/user_schema/calendar": "https://calend.ly/chuck-norris"
    }
  }
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "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 '{
  "settings": {
    "customSettings": {
      "/textus/user_schema/calendar": "https://calend.ly/my_new_url"
    }
  }
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "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 '{
  "settings": {
    "customSettings": {
      "/textus/user_schema/calendar": null,
      "/textus/user_schema/second-field": null
    }
  }
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "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 '{
  "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"]
      }
    ]
  }
}'

Response

Status

200

Response Type

User

Example Body

{
  "@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": {
    "customSettings": {},
    "analyticsReports": [
      {
        "account": "/accounts/my_account",
        "schedule": "FREQ=MONTHLY;BYDAY=1FR",
        "timePeriod": "previous_month",
        "reports": [
          "users_by_organization",
          "message_deliverability"
        ]
      }
    ]
  },
  "memberships": "/users/wqyODPA/memberships"
}

© 2024 TextUs