curl -X POST "https://api.playground.try.be/customers/signup-tokens" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"membership_type_id": "000000-000000-000000-000000",
"membership_rate_id": "000000-000000-000000-000000",
"start_date": "2021-02-21",
"end_date": "2022-02-21",
"duration": "P1M",
"max_uses": 1,
"first_name": "Dan",
"last_name": "Johnson",
"email": "dan.johnson@example.com"
}'
const response = await fetch('https://api.playground.try.be/customers/signup-tokens', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
"membership_type_id": "000000-000000-000000-000000",
"membership_rate_id": "000000-000000-000000-000000",
"start_date": "2021-02-21",
"end_date": "2022-02-21",
"duration": "P1M",
"max_uses": 1,
"first_name": "Dan",
"last_name": "Johnson",
"email": "dan.johnson@example.com"
}),
})
if (!response.ok) {
throw new Error(`Trybe API ${response.status}: ${await response.text()}`)
}
const data = await response.json()
import httpx
response = httpx.post(
"https://api.playground.try.be/customers/signup-tokens",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"membership_type_id": "000000-000000-000000-000000",
"membership_rate_id": "000000-000000-000000-000000",
"start_date": "2021-02-21",
"end_date": "2022-02-21",
"duration": "P1M",
"max_uses": 1,
"first_name": "Dan",
"last_name": "Johnson",
"email": "dan.johnson@example.com"
},
)
response.raise_for_status()
data = response.json()
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.playground.try.be/customers/signup-tokens', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'membership_type_id' => '000000-000000-000000-000000',
'membership_rate_id' => '000000-000000-000000-000000',
'start_date' => '2021-02-21',
'end_date' => '2022-02-21',
'duration' => 'P1M',
'max_uses' => 1,
'first_name' => 'Dan',
'last_name' => 'Johnson',
'email' => 'dan.johnson@example.com'
],
]);
$data = json_decode($response->getBody(), true);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"membership_type_id": "000000-000000-000000-000000",
"membership_rate_id": "000000-000000-000000-000000",
"start_date": "2021-02-21",
"end_date": "2022-02-21",
"duration": "P1M",
"max_uses": 1,
"first_name": "Dan",
"last_name": "Johnson",
"email": "dan.johnson@example.com",
})
req, _ := http.NewRequest("POST", "https://api.playground.try.be/customers/signup-tokens", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
}