Operations with customers

Operations with Customers - GET, INSERT, UPDATE, DELETE

How to get customer by email
GET /odata/customer('email')

Request Type: GET

Enter the request URL: http://StoreURL/odata/customer('email')

Auth type: Bearer Token - paste the token generated in the previous steps

How to delete customer
DELETE /odata/customer('email')

Request Type: DELETE

Enter the request URL: http://StoreURL/odata/customer('email')

Auth type: Bearer Token - paste the token generated in the previous steps

Please note that in DELETE operations, you will get only "Status: 200 OK" information if the item was successfully deleted.

How to add new customer
POST /odata/customer

Request Type: POST

Enter the request URL: http://StoreURL/odata/customer

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page. 

URGENT: You don't have to specify all fields. You can add only that fields, which are important for you. Edit fields which you want, the rest can be removed and they will get a default value. Please note that e-mail and customer group are required to create a fully working customer.

How to update customer
POST /odata/customer

Request Type: POST

Enter the request URL: http://StoreURL/odata/customer

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page.  

How to update whole customer
PUT /odata/customer('email')

Request Type: PUT

Enter the request URL: http://StoreURL/odata/customer('email')

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page. 

URGENT: It's the PUT request, so you have to provide all available fields, also with the "id" field. 

How to set password
POST /odata/customer('email')/SetPassword

Request Type: POST

Enter the request URL: http://StoreURL/odata/customer('email')/SetPassword

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page. 

{
"password":"Enter password"
}

How to add new address to customer
POST /odata/customer('email')/AddAddress

Request Type: POST

Enter the request URL: http://StoreURL/odata/customer('email')/AddAddress

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page. What's important, API validate fields like store, so if you have Country enabled, you need to enter CountryId. In the other case you will receive error. CountryId and StateProvinceId can be found in the database.

How to update customer address
POST /odata/customer('email')/UpdateAddress

Request Type: POST

Enter the request URL: http://StoreURL/odata/customer('email')/UpdateAddress

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page. In the update method, you need to enter the ID in proper field. 

How to delete customer address
POST /odata/customer('email')/DeleteAddress

Request Type: POST

Enter the request URL: http://StoreURL/odata/customer('email')/DeleteAddress

Auth type: Bearer Token - paste the token generated in the previous steps

Headers: In the Key field enter the Content-Type, in Value field enter the application/json, description is empty.

Body: In the body field you need to enter the proper JSON. Which fields are necessary for specified actions you can check in the bottom of $metadata page.