### GET Request to Fetch Reward Vouchers (Bash, JavaScript, PHP, Python) Source: https://explore.pixalink.io/docs/index Demonstrates how to fetch a specific reward voucher using GET requests. Includes examples for Bash (curl), JavaScript (fetch), PHP (Guzzle), and Python (requests). All examples require an authorization key and specify content and accept headers. They also include a query parameter for including related data. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/rewards/1/vouchers/42?include=customerReward%2Creward" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/rewards/1/vouchers/42" ); const params = { "include": "customerReward,reward", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://explore.pixalink.io.test/api/rewards/1/vouchers/42'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_AUTH_KEY}', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'query' => [ 'include' => 'customerReward,reward', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://explore.pixalink.io.test/api/rewards/1/vouchers/42' params = { 'include': 'customerReward,reward', } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Get Reward Vouchers Request Examples Source: https://explore.pixalink.io/docs/index Demonstrates how to fetch reward vouchers using various programming languages. It includes setting up the request URL, headers for authentication and content type, and the request body for filtering and pagination. The examples cover cURL, JavaScript, PHP, and Python. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/rewards/8/vouchers" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data "{\ \"status\": \"Active\",\ \"search\": \"REWARD123\",\ \"page\": 1,\ \"per_page\": 15 }" ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/rewards/8/vouchers" ); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; let body = { "status": "Active", "search": "REWARD123", "page": 1, "per_page": 15 }; fetch(url, { method: "GET", headers, body: JSON.stringify(body), }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://explore.pixalink.io.test/api/rewards/8/vouchers'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_AUTH_KEY}', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => [ 'status' => 'Active', 'search' => 'REWARD123', 'page' => 1, 'per_page' => 15, ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://explore.pixalink.io.test/api/rewards/8/vouchers' payload = { "status": "Active", "search": "REWARD123", "page": 1, "per_page": 15 } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, json=payload) response.json() ``` -------------------------------- ### Example GET Request for Rewards (cURL) Source: https://explore.pixalink.io/docs/index This snippet demonstrates how to fetch rewards using cURL. It includes the endpoint, query parameters for filtering and sorting, and necessary headers for authorization and content type. Ensure you replace `{YOUR_AUTH_KEY}` with your actual authentication token. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/rewards?include=space%2CcustomerRewards&filter%5Bspace_id%5D=1&filter%5Bis_active%5D=1&filter%5Bis_redeemable%5D=1&filter%5Bis_one_time_reward%5D=&filter%5Ballow_customer_self_reward%5D=1&filter%5Bpoint_is_active%5D=1&filter%5Bcredit_is_active%5D=1&filter%5Bavailable%5D=1&filter%5Bname%5D=Birthday&sort=-created_at&per_page=15" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` -------------------------------- ### Fetch Reservations with Filters (Python) Source: https://explore.pixalink.io/docs/index Example Python code using the 'requests' library to make a GET request for reservations. It configures the request with headers and query parameters for filtering. ```python import requests import json url = 'https://explore.pixalink.io.test/api/reservations' params = { 'include': 'calendar,customer', 'filter[calendar_id]': '1', 'filter[customer_id]': '1', 'filter[status]': 'reserved', 'filter[date]': '2024-01-01', 'filter[date_from]': '2024-01-01', 'filter[date_to]': '2024-01-31', ``` -------------------------------- ### Get Customer Reward Details (Bash) Source: https://explore.pixalink.io/docs/index This example demonstrates how to retrieve details for a specific customer reward using a cURL command. It shows how to include the authorization token and specify the customer reward ID in the URL path. The request is a GET request to the /api/customer_rewards/{id} endpoint. ```bash curl --request GET \ "https://explore.pixalink.io.test/api/customer_rewards/{id}" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` -------------------------------- ### Create Reward Voucher Request Example Source: https://explore.pixalink.io/docs/index This example shows how to create a reward voucher using a POST request. It requires specifying the reward ID in the URL and providing authentication and content type headers. The request body can include details for the new voucher, though this specific example implies a basic creation process. ```bash curl --request POST \ --url https://explore.pixalink.io.test/api/rewards/9/vouchers \ --header 'Authorization: Bearer {YOUR_AUTH_KEY}' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' ``` -------------------------------- ### Fetch POS Transactions (Python) Source: https://explore.pixalink.io/docs/index Example using Python's requests library to make a GET request for POS transactions. It demonstrates how to define the URL, query parameters, and headers for authentication and content type. ```python import requests import json url = 'https://explore.pixalink.io.test/api/posTransaction' params = { 'filter[status]': 'adopted', 'filter[space_id]': '1', 'filter[transaction_time]': '2025-05-06', 'filter[amount_min]': '50', 'filter[amount_max]': '500', 'filter[ref_id]': 'TRX-123', 'sort': '-transaction_time', 'include': 'space', 'page': '1', 'per_page': '15', } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Get Countries API Request Examples Source: https://explore.pixalink.io/docs/index Examples of how to make a GET request to the /api/countries endpoint. This includes filtering by name, nationality, ISO code, and pagination. Authentication is required via a Bearer token. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/countries?filter%5Bname%5D=Malaysia&filter%5Bnationality%5D=Malaysian&filter%5Biso%5D=MY&per_page=15" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/countries" ); const params = { "filter[name]": "Malaysia", "filter[nationality]": "Malaysian", "filter[iso]": "MY", "per_page": "15", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://explore.pixalink.io.test/api/countries'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_AUTH_KEY}', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'query' => [ 'filter[name]' => 'Malaysia', 'filter[nationality]' => 'Malaysian', 'filter[iso]' => 'MY', 'per_page' => '15', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://explore.pixalink.io.test/api/countries' params = { 'filter[name]': 'Malaysia', 'filter[nationality]': 'Malaysian', 'filter[iso]': 'MY', 'per_page': '15', } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Get Reward Information with Query Parameters (Bash, JavaScript, PHP, Python) Source: https://explore.pixalink.io/docs/index This snippet demonstrates how to fetch reward details, optionally including related data like 'space' or 'customerRewards' through the 'include' query parameter. It shows examples for Bash (curl), JavaScript (fetch), PHP (Guzzle), and Python (requests). Ensure you replace '{YOUR_AUTH_KEY}' with your actual authentication token. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/rewards/1?include=space%2CcustomerRewards" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/rewards/1" ); const params = { "include": "space,customerRewards", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://explore.pixalink.io.test/api/rewards/1'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_AUTH_KEY}', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'query' => [ 'include' => 'space,customerRewards', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://explore.pixalink.io.test/api/rewards/1' params = { 'include': 'space,customerRewards', } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Create Calendar Request Examples Source: https://explore.pixalink.io/docs/index Examples of how to create a calendar using the Pixalink API. These examples demonstrate the structure of the POST request, including headers and the JSON request body. ```bash curl --request POST \ "https://explore.pixalink.io.test/api/calendars" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data "{ \"name\": \"Meeting Room A\", \"slug\": \"meeting-room-a\", \"description\": \"Large meeting room for up to 20 people\", \"space_id\": 1, \"is_active\": true, \"visibility\": \"Public\", \"min_capacity\": 1, \"max_capacity\": 20, \"is_required_approval\": false, \"is_auto_approval\": true, \"cancel_before_minutes\": 60, \"book_before_minutes\": 30, \"reminder_minutes\": 15, \"crm_auto_import\": true, \"is_unavailable_timeslots_visible\": false, \"is_qr_code_visible\": true, \"default_timeslots\": [ \"laudantium\" ], \"block_dates\": [ \"harum\" ], \"notification_settings\": { \"new_reservation\": { \"enabled\": true, \"message\": \"Your reservation has been confirmed\" } } }" ``` ```javascript const createCalendar = async (authKey) => { const response = await fetch('https://explore.pixalink.io.test/api/calendars', { method: 'POST', headers: { 'Authorization': `Bearer ${authKey}`, 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify({ name: 'Meeting Room A', slug: 'meeting-room-a', description: 'Large meeting room for up to 20 people', space_id: 1, is_active: true, visibility: 'Public', min_capacity: 1, max_capacity: 20, is_required_approval: false, is_auto_approval: true, cancel_before_minutes: 60, book_before_minutes: 30, reminder_minutes: 15, crm_auto_import: true, is_unavailable_timeslots_visible: false, is_qr_code_visible: true, default_timeslots: ['laudantium'], block_dates: ['harum'], notification_settings: { new_reservation: { enabled: true, message: 'Your reservation has been confirmed' } } }) }); return response.json(); }; ``` ```php 'Meeting Room A', 'slug' => 'meeting-room-a', 'description' => 'Large meeting room for up to 20 people', 'space_id' => 1, 'is_active' => true, 'visibility' => 'Public', 'min_capacity' => 1, 'max_capacity' => 20, 'is_required_approval' => false, 'is_auto_approval' => true, 'cancel_before_minutes' => 60, 'book_before_minutes' => 30, 'reminder_minutes' => 15, 'crm_auto_import' => true, 'is_unavailable_timeslots_visible' => false, 'is_qr_code_visible' => true, 'default_timeslots' => ['laudantium'], 'block_dates' => ['harum'], 'notification_settings' => [ 'new_reservation' => [ 'enabled' => true, 'message' => 'Your reservation has been confirmed' ] ] ]; $options = [ 'http' => [ 'method' => 'POST', 'header' => "Authorization: Bearer $authKey\r\nContent-Type: application/json\r\nAccept: application/json\r\n", 'content' => json_encode($data) ] ]; $context = stream_context_create($options); $result = file_get_contents('https://explore.pixalink.io.test/api/calendars', false, $context); print_r(json_decode($result)); ?> ``` ```python import requests import json auth_key = 'YOUR_AUTH_KEY' url = 'https://explore.pixalink.io.test/api/calendars' data = { 'name': 'Meeting Room A', 'slug': 'meeting-room-a', 'description': 'Large meeting room for up to 20 people', 'space_id': 1, 'is_active': True, 'visibility': 'Public', 'min_capacity': 1, 'max_capacity': 20, 'is_required_approval': False, 'is_auto_approval': True, 'cancel_before_minutes': 60, 'book_before_minutes': 30, 'reminder_minutes': 15, 'crm_auto_import': True, 'is_unavailable_timeslots_visible': False, 'is_qr_code_visible': True, 'default_timeslots': ['laudantium'], 'block_dates': ['harum'], 'notification_settings': { 'new_reservation': { 'enabled': True, 'message': 'Your reservation has been confirmed' } } } headers = { 'Authorization': f'Bearer {auth_key}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json()) ``` -------------------------------- ### GET Cities - Bash Source: https://explore.pixalink.io/docs/index Example of how to make a GET request to the cities endpoint using Bash and cURL. This includes setting authorization headers, content type, accept type, and query parameters for filtering, including related data, sorting, and pagination. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/cities?filter%5Bname%5D=Petaling+Jaya&filter%5Bstate_id%5D=1&include=state%2Cstate.country&sort=-name&per_page=15" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` -------------------------------- ### Create Reservation Request Examples Source: https://explore.pixalink.io/docs/index Examples of how to send a POST request to create a reservation using the Pixalink API. This includes the endpoint, headers, and a JSON payload structure. The examples are provided in cURL, JavaScript, and PHP for cross-platform compatibility. ```bash curl --request POST \ "https://explore.pixalink.io.test/api/reservations" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data "{ \"date\": \"2024-03-15\", \"start_at\": \"2024-03-15T14:30:00Z\", \"end_at\": \"2024-03-15T16:00:00Z\", \"name\": \"John Smith\", \"email\": \"john.smith@example.com\", \"phone_number\": \"+60123456789\", \"number_of_guests\": 4, \"status\": \"pending\", \"remarks\": \"Birthday celebration, window seat preferred\", \"custom_fields\": { \"dietary_requirements\": \"Vegetarian\", \"special_requests\": \"Birthday cake arrangement\" }, \"timeslot_id\": 5, \"calendar_id\": 1, \"customer_id\": 123, \"rejection_reason\": \"Fully booked on requested date\" }" ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/reservations" ); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; let body = { "date": "2024-03-15", "start_at": "2024-03-15T14:30:00Z", "end_at": "2024-03-15T16:00:00Z", "name": "John Smith", "email": "john.smith@example.com", "phone_number": "+60123456789", "number_of_guests": 4, "status": "pending", "remarks": "Birthday celebration, window seat preferred", "custom_fields": { "dietary_requirements": "Vegetarian", "special_requests": "Birthday cake arrangement" }, "timeslot_id": 5, "calendar_id": 1, "customer_id": 123, "rejection_reason": "Fully booked on requested date" }; fetch(url, { method: "POST", headers, body: JSON.stringify(body), }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); ``` -------------------------------- ### Reward Body Parameters Example Source: https://explore.pixalink.io/docs/index An example JSON object demonstrating the structure and values for reward creation. It includes details like name, description, validity dates, redemption options (points and credits), and notification settings. ```json { "name": "Birthday Reward", "description": "Special reward for customer birthdays", "terms": "Valid for 30 days from issue", "space_id": 1, "is_active": true, "start_at": "2025-01-01", "end_at": "2025-12-31", "is_redeemable": true, "is_custom_valid_days": true, "valid_days": 30, "amount": 1000, "point_is_active": true, "credit_is_active": true, "credit_amount": "10.50", "credit_earn_point": false, "allow_customer_self_reward": true, "is_one_time_reward": true, "is_direct_link_accessible": false, "is_limit_total_availability": true, "total_availability": 100, "cover": "gift", "custom_cover": null, "automations": null, "notification_settings": { "new_reward": { "is_enabled": false, "message": "Hi {{NAME}}, you have received a new reward from {{SPACE_NAME}}!" }, "expired_reward": { "is_enabled": false, "message": "Hi {{NAME}}, your reward from {{SPACE_NAME}} has expired." }, "expiring_reward": { "is_enabled": false, "message": "Hi {{NAME}}, your reward from {{SPACE_NAME}} is expiring soon.", "send_notification_before": "eum" } } } ``` -------------------------------- ### GET Cities - Javascript Source: https://explore.pixalink.io/docs/index Demonstrates making a GET request to the cities endpoint using Javascript's Fetch API. It shows how to construct the URL with query parameters and set necessary headers for authorization and content negotiation. ```javascript const url = new URL( "https://explore.pixalink.io.test/api/cities" ); const params = { "filter[name]": "Petaling Jaya", "filter[state_id]": "1", "include": "state,state.country", "sort": "-name", "per_page": "15", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### Fetch Customers with Filters (cURL) Source: https://explore.pixalink.io/docs/index Example demonstrating how to fetch customer data using the cURL command-line tool. It includes various filters for customer attributes, relationships, sorting, and pagination. Ensure you replace '{YOUR_AUTH_KEY}' with your actual API key. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/customers?include=space&filter%5Bphone_number%5D=88888888+%28matches+%2B60188888888%29&filter%5Bemail%5D=customer%40example.com&filter%5Bgender%5D=1&filter%5Bsource%5D=WhatsApp&filter%5Bstatus%5D=Lead&filter%5Bcurrent_point%5D=%3E100&filter%5Bcurrent_credits%5D=%3E50&filter%5Bcreated_at%5D=2024-01-01&filter%5Bupdated_at%5D=%3C2024-12-31&filter%5Btier%5D=1&filter%5Bspace%5D=1&filter%5Bhas_tags%5D=VIP&filter%5Bname%5D=John&filter%5Bbirthday_month%5D=10&sort=-created_at&per_page=15" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` -------------------------------- ### Get Calendars API Request Examples Source: https://explore.pixalink.io/docs/index Demonstrates how to fetch calendar data using the Pixalink API. It includes examples for constructing the GET request with various query parameters for filtering, sorting, and inclusion of related data. Authentication is handled via a Bearer token. ```bash curl --request GET \ --get "https://explore.pixalink.io.test/api/calendars?include=space%2Creservations&filter%5Bspace_id%5D=1&filter%5Bis_active%5D=1&filter%5Bvisibility%5D=Public&filter%5Bname%5D=Meeting+Room&sort=-created_at&per_page=15" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/calendars" ); const params = { "include": "space,reservations", "filter[space_id]": "1", "filter[is_active]": "1", "filter[visibility]": "Public", "filter[name]": "Meeting Room", "sort": "-created_at", "per_page": "15", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```php $client = new \GuzzleHttp\Client(); $url = 'https://explore.pixalink.io.test/api/calendars'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_AUTH_KEY}', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'query' => [ 'include' => 'space,reservations', 'filter[space_id]' => '1', 'filter[is_active]' => '1', 'filter[visibility]' => 'Public', 'filter[name]' => 'Meeting Room', 'sort' => '-created_at', 'per_page' => '15', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ```python import requests import json url = 'https://explore.pixalink.io.test/api/calendars' params = { 'include': 'space,reservations', 'filter[space_id]': '1', 'filter[is_active]': '1', 'filter[visibility]': 'Public', 'filter[name]': 'Meeting Room', 'sort': '-created_at', 'per_page': '15', } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Example API Request (cURL, JavaScript, PHP, Python) Source: https://explore.pixalink.io/docs/index Provides example API requests for updating a reward using cURL, JavaScript, PHP, and Python. It demonstrates how to set authorization headers, content type, and the JSON payload for the request. Ensure to replace {YOUR_AUTH_KEY} with your actual authentication token. ```bash curl --request PUT \ "https://explore.pixalink.io.test/api/rewards/1" \ --header "Authorization: Bearer {YOUR_AUTH_KEY}" \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data "{ \"name\": \"Birthday Reward\", \"description\": \"Special reward for customer birthdays\", \"terms\": \"Valid for 30 days from issue\", \"space_id\": 1, \"is_active\": true, \"start_at\": \"2025-01-01\", \"end_at\": \"2025-12-31\", \"is_redeemable\": true, \"is_custom_valid_days\": true, \"valid_days\": 30, \"amount\": 1000, \"point_is_active\": true, \"credit_is_active\": true, \"credit_amount\": \"10.50\", \"credit_earn_point\": false, \"allow_customer_self_reward\": true, \"is_one_time_reward\": true, \"is_direct_link_accessible\": false, \"is_limit_total_availability\": true, \"total_availability\": 100, \"cover\": \"gift\", \"custom_cover\": null, \"automations\": null, \"notification_settings\": { \"new_reward\": { \"is_enabled\": false, \"message\": \"repudiandae\" }, \"expired_reward\": { \"is_enabled\": false, \"message\": \"Hi {{NAME}}, your reward has expired.\" }, \"expiring_reward\": { \"is_enabled\": false, \"message\": \"Hi {{NAME}}, your reward will expire soon!\", \"send_notification_before\": \"7\" } } }" ``` ```javascript const options = { method: 'PUT', headers: { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify({ name: 'Birthday Reward', description: 'Special reward for customer birthdays', terms: 'Valid for 30 days from issue', space_id: 1, is_active: true, start_at: '2025-01-01', end_at: '2025-12-31', is_redeemable: true, is_custom_valid_days: true, valid_days: 30, amount: 1000, point_is_active: true, credit_is_active: true, credit_amount: '10.50', credit_earn_point: false, allow_customer_self_reward: true, is_one_time_reward: true, is_direct_link_accessible: false, is_limit_total_availability: true, total_availability: 100, cover: 'gift', custom_cover: null, automations: null, notification_settings: { new_reward: { is_enabled: false, message: 'repudiandae' }, expired_reward: { is_enabled: false, message: 'Hi {{NAME}}, your reward has expired.' }, expiring_reward: { is_enabled: false, message: 'Hi {{NAME}}, your reward will expire soon!', send_notification_before: '7' } } }) }; fetch('https://explore.pixalink.io.test/api/rewards/1', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` ```php 'https://explore.pixalink.io.test/api/rewards/1', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => json_encode([ 'name' => 'Birthday Reward', 'description' => 'Special reward for customer birthdays', 'terms' => 'Valid for 30 days from issue', 'space_id' => 1, 'is_active' => true, 'start_at' => '2025-01-01', 'end_at' => '2025-12-31', 'is_redeemable' => true, 'is_custom_valid_days' => true, 'valid_days' => 30, 'amount' => 1000, 'point_is_active' => true, 'credit_is_active' => true, 'credit_amount' => '10.50', 'credit_earn_point' => false, 'allow_customer_self_reward' => true, 'is_one_time_reward' => true, 'is_direct_link_accessible' => false, 'is_limit_total_availability' => true, 'total_availability' => 100, 'cover' => 'gift', 'custom_cover' => null, 'automations' => null, 'notification_settings' => [ 'new_reward' => ['is_enabled' => false, 'message' => 'repudiandae'], 'expired_reward' => ['is_enabled' => false, 'message' => 'Hi {{NAME}}, your reward has expired.'], 'expiring_reward' => ['is_enabled' => false, 'message' => 'Hi {{NAME}}, your reward will expire soon!', 'send_notification_before' => '7'] ] ]), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {YOUR_AUTH_KEY}', 'Content-Type: application/json', 'Accept: application/json' ), ])); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ```python import requests import json url = "https://explore.pixalink.io.test/api/rewards/1" payload = json.dumps({ "name": "Birthday Reward", "description": "Special reward for customer birthdays", "terms": "Valid for 30 days from issue", "space_id": 1, "is_active": True, "start_at": "2025-01-01", "end_at": "2025-12-31", "is_redeemable": True, "is_custom_valid_days": True, "valid_days": 30, "amount": 1000, "point_is_active": True, "credit_is_active": True, "credit_amount": "10.50", "credit_earn_point": False, "allow_customer_self_reward": True, "is_one_time_reward": True, "is_direct_link_accessible": False, "is_limit_total_availability": True, "total_availability": 100, "cover": "gift", "custom_cover": None, "automations": None, "notification_settings": { "new_reward": { "is_enabled": False, "message": "repudiandae" }, "expired_reward": { "is_enabled": False, "message": "Hi {{NAME}}, your reward has expired." }, "expiring_reward": { "is_enabled": False, "message": "Hi {{NAME}}, your reward will expire soon!", "send_notification_before": "7" } } }) headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('PUT', url, headers=headers, data=payload) print(response.text) ``` -------------------------------- ### Fetch Reservations with Filters (JavaScript) Source: https://explore.pixalink.io/docs/index Example JavaScript code using the Fetch API to make a GET request to retrieve reservations. It demonstrates setting up URL parameters and headers for authentication and filtering. ```javascript const url = new URL( "https://explore.pixalink.io.test/api/reservations" ); const params = { "include": "calendar,customer", "filter[calendar_id]": "1", "filter[customer_id]": "1", "filter[status]": "reserved", "filter[date]": "2024-01-01", "filter[date_from]": "2024-01-01", "filter[date_to]": "2024-01-31", "filter[name]": "John", "filter[email]": "john@example.com", "filter[phone_number]": "+60123", "sort": "-date", "per_page": "15", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` -------------------------------- ### Import Vouchers API Request Example Source: https://explore.pixalink.io/docs/.postman Demonstrates how to make an asynchronous API request to import multiple vouchers for a reward. The API processes these imports in chunks and has limitations on the number of vouchers per request and the request rate. ```JSON { "headers": [ { "key": "Content-Type", "value": "application\/json" }, { "key": "Accept", "value": "application\/json" } ], "body": { "mode": "raw", "raw": "{\"vouchers\":[{\"code\":\"REWARD123\",\"expired_at\":\"2024-12-31T23:59:59Z\"}]}" }, "description": "Import multiple vouchers for a reward asynchronously. The operation is queued and processed in chunks of 100 records.\nLimited to 10,000 vouchers per request and rate limited to 10 requests per minute." } ``` -------------------------------- ### List Transactions API Request Examples Source: https://explore.pixalink.io/docs/index Demonstrates how to list transactions using the Pixalink API. It covers various programming languages and includes query parameters for filtering and sorting. The endpoint used is GET /api/transactions. ```bash curl --request GET \ 'https://explore.pixalink.io.test/api/transactions?filter[customer_id]=1&filter[type]=Purchase&filter[amount]=>100&sort=-created_at&include=customer,reward,customerRewards&per_page=15' \ --header 'Authorization: Bearer {YOUR_AUTH_KEY}' \ --header 'Accept: application/json' ``` ```javascript const url = new URL( "https://explore.pixalink.io.test/api/transactions" ); url.searchParams.set('filter[customer_id]', '1'); url.searchParams.set('filter[type]', 'Purchase'); url.searchParams.set('filter[amount]', '>100'); url.searchParams.set('sort', '-created_at'); url.searchParams.set('include', 'customer,reward,customerRewards'); url.searchParams.set('per_page', '15'); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ``` ```python import requests url = 'https://explore.pixalink.io.test/api/transactions' headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Accept': 'application/json' } params = { 'filter[customer_id]': '1', 'filter[type]': 'Purchase', 'filter[amount]': '>100', 'sort': '-created_at', 'include': 'customer,reward,customerRewards', 'per_page': '15' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Update Space Information (Example) Source: https://explore.pixalink.io/docs/index Demonstrates how to update an existing space's details using a PUT or PATCH request. Requires authentication and the space ID in the URL. ```http PUT / PATCH https://explore.pixalink.io.test/api/spaces/{id} Headers: Authorization: Bearer {YOUR_AUTH_KEY} Content-Type: application/json Accept: application/json URL Parameters: id: integer (required) - The ID of the space. ``` -------------------------------- ### GET Cities - PHP Source: https://explore.pixalink.io/docs/index Provides a PHP example using the Guzzle HTTP client to fetch city data. It illustrates setting request headers and query parameters for filtering, including related data, sorting, and pagination. ```php $client = new \GuzzleHttp\Client(); $url = 'https://explore.pixalink.io.test/api/cities'; $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bearer {YOUR_AUTH_KEY}', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'query' => [ 'filter[name]' => 'Petaling Jaya', 'filter[state_id]' => '1', 'include' => 'state,state.country', 'sort' => '-name', 'per_page' => '15', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### GET Cities - Python Source: https://explore.pixalink.io/docs/index A Python example using the requests library to retrieve city data. This code snippet shows how to configure the request with appropriate headers and query parameters for filtering, including relationships, sorting, and per-page limits. ```python import requests import json url = 'https://explore.pixalink.io.test/api/cities' params = { 'filter[name]': 'Petaling Jaya', 'filter[state_id]': '1', 'include': 'state,state.country', 'sort': '-name', 'per_page': '15', } headers = { 'Authorization': 'Bearer {YOUR_AUTH_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json' } response = requests.request('GET', url, headers=headers, params=params) response.json() ``` -------------------------------- ### Fetch Customers with Filters (JavaScript) Source: https://explore.pixalink.io/docs/index Example demonstrating how to fetch customer data using JavaScript's `fetch` API. It constructs a URL with query parameters for filtering, sorting, and pagination, and includes necessary authorization and content type headers. The response is processed as JSON. ```javascript const url = new URL( "https://explore.pixalink.io.test/api/customers" ); const params = { "include": "space", "filter[phone_number]": "88888888 (matches +60188888888)", "filter[email]": "customer@example.com", "filter[gender]": "1", "filter[source]": "WhatsApp", "filter[status]": "Lead", "filter[current_point]": ">100", "filter[current_credits]": ">50", "filter[created_at]": "2024-01-01", "filter[updated_at]": "<2024-12-31", "filter[tier]": "1", "filter[space]": "1", "filter[has_tags]": "VIP", "filter[name]": "John", "filter[birthday_month]": "10", "sort": "-created_at", "per_page": "15", }; Object.keys(params) .forEach(key => url.searchParams.append(key, params[key])); const headers = { "Authorization": "Bearer {YOUR_AUTH_KEY}", "Content-Type": "application/json", "Accept": "application/json", }; fetch(url, { method: "GET", headers, }).then(response => response.json()); ```