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


Make updates to a user.

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-idstringThe id you provided as externalId when creating a new user.

Request Parameters

No URL parameters are defined for this request.

Request Body

The request body must be a valid, properly formatted JSON string which represents an array of Patch operations. The Patch operation is made up of the following data elements.

NameTypeRequiredDescription
opstringrequired

Operation to perform on the specified data element. Valid operations are:

OperationDescription
replaceReplace the current value of path
pathstringrequired

Data element to be updated, specified in "path" format with a leading "/". Valid paths are:

NameTypeRequiredExampleDescription
/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
valueanyrequiredThe new value for the data element specified by path. If path represents an optional data element then value can be specified as an empty string "" to remove the value.

 

Request Examples

import requests
import json

uri = "https://supplier-api.cmix.com/api/v1/"
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
}
payload = [
	{
		"op": "replace",
		"path": "/email",
		"value": "new.email@example.com",
	},
	{
		"op": "replace",
		"path": "/zip4",
		"value": "",
	}
]
response = requests.patch(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
200: OKThe requested resource was found and updated successfully

Successful Response Headers

No additional headers are included with the response.

Successful Response Body

No response body is returned.

Successful Response Examples

HTTP/1.1 200 OK

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 CodeCodeMessagePossible Causes
404: Not Found2User not found with id: user-idThe specified ID does not exist
400: Bad Request5No properties received for updateThe request does not include any Patch operations where "op" = "replace"
400: Bad Request4Property path cannot be updatedAn invalid or read-only path was specified
500: Internal Server Error1Failed updating userAn unspecified validation has failed, or database exception has occurred

Error Response Examples

HTTP/1.1 400 Bad Request
 
{
	"message": "Property externalId cannot be updated",
	"code": 4
}

Change Log

Version Date Comment
Current Version (v. 2) Jan 14, 2019 21:43 Kevin Lirot
v. 1 Sep 20, 2018 17:35 Kevin Lirot

 

Write a comment…