Documentation Sweet Pricing API

PUT / users / :userId

This endpoint updates a user's email address or password. You cannot use it to create a client account, unlike POST /users.

URL

https://api.sweetpricing.com/v1.0/users/:userId

Header

Field Type Description
Authorization String

Header of form api-key <API key>

Authorization: api-key <API Key>

Parameters

Field Type Description
:userId Number

ID of the user.

Body

Field Type Description
email String

Email address.

Size: ..255

firstName String

First name

Size: ..255

lastName String

Last name

Size: ..255

subscribeWelcome Boolean

Email preference

subscribeBlog Boolean

Email preference

subscribeHowto Boolean

Email preference

subscribeOnboarding Boolean

Email preference

timezone String

User's timezone.

Size: ..255

password Mixed

When creating a new client (POST /clients) this must be a String{6..}. For an update (PUT /clients/:clientId) this is either a String{6..} to update the password, or null to keep the existing password.

client optional Object

If provided, will create a client accout, too. See POST /clients.

{
	"email": "test@example.com",
	"password": "p@$$w0rd",
	"client": {
		"name": "My App Co.",
		"terms": "I agree"
	},
	"subscribeWelcome": true,
	"subscribeBlog": true,
	"subscribeHowto": true,
	"subscribeOnboarding": true,
	"timezone": "Europe/London"
}

200

Field Type Description
id Number

ID of the user.

created String

ISO 8601 date of account creation.

email String

Email address of user.

passwordLastChanged String

ISO 8601 date password last changed.

firstName String

User's first name.

lastName String

User's last name.

subscribeWelcome Boolean

Email preference

subscribeBlog Boolean

Email preference

subscribeHowto Boolean

Email preference

subscribeOnboarding Boolean

Email preference

phoneCountry Object
phoneCountry.id Number

ID of the phone country.

phoneCountry.name String

Name of the country code.

phoneCountry.dialCode String

Dial code for the country.

phoneNumber String

User's phone number.

phoneExtension Mixed

String|null. User's phone extension.

timezone String

User's timezone.

{
	"id": 1,
	"created": "2016-02-17T16:40:06+00:00",
	"email": "test@example.com",
	"passwordLastChanged": "2016-02-17T16:40:06+00:00",
	"firstName": "Joe",
	"lastName": "Bloggs",
	"phoneCountry": {
		"id": 1,
		"name": "United Kingdom (+44)",
		"dialCode": "+44"
	},
	"phoneNumber": "7000000000",
	"subscribeWelcome": true,
	"subscribeBlog": true,
	"subscribeHowto": true,
	"subscribeOnboarding": true,
	"timezone": "Europe/London"
}

400

Name Description
InvalidEmail

The email address is invalid.

InvalidPassword

The password is too short.

InvalidFirstName

No first name was provided.

InvalidLastName

No last name was provided.

InvalidPhoneCountryId

The country ID did not match an allowed value.

InvalidPhoneNumber

No phone number was provided.

InvalidPhoneExtension

Phone extension has a non-allowed value.

401

Name Description
401

You are not authenticated to perform the request.

403

Name Description
403

You are not allowed to view/modify this resource.

404

Name Description
404

Resource not found.

HTTP/1.1 400 Bad Request
[{
	"fieldName": "email",
	"error": "InvalidEmail"
	"message": "Invalid email address format."
}]