Error
A valid request URL is required to generate request examples{
"user": {
"id": 123,
"date_registered": "2024-01-15T10:30:00",
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"display_name": "John Doe",
"addresses": {
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"phone": "+1234567890",
"email": "john@example.com"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US"
}
},
"orders_count": 15,
"total_spent": "$1,234.56",
"is_paying_customer": true,
"avatar_url": "https://secure.gravatar.com/avatar/abc123?s=96&d=mm&r=g"
},
"recent_order": {
"order_id": 789,
"order_date": "2024-12-15T14:20:00",
"order_data": "https://example.com/wp-json/cocart/preview/my-account/orders/789"
},
"meta": {
"is_customer_outside_base": false,
"is_vat_exempt": false
},
"extensions": {}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}My Account
Retrieve customer account information including profile data and order statistics
GET
/
my-account
Get customer account details
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "{protocol}://{host}/wp-json/cocart/preview/my-account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/my-account"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/preview/my-account")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"user": {
"id": 123,
"date_registered": "2024-01-15T10:30:00",
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"display_name": "John Doe",
"addresses": {
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"phone": "+1234567890",
"email": "john@example.com"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US"
}
},
"orders_count": 15,
"total_spent": "$1,234.56",
"is_paying_customer": true,
"avatar_url": "https://secure.gravatar.com/avatar/abc123?s=96&d=mm&r=g"
},
"recent_order": {
"order_id": 789,
"order_date": "2024-12-15T14:20:00",
"order_data": "https://example.com/wp-json/cocart/preview/my-account/orders/789"
},
"meta": {
"is_customer_outside_base": false,
"is_vat_exempt": false
},
"extensions": {}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}This endpoint is currently shown as a preview of what’s currently in development and is subject to change.
Authorizations
basicAuthbearerAuth
WordPress username and password
⌘I