{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/users/:user_id","auth":"required","examples":{"codes":[{"language":"curl","name":"Date","code":"# Single attribute\ncurl -X PUT -u :$API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_date\": {\n \"value\": \"2012-04-23T18:25:00Z\",\n \"type\" : \"date\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/$user_id\n \n# Array\ncurl -X PUT -u :$API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_dates_key\": {\n \"value\": [\"2012-04-23T18:25:00Z\", \"2012-05-23T18:25:00Z\"],\n \"type\": \"date\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/$user_id"},{"code":"# Single attribute\ncurl -X PUT -H \"Accept: application/json\" -u :API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_string_key\": {\n \"value\": \"My string value\",\n \"type\" : \"string\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id\n\n# Array\ncurl -X PUT -u :API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_strings_key\": { \n \"value\": [\"Hello\", \"there\"],\n \"type\" : \"string\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id","language":"curl","name":"String"},{"code":"# Booleans can only be set as single attributes\ncurl -X PUT -H \"Accept: application/json\" -u :API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_boolean_key\": {\n \"value\": true,\n \"type\": \"boolean\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id","language":"curl","name":"Boolean"},{"code":"# Single attribute\ncurl -X PUT -H \"Accept: application/json\" -u :API_KEY -d \\\n '{\n \"user\":{ \n \"custom\": {\n \"my_float_key\": { \n \"value\": 2.14, \n \"type\": \"float\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id\n \n# Array\ncurl -X PUT -u :API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_floats_key\": {\n \"value\": [23.2, 3.141], \n \"type\": \"float\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id","language":"curl","name":"Float"},{"language":"curl","name":"Integer","code":"# Single attribute\ncurl -X PUT -H \"Accept: application/json\" -u :API_KEY -d \\\n '{\n \"user\" :{ \n \"custom\": {\n \"my_integer_key\": { \n \"value\": 123,\n \"type\": \"integer\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id\n \n# Array\ncurl -X PUT -u :API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"my_integers_key\": { \n \"value\": [23, 3], \n \"type\": \"integer\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id"},{"code":"# You can set multiple attributes in the same request\ncurl -X PUT -H \"Accept: application/json\" -u :API_KEY -d \\\n '{\n \"user\": {\n \"custom\": {\n \"release_date\": {\n \"value\": \"1965-12-03T01:15:00Z\",\n \"type\" : \"date\"\n },\n \"favorite_song\": {\n \"value\": \"Drive My Car\",\n \"type\" : \"string\"\n },\n \"starred_tracks\": {\n \"value\": [1, 6, 11],\n \"type\": \"integer\"\n }\n }\n }\n }' -H 'Content-Type: application/json' -H 'Accept: application/json' https://api.carnivalmobile.com/v6/users/:user_id","name":"Multiple types","language":"curl"}]},"method":"put","params":[{"name":"user_id","type":"string","default":"","desc":"The Sailthru Mobile user ID","required":true,"in":"path","ref":"","_id":"55ed121dc9d5b3350072ae9f"},{"name":"user","type":"object","default":"","desc":"JSON model of User Attributes","required":true,"in":"body","ref":"","_id":"55ed13930d968e2100de8353"}],"results":{"codes":[{"name":"","status":202,"language":"json","code":"{\n \"custom\": {\n \"my key 1\": {\n \"value\": \"custom attribute value\",\n \"type\": \"string\"\n }\n }\n}"},{"status":401,"language":"json","code":"{\n \"error\":\"unauthorized\"\n}","name":""},{"status":403,"language":"json","code":"{\n \"error\":\"your api client does not have the correct roles\"\n}"},{"status":404,"language":"text","code":"{}\n// No user was found for this user id"}]},"settings":"","apiSetting":null},"next":{"description":"","pages":[]},"title":"Users","type":"endpoint","slug":"users","excerpt":"Updates a user with new attributes.","body":"This endpoint updates an existing user with new attributes.\n\nUpon a successful request, existing attributes are merged (not replaced) with the attributes you sent in the request.\n\nIf a User ID exists across multiple devices, all the devices belonging to that User ID will be updated.\n\n## Valid Types\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Data type\",\n \"h-1\": \"Ranges/valid values\",\n \"h-2\": \"Example\",\n \"0-0\": \"`integer`\",\n \"h-3\": \"Notes\",\n \"0-1\": \"`-2,147,483,647` to `2,147,483,647`\",\n \"0-2\": \"`12`, `24`, `25`\",\n \"0-3\": \"Floating point numbers are accepted but they will be truncated to an `integer`. If you wish to keep the decimal part, use `float` instead.\\n\\nValues out of range will be discarded.\",\n \"1-0\": \"`float`\",\n \"1-2\": \"`12.343`, `123.33`\",\n \"2-0\": \"`string`\",\n \"2-2\": \"`Cody`, `gold`, `A string with a , comma`\",\n \"2-1\": \"UTF-8 character encoding\",\n \"2-3\": \"Maximum 255 characters long\",\n \"3-0\": \"`date`\",\n \"3-1\": \"ISO 8601, e.g. `YYYY-MM-ddTHH:mm:ssZ`\",\n \"3-2\": \"`2017-02-06T18:25:32+0300`\",\n \"4-0\": \"`boolean`\",\n \"4-1\": \"`true` or `false`\",\n \"1-1\": \"Single-precision 32-bit IEEE 754 floating point.\",\n \"1-3\": \"Floats greater than 32-bit will be converted to scientific notation.\",\n \"4-3\": \"\",\n \"h-4\": \"Can be sent as array\",\n \"0-4\": \"Yes\",\n \"1-4\": \"Yes\",\n \"2-4\": \"Yes\",\n \"3-4\": \"Yes\",\n \"4-4\": \"No\"\n },\n \"cols\": 5,\n \"rows\": 5\n}\n[/block]\n#### Custom Attribute Limits\nThere are limits in place on the maximum number of custom attributes allowed as well as the length (size) of strings and arrays.\n\n* A maximum of **50** custom attributes is allowed per device. If you exceed this amount any new attributes being set will be discarded.\n* String values that have more than **255** characters will be truncated. The limitation is on the character length, not on the size in bytes.\n* Arrays with more than **50** elements will be truncated.\n\n#### Key Name Restrictions\nThere are some restrictions in place on the key name, these are:\n\n * **Only letters, numbers, underscore and dash are valid characters.**\n * Leading spaces will be removed. `\" my_string_key \"` will become `\"my_string_key\"`.\n * Invalid characters other than spaces and dots will be removed. `\"my_string_key~~~~\"` will become `\"my_string_key\"`.\n * Spaces and dots will be replaced for underscores. `\"my string.key\"` will become `\"my_string_key\"`.\n * Keys will be truncated to a maximum of 255 characters.\n * Invalid keys (including keys exclusively made of invalid characters) will simply be discarded and no error will be returned.","updates":["589c9d7ec1131a190004197d"],"order":9,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5e6156bf5e4a51006dcd8143","githubsync":"","version":{"version":"1.5","version_clean":"1.5.0","codename":"ST Rebrand","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e6156bf5e4a51006dcd8120","5e6156bf5e4a51006dcd8121","5e6156bf5e4a51006dcd8122","5e6156bf5e4a51006dcd8123","5e6156bf5e4a51006dcd8124","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","5e6156bf5e4a51006dcd8125","5e6156bf5e4a51006dcd8126","5af0fe494ca2730003cbc98a","5af0fe55ec80af0003804ca2","5e69868cbd5dcb006b35867b","5e6986ca2c6652006791b6e8"],"_id":"5e6156bf5e4a51006dcd818c","project":"55e67aaa9cc7c62b00c4a1ea","__v":2,"forked_from":"5b720760c44b7600034b7a08","createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z"},"__v":9,"createdAt":"2015-09-07T04:35:24.173Z","parentDoc":null,"user":"55d2bd8e2463351700f67dd7","editedParams":true,"editedParams2":true,"category":{"sync":{"isSync":false,"url":""},"pages":["5e6156bf5e4a51006dcd8138","55ed079b0d968e2100de8339","5e6156bf5e4a51006dcd8139","55ed0bb078319821005005cf","5e6156bf5e4a51006dcd813a","5e6156bf5e4a51006dcd813b","5e6156bf5e4a51006dcd813c","5e6156bf5e4a51006dcd813d","5e6156bf5e4a51006dcd813e","5e6156bf5e4a51006dcd813f","5e6156bf5e4a51006dcd8140","5e6156bf5e4a51006dcd8141","5e6156bf5e4a51006dcd8142","5e6156bf5e4a51006dcd8143","5e6156bf5e4a51006dcd8144","5e6156bf5e4a51006dcd8145","5b720760c44b7600034b79ce","5e6156bf5e4a51006dcd814d","5e6156bf5e4a51006dcd814e","5e6156bf5e4a51006dcd8156"],"title":"REST API","slug":"rest-api","order":5,"from_sync":false,"reference":true,"_id":"5e6156bf5e4a51006dcd8122","__v":20,"createdAt":"2015-09-02T04:30:21.948Z","project":"55e67aaa9cc7c62b00c4a1ea","version":"5e6156bf5e4a51006dcd818c"},"project":"55e67aaa9cc7c62b00c4a1ea"}
putUsers
Updates a user with new attributes.
Definition
{{ api_url }}{{ page_api_url }}
Parameters
Path Params
user_id:
required
string
The Sailthru Mobile user ID
Body Params
user:
required
object
JSON model of User Attributes