{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/:ecosystemId;:userId","auth":"required","settings":"59a85b6b02c545000f08a77f","results":{"codes":[{"name":"Updated","code":"{\n    \"token\": \"_UDTEj2600z8jitmXbX-48v-pij3iANkLLG54XK4uNtrFPkBKHD0ZMhDIYxuJ9-m07GWc7Ck-9FdKHshuXM4c2YDrWy42i6PDS7dR1daxxNoPj6ZdYm9dVrlXsS9N10Pa\"\n}","language":"json","status":200},{"name":"","code":"{\n    \"token\": \"_GhaNYmg5HgmoJWJDpQPgguQv5bwasNECMUfcWD2EB0yf5Ijs8PGpMA-bV0NcA6FzRgGcmYmB49WanwUSFGRjPFG8IuUtl9s930z2DYLnskkC0yRqknitwiUB00Dxu1h5\"\n}","language":"json","status":201},{"name":"Invalid Query Parameter","status":400,"language":"json","code":"{\n    \"errorType\": \"InvalidParams\",\n    \"errors\": [\n        {\n            \"in\": \"query\",\n            \"message\": \"contains fields that are not allowed: [ query ]\",\n            \"path\": \"additional parameters\"\n        }\n    ]\n}"},{"status":400,"name":"Token Duration Invalid","language":"json","code":"{\n    \"errorType\": \"InvalidParams\",\n    \"errors\": [\n        {\n            \"in\": \"query\",\n            \"message\": \"expected field to be a number\",\n            \"path\": \"ttl\"\n        }\n    ]\n}"},{"name":"Token Expiration Type Invalid","language":"json","code":"{\n    \"errorType\": \"InvalidParams\",\n    \"errors\": [\n        {\n            \"in\": \"query\",\n            \"message\": \"field must be one of the following values: Infinite, FixedTtl, SlidingTtl\",\n            \"path\": \"expiryType\"\n        }\n    ]\n}","status":400},{"name":"Token Generation Invalid","language":"json","code":"{\n    \"errorType\": \"InvalidParams\",\n    \"errors\": [\n        {\n            \"in\": \"query\",\n            \"message\": \"expected field to be a boolean\",\n            \"path\": \"generateToken\"\n        }\n    ]\n}","status":400},{"name":"Metadata Format Invalid","language":"json","code":"{\n    \"errorType\": \"Internal Server Error\"\n}","status":400},{"status":400,"name":"Environment Access Format Invalid","language":"json","code":"{\n    \"errorType\": \"Internal Server Error\"\n}"},{"status":404,"name":"Ecosystem Not Found","language":"text","code":"Ecosystem with id Ca933243b68505e7cf9ef2ec2 does not exist."}]},"examples":{"codes":[{"language":"http","code":"PUT https://ioe.droplit.io/api/users/C59eb8eae278b6bf402e39d25;newUser?generateToken=true&ttl=20&expiryType=SlidingTtl HTTP/1.1\nauthorization: AUTH_TOKEN\ncontent-type: application/json\nx-system-metadata-prefix: \"#\"\n\n{\n\t\"access\" : [\n\t\t{\n\t\t\t\"environmentId\" : \"Eb86d758c507b788286866a3e\",\n\t\t\t\"accessLevel\" : \"Full\"\n\t\t},\n    {\n\t\t\t\"environmentId\" : \"Ee6c4b94f872676661915310c\",\n\t\t\t\"accessLevel\" : \"None\"\n    }\t\n\t],\n  \"email\" : \"newUser:::at:::droplit.io\",\n  \"meta\" : {\n  \t\"#label\": \"New User\"\n  }\n}"},{"name":"Droplit SDK","language":"javascript","code":"droplit.users.update(\"C59eb8eae278b6bf402e39d25\", \"newUser\", [ { \"environmentId\" : \"Eb86d758c507b788286866a3e\", \"accessLevel\" : \"Full\" }, { \"environmentId\" : \"Ee6c4b94f872676661915310c\", \"accessLevel\" : \"None\" } ], \"[email protected]\", \"FixedTtl\", 3600, false, { \"meta\" : { \"$label\" : \"New User\" } });"}]},"method":"put","params":[{"name":"ecosystemId","type":"string","default":"","desc":"The ID of the ecosystem.","required":true,"in":"path","ref":"","_id":"59c33c119aea850010ac42b7"},{"name":"userId","type":"string","default":"","desc":"The new unique ID of the user to be created, or the ID of the user to be updated.","required":true,"in":"path","ref":"","_id":"59c33c119aea850010ac42b6"},{"name":"generateToken","type":"boolean","default":"False","desc":"If set to \"True\", will generate a new user token.","required":false,"in":"query","ref":"","_id":"59c33dff9aea850010ac430b"},{"name":"ttl","type":"int","default":"3600","desc":"Time To Live. The length of time, in seconds, for which the newly generated user token will be valid.","required":false,"in":"query","ref":"","_id":"59c33dff9aea850010ac4309"},{"name":"expiryType","type":"string","default":"FixedTtl","desc":"How the newly generated user token will expire. There are three methods of expiration: \"Infinite\" (token never expires), \"FixedTtl\" (token will expire after a set amount of time), and \"SlidingTtl\" (token will expire after it has not been used for a set amount of time).","required":false,"in":"query","ref":"","_id":"59c33dff9aea850010ac430a"},{"name":"access","type":"array_object","default":"","desc":"Each element contains an environment ID and the user's access level to that environment. There are two access levels: \"Full\" and \"None\". If a user's access level is updated to \"None\", that environment's entry will be removed.","required":false,"in":"body","ref":"","_id":"59c33dff9aea850010ac4308"},{"name":"email","type":"string","default":"","desc":"The user's email address.","required":false,"in":"body","ref":"","_id":"59c33dff9aea850010ac4307"},{"name":"meta","type":"object","default":"","desc":"Any proprietary information that is to be stored with the user.","required":false,"in":"body","ref":"","_id":"59c33dff9aea850010ac4306"},{"name":"authorization","type":"string","default":"","desc":"The user's authorization token.","required":true,"in":"header","ref":"","_id":"5b292abc36a5030003c3ffce"},{"name":"x-system-metadata-prefix","type":"string","default":"$","desc":"A custom metadata prefix.","required":false,"in":"header","ref":"","_id":"59c33dff9aea850010ac4305"}]},"next":{"description":"","pages":[]},"title":"Create or Update a User.","type":"endpoint","slug":"users-create-update","excerpt":"","body":"Create a new user, or update the properties of an existing user.\n\nThe token generation parameters should only be used if a new user is being created or if a significant update to the user is being made. Do not use this token specifically to generate a user token without creating or making changes to a user. Use endpoint `GET api/users/:id/tokens` when a new token should be generated without changing or creating a user.\n\nAn account token or server token may be used to run this endpoint.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"WARNING\",\n  \"body\": \"When using the SDK, ALL fields are required to be provided.\"\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"59c33dff9aea850010ac4304","project":"568bdc1483d2061900d86cdc","version":{"version":"0","version_clean":"0.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["59a7236e3fe4d90025117c10","59a72eb6cb0db3001b84cfe2","59a734eb757d030019b85af8","59c0243b1b2d07001a9d2b76","59c035e42126e10028effb12","59c06c40df5b3c0010584a13","59c1a5852cabe5002641a3e7","59c2fb00b2b45c0010b7a3d7","59c32ceb9aea850010ac4130","59c32e6e190c90003cb0d12f","59c33affb2b45c0010b7aa23","59c7dfa457bd8200105444dc","59c7e975c50cf30010d712a0","59cffdef0cd4dd0010294d54","59d0622ca91a810032c8f60c","59d06733c1aec60026253065","59d174d44ac471001a07b123","59d5a5e323e6e800103defb2","59ecf1d8ed507c001c52b255","59f76fef8581dc0010593e6f","5a0c003680a35b0012c35db0","5a8358722e78660075e45f42","5a846645b5ec3a001203517e","5b258091bc7a6700033b9cb5","5b26e48e024807000315a740","5b44edff3306680003663f5c","5b468abd3d4a9e0003789111","5b468d8f3dcb6a0003c6e374","5b47b0b93d4a9e000378a33a","5b538d114ea24f00033c726f","5b6a0efe402b32000336c33f","5bba5e5d7ba7710003bd902a","5bc2703349ac3a0013eec3e5","5c351061191e2b002b4988a8","5c8b01b199b56e00440aa018"],"_id":"59a72290d61777001b6c42c3","project":"568bdc1483d2061900d86cdc","createdAt":"2017-08-30T20:39:44.453Z","releaseDate":"2017-08-30T20:39:44.453Z","__v":35},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Users API","slug":"users-api","order":26,"from_sync":false,"reference":false,"_id":"59c33affb2b45c0010b7aa23","project":"568bdc1483d2061900d86cdc","version":"59a72290d61777001b6c42c3","createdAt":"2017-09-21T04:07:27.858Z","__v":0},"user":"58cc41f21751ce2f003be3b7","createdAt":"2017-09-21T04:20:15.082Z","githubsync":"","__v":16,"parentDoc":null}

putCreate or Update a User.


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

ecosystemId:
required
string
The ID of the ecosystem.
userId:
required
string
The new unique ID of the user to be created, or the ID of the user to be updated.

Query Params

generateToken:
booleanFalse
If set to "True", will generate a new user token.
ttl:
integer3600
Time To Live. The length of time, in seconds, for which the newly generated user token will be valid.
expiryType:
stringFixedTtl
How the newly generated user token will expire. There are three methods of expiration: "Infinite" (token never expires), "FixedTtl" (token will expire after a set amount of time), and "SlidingTtl" (token will expire after it has not been used for a set amount of time).

Body Params

access:
array of objects
Each element contains an environment ID and the user's access level to that environment. There are two access levels: "Full" and "None". If a user's access level is updated to "None", that environment's entry will be removed.
email:
string
The user's email address.
meta:
object
Any proprietary information that is to be stored with the user.

Headers

authorization:
required
string
The user's authorization token.
x-system-metadata-prefix:
string$
A custom metadata prefix.

Examples


Result Format


Documentation

Create a new user, or update the properties of an existing user. The token generation parameters should only be used if a new user is being created or if a significant update to the user is being made. Do not use this token specifically to generate a user token without creating or making changes to a user. Use endpoint `GET api/users/:id/tokens` when a new token should be generated without changing or creating a user. An account token or server token may be used to run this endpoint. [block:callout] { "type": "warning", "title": "WARNING", "body": "When using the SDK, ALL fields are required to be provided." } [/block]

User Information

Try It Out

put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}