GET /api/v1/customers
List Customers
Retrieves a paginated list of all previously-registered customers. Does not reveal saved payment details.
サンプル
- cURL
- Node.js
- Ruby
curl -X GET https://komoju.com/api/v1/customers \
-u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var get_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/customers',
method: 'GET',
headers: {
'Authorization': auth
}
};
var get_req = https.request(get_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
get_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/customers')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
res = https.get(uri.path, headers)
puts res.body
{
"resource": "list",
"total": 3,
"page": 1,
"per_page": 10,
"last_page": 1,
"data": [
{
"id": "8xk3c2swi2qqnt1edef0g29jd",
"resource": "customer",
"email": "jackwaelchi@spinka.net",
"source": null,
"metadata": {
"order_id": "abcdefg"
},
"created_at": "2020-06-09T07:41:50Z"
},
{
"id": "9jy33f1bcnw7vapbheek1nrj4",
"resource": "customer",
"email": "rorygorczany@stroman.org",
"source": null,
"metadata": {
"order_id": "abcdefg"
},
"created_at": "2020-06-09T07:41:50Z"
},
{
"id": "6mpr3pzet34ifzvgyt60mmtee",
"resource": "customer",
"email": "ola@turner.net",
"source": null,
"metadata": {
"order_id": "abcdefg"
},
"created_at": "2020-06-09T07:41:50Z"
}
]
}
パラメータ
名前 | 説明 |
---|---|
start_time 任意 |
Query for records created after this time. |
end_time 任意 |
Query for records created before this time. |
per_page 任意 |
How many complete objects per page. |
page 任意 |
Page number to query for. |