All Versions

Version 1
Version 2


Page tree

Supplier API v1

There is a newer version of this API!

Skip to end of metadata
Go to start of metadata

Create a new user to make them available for surveys through Critical Mix 

This endpoint can be used to create users if you wish to use the /users/{id}/surveys endpoint to find qualified surveys for your users. It is not necessary to create users if you do not wish to use the /users/{id}/surveys endpoint. However, it is still recommended to create users and set their basic demographics before attempting to send them to one of our surveys. Doing this will minimize the questions we ask during our pre-screening for the survey, creating a better user experience.

Table of Contents

Request

Request Headers

NameValueDescription
Content-Typeapplication/jsonMIME type of the request body
Acceptapplication/jsonExpected MIME type of the response body

URI Identifiers

Name
Type
Description
user-idstring Your ID for the user 

Request Parameters

There are no parameters for this request.

Request Body

The request body must be a valid, properly formatted JSON string with the following data elements:

NameTypeRequiredExampleDescription
externalIdstringrequiredexampleUserIdYour ID for the user
emailstringoptionaluser@example.comemail address of the user
countrystringrequiredUSTwo character ISO Country Code for the user, in UPPERCASE LETTERS
languagestringrequiredENTwo character ISO Language Code for the user, in UPPERCASE LETTERS
firstNamestringoptionalJohnUser's first name
lastNamestringoptionalDoeUser's Last Name
addressstringoptional123 Main StUser's street address
citystringoptionalPerrysburgUser's city
statestringoptionalOH(Only valid for US) User's state, using two letter standard US Postal Abbreviation in UPPERCASE LETTERS
zipstringoptional43551Standardized Postal Code for all countries. Please use proper formatting with UPPERCASE LETTERS where applicable. For US, please include only the 5-digit Zip Code.
zip4stringoptional9331Valid for US Postal Codes only, the 4-digit Zip Code suffix
birthDatestringoptional01/31/1980User's birth date in format MM/DD/YYYY

 

Request Examples

import requests
import json

uri = "https://supplier-api.cmix.com/api/v1/users"
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
}
payload = {
  "externalId": "exampleUserId",
  "email": "user@example.com",
  "country": "US",
  "lanuage": "EN", 
  "firstName": "Kevin", 
  "lastName": "Lirot", 
  "address": "123 Main St", 
  "city": "Perrysburg", 
  "state": "OH", 
  "zip": "43551", 
  "zip4": "9931", 
  "birthDate": "01/31/1980"
}
response = requests.post(uri, headers=headers, json=payload)

Successful Response

Successful Response HTTP Status Codes

A successful response will have one of the following HTTP Status Codes:

HTTP Status CodeUsage
201: CreatedThe requested resource was found and returned in the response body

Successful Response Headers

NameValueDescription
Content-Typeapplication/jsonMIME type of the response body

Successful Response Body

When successful, the response body will return a JSON string with properties of the newly created user

Only elements that have been populated with a value will be returned in the response body!

NameTypeDescription
externalIdstringYour identifier for this user
emailstringemail address of the user
countrystringTwo character ISO Country Code for the user, in UPPERCASE LETTERS
languagestringTwo character ISO Language Code for the user, in UPPERCASE LETTERS
firstNamestringUser's first name
lastNamestringUser's Last Name
addressstringUser's Street Address
citystringUser's city
statestringUser state, using two letter standard US Postal Abbreviation in UPPERCASE LETTERS
zipstringUser's Postal Code
zip4string4-digit Zip Code suffix (For US Zip Codes only)
birthDatestringUser's birthdate in format MM/DD/YYYY
testbooleanIndicates if the user is a test user. Note: this should always be false

 

Successful Response Examples

HTTP/1.1 200 OK
 
{
    "email": "user@example.com",
    "country": "US",
    "firstName": "Kevin",
    "lastName": "Lirot",
    "address": "123 Main St",
    "city": "Perrysburg",
    "state": "OH",
    "zip": "43551",
    "zip4": "9931",
    "birthDate": "01/31/1980",
    "test": false,
    "externalId": "exampleUserId"
}

Error Response

Refer to the Error Responses section on the Getting Started page for more information about error responses, including details about the Headers and Body.

Error Response HTTP Status Codes

The following HTTP status codes will be used specific to this endpoint:

HTTP Status CodeCodeMessage
400: Bad Request4User already exists with the provided id

Error Response Examples

HTTP/1.1 400 Bad Request
 
{
    "message": "User already exists with the provided id",
    "code": 4
}

Change Log

Version Date Comment
Current Version (v. 1) Sep 20, 2018 17:35 Kevin Lirot

 

Write a comment…