user
Description
As part of security protections against abuse, an hCaptcha header is required as part of user creation. It is passed through a h-captcha-code
header with the POST
request to create a user.
If you have a need to create users as part of a platform integration, please get in touch with our support team to discuss this requirement further.
To modify a user, you must be connected to the API using an OAuth token with user_full_access scope.
A FoxyCart User is someone who manages and configures a FoxyCart Store. It is often the owner of that store, but might also be someone paid to be responsible for aspects of the store. There can be many users per store and any user can access many stores. Before creating a user, you must create a client. When you create a user, you'll get a response back containing an OAuth token giving you access to the user.
If you create custom attributes for a user, they will automatically be included in the response as embedded resources without having to zoom in on them.
When creating a user resource, the response will include the OAuth Access and Refresh tokens required to work with this resource via the API. It's important to save this information in your database. If you lose it, you'll have to do an OAuth Authorization Code grant via your browser.
Actions
- POST
- Create a new user
- OPTIONS
- Get a response explaining which HTTP methods are supported
Properties
Property | Description | Type | Constraints |
---|---|---|---|
first_name | The user's given name. | String | Required. 50 characters or less. |
last_name | The user's surname. | String | Required. 50 characters or less. |
The user's email address. This is used as the login to the FoxyCart admin for this user. | Required. 100 characters or less. | ||
phone | The user's phone number. | String | 50 characters or less. |
affiliate_id | This can only be set during user creation. Contact us if you need this value changed later. | Integer | Can only be set on creation. |
is_programmer | If this user is a programmer who writes server side code in languages like PHP, .NET, Python, Java, Ruby, etc | Boolean | true or false, 1 or 0. |
is_front_end_developer | If this user is a front end developer who writes code in things like HTML, CSS, and maybe some JavaScript. | Boolean | true or false, 1 or 0. |
is_designer | If this user is a front end designer who works in wireframes, graphic designs, and user interfaces. | Boolean | true or false, 1 or 0. |
is_merchant | If this user is a a merchant or store admin involved in the item and money side of the e-commerce business. | Boolean | true or false, 1 or 0. |
date_created | The date this resource was created. | Date | Read only |
date_modified | The date this resource was last modified. | Date | Read only |
Example Representation
{ "_links": { "curies": [ { "name": "fx", "href": "https://api.foxycart.com/rels/{rel}", "templated": true } ], "self": { "href": "https://api.foxycart.com/users/1", "title": "This User" }, "fx:attributes": { "href": "https://api.foxycart.com/users/1/attributes", "title": "Attributes for This User" }, "fx:default_store": { "href": "https://api.foxycart.com/stores/66", "title": "Example Store" }, "fx:stores": { "href": "https://api.foxycart.com/users/1/stores", "title": "Stores for This User" } }, "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com", "phone": "555-555-5555", "affiliate_id": 0, "is_programmer": true, "is_front_end_developer": false, "is_designer": false, "is_merchant": true, "date_created": "2007-05-23T16:09:12-0700", "date_modified": "2013-07-10T22:37:49-0700" } Response from POST: { "_links": { "curies": [ { "name": "fx", "href": "https://api.foxycart.com/rels/{rel}", "templated": true } ], "self": { "href": "https://api.foxycart.com/users/44", "title": "This User" }, "fx:attributes": { "href": "https://api.foxycart.com/users/44/attributes", "title": "Attributes for This User" }, "fx:stores": { "href": "https://api.foxycart.com/users/44/stores", "title": "Stores for This User" } }, { "message": "user 44 created successfully.", "token": { "access_token": "590a79faf06e4062cabf2ec866a6c121065417fc", "expires_in": 7200, "token_type": "bearer", "scope": "user_full_access", "refresh_token": "3ea1c2d62826cddce440ceaa0d69c9b396ee394a" } } }
<?xml version="1.0" encoding="UTF-8"?> <resource href="https://api.foxycart.com/users/1" rel="https://api.foxycart.com/rels/user"> <link rel="self" href="https://api.foxycart.com/users/1" title="This User"/> <link rel="https://api.foxycart.com/rels/attributes" href="https://api.foxycart.com/users/1/attributes" title="Attributes for This User"/> <link rel="https://api.foxycart.com/rels/default_store" href="https://api.foxycart.com/stores/66" title="Example Store"/> <link rel="https://api.foxycart.com/rels/stores" href="https://api.foxycart.com/users/1/stores" title="Stores for This User"/> <first_name>John</first_name> <last_name>Doe</last_name> <email>john.doe@example.com</email> <phone>555-555-5555</phone> <affiliate_id>0</affiliate_id> <is_programmer>true</is_programmer> <is_front_end_developer>false</is_front_end_developer> <is_designer>false</is_designer> <is_merchant>true</is_merchant> <date_created>2007-05-23T16:09:12-0700</date_created> <date_modified>2013-07-10T22:37:49-0700</date_modified> </resource> Response from POST: <?xml version="1.0" encoding="UTF-8"?> <resource href="https://api.foxycart.com/users/44"> <link rel="self" href="https://api.foxycart.com/users/44" title="This User"/> <link rel="https://api.foxycart.com/rels/attributes" href="https://api.foxycart.com/users/44/attributes" title="Attributes for This User"/> <link rel="https://api.foxycart.com/rels/stores" href="https://api.foxycart.com/users/44/stores" title="Stores for This User"/> <message>user 44 created successfully.</message> <token> <access_token>590a79faf06e4062cabf2ec866a6c121065417fc</access_token> <expires_in>7200</expires_in> <token_type>bearer</token_type> <scope>user_full_access</scope> <refresh_token>3ea1c2d62826cddce440ceaa0d69c9b396ee394a</refresh_token> </token> </resource>
{ "class": [ "user" ], "properties": { "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com", "phone": "555-555-5555", "affiliate_id": 0, "is_programmer": true, "is_front_end_developer": false, "is_designer": false, "is_merchant": true, "date_created": "2007-05-23T16:09:12-0700", "date_modified": "2013-07-10T22:37:49-0700" }, "links": [ { "rel": [ "self" ], "href": "https://api.foxycart.com/users/1" }, { "rel": [ "https://api.foxycart.com/rels/attributes" ], "href": "https://api.foxycart.com/users/1/attributes" }, { "rel": [ "https://api.foxycart.com/rels/default_store" ], "href": "https://api.foxycart.com/stores/66" }, { "rel": [ "https://api.foxycart.com/rels/stores" ], "href": "https://api.foxycart.com/users/1/stores" } ] } Response from POST: { "properties": { "message": "user 44 created successfully.", "token": { "access_token": "590a79faf06e4062cabf2ec866a6c121065417fc", "expires_in": 7200, "token_type": "bearer", "scope": "user_full_access", "refresh_token": "3ea1c2d62826cddce440ceaa0d69c9b396ee394a" } }, "links": [ { "rel": [ "self" ], "href": "https://api.foxycart.com/users/44" }, { "rel": [ "https://api.foxycart.com/rels/attributes" ], "href": "https://api.foxycart.com/users/44/attributes" }, { "rel": [ "https://api.foxycart.com/rels/stores" ], "href": "https://api.foxycart.com/users/44/stores" } ] }
Zoomable Resources
This resource has no linked resources which can be "zoomed" in on, filtered and embedded within this resource.