### Get Products Summary - Node.js Example Source: https://developers.sitevibes.com/reference/reviews An example of making a GET request to the Products Summary API using Node.js with the `axios` library. It shows how to construct the URL with query parameters and handle the JSON response. ```javascript const axios = require('axios'); const options = { method: 'GET', url: 'https://api.sitevibes.com/v1/product-summary', params: { page: '1', limit: '20' }, headers: { 'accept': 'application/json' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` -------------------------------- ### Get Products Summary - Ruby Example Source: https://developers.sitevibes.com/reference/reviews A Ruby example for calling the Products Summary API. It uses the `httparty` gem to make a GET request with specified query parameters and handles the response. Basic error handling is provided. ```ruby require 'httparty' url = 'https://api.sitevibes.com/v1/product-summary' options = { query: { page: 1, limit: 20 }, headers: { 'accept' => 'application/json' } } begin response = HTTParty.get(url, options) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end rescue HTTParty::Error => e puts "HTTParty Error: #{e.message}" end ``` -------------------------------- ### Get Products Summary - Python Example Source: https://developers.sitevibes.com/reference/reviews This Python snippet illustrates how to retrieve the product summary using the `requests` library. It constructs the request with URL parameters and displays the JSON response. Error handling for the request is also included. ```python import requests url = "https://api.sitevibes.com/v1/product-summary" params = { "page": 1, "limit": 20 } headers = { "accept": "application/json" } try: response = requests.get(url, params=params, headers=headers) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### Get Products Summary - cURL Request Source: https://developers.sitevibes.com/reference/reviews This snippet demonstrates how to fetch the product summary using cURL. It includes the GET request method, the base URL, and example query parameters for pagination. The `accept` header is set to `application/json`. ```shell curl --request GET \ --url 'https://api.sitevibes.com/v1/product-summary?page=1&limit=20' \ --header 'accept: application/json' ``` -------------------------------- ### Get Products Summary - PHP Example Source: https://developers.sitevibes.com/reference/reviews This PHP code snippet demonstrates how to make a GET request to the Products Summary API using cURL. It sets the URL, query parameters, and headers, then executes the request and outputs the JSON response. ```php ``` -------------------------------- ### GET /products Source: https://developers.sitevibes.com/reference/get_trending-feed Retrieves a list of products with filtering and pagination options. ```APIDOC ## GET /products ### Description Retrieves a list of products. Supports filtering by various criteria and pagination for managing large result sets. ### Method GET ### Endpoint /products ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. - **limit** (integer) - Optional - The number of items per page. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the product listing and pagination details. - **page** (integer) - The current page number. - **limit** (integer) - The number of items per page. - **total** (integer) - The total number of available products. - **items** (array) - An array of product objects. - **product_id** (string) - The unique identifier for the product. - **name** (string) - The name of the product. - **description** (string, nullable) - A description of the product. - **brand** (string, nullable) - The brand of the product. - **price** (integer) - The base price of the product. - **price_range** (array) - A range of prices for the product. - **price_formatted** (string) - The formatted price of the product. - **price_sale** (integer) - The sale price of the product. - **price_sale_range** (array) - A range of sale prices for the product. - **price_sale_formatted** (string) - The formatted sale price of the product. - **price_save** (integer) - The amount saved on the product. - **price_save_formatted** (string) - The formatted amount saved. - **categories** (array) - An array of categories the product belongs to. - **url** (string) - The URL to the product page. - **image** (string) - The URL of the product image. - **quantity** (integer) - The available quantity of the product. - **quantity_formatted** (integer) - The formatted available quantity. #### Response Example ```json { "data": { "page": 1, "limit": 20, "total": 1000, "items": [ { "product_id": "1001", "name": "Example product name", "description": "Example product description", "brand": "Example brand", "price": 3999, "price_range": [ 1999, 3999 ], "price_formatted": "$19.99 - $39.99", "price_sale": 2999, "price_sale_range": [ 1599, 2999 ], "price_sale_formatted": "$15.99 - $28.99", "price_save": 10000, "price_save_formatted": "$10.00", "categories": [ "Shoes", "Men" ], "url": "https://example.com/product/1", "image": "https://example.com/product/1/thumb.jpg", "quantity": 1000, "quantity_formatted": "1,000" } ] } } ``` ``` -------------------------------- ### GET /websites/{website_id}/products/{product_id} Source: https://developers.sitevibes.com/reference/get_product-questions-productid Retrieves details of a specific product, including its questions and answers. Requires authentication. ```APIDOC ## GET /websites/{website_id}/products/{product_id} ### Description Retrieves detailed information about a specific product, including its associated questions and answers. This endpoint is protected and requires an authentication token. ### Method GET ### Endpoint `/websites/{website_id}/products/{product_id}` ### Parameters #### Path Parameters - **website_id** (string) - Required - The unique identifier for the website. - **product_id** (string) - Required - The unique identifier for the product. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the product details, including an array of questions. - **id** (string) - The product's unique identifier. - **name** (string) - The name of the product. - **description** (string) - A detailed description of the product. - **questions** (array) - A list of questions associated with the product. - **id** (string) - The question's unique identifier. - **question** (string) - The text of the question. - **answer** (object) - The answer to the question. - **content** (string) - The HTML content of the answer. - **content_stripped** (string) - The plain text version of the answer. - **country** (string) - The country associated with the answer (nullable). - **city** (string) - The city associated with the answer (nullable). - **vote_up** (integer) - The number of upvotes for the answer. - **vote_down** (integer) - The number of downvotes for the answer. - **created_date** (string) - The date the answer was created (format: date). - **created_at_text** (string) - A human-readable representation of the creation date. #### Response Example ```json { "data": { "id": "prod_123", "name": "Example Product", "description": "This is a sample product.", "questions": [ { "id": "q_456", "question": "How does this product work?", "answer": { "content": "

The product works by...

", "content_stripped": "The product works by...", "country": null, "city": null, "vote_up": 5, "vote_down": 1, "created_date": "2023-02-28T00:00:00.000Z", "created_at_text": "February 28, 2023" } } ] } } ``` #### Error Responses - **401** - Access token is missing or invalid. - **422** - Some required fields are missing or invalid. ``` -------------------------------- ### Get Member Tiers List (Node.js) Source: https://developers.sitevibes.com/reference/loyalty This Node.js snippet shows how to fetch member tiers using the 'node-fetch' library. It makes a GET request to the API endpoint and handles the JSON response. Ensure 'node-fetch' is installed (`npm install node-fetch`). ```JavaScript import fetch from 'node-fetch'; const url = 'https://api.sitevibes.com/v1/loyalty/tiers?disabled=false'; fetch(url, { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error('Error fetching member tiers:', error); }); ``` -------------------------------- ### Get Member Tiers List (Python) Source: https://developers.sitevibes.com/reference/loyalty This Python snippet utilizes the 'requests' library to make a GET request to the member tiers API. It includes error handling for the HTTP request and prints the JSON response. Ensure 'requests' is installed (`pip install requests`). ```Python import requests url = "https://api.sitevibes.com/v1/loyalty/tiers?disabled=false" headers = { 'accept': 'application/json' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error fetching member tiers: {e}") ``` -------------------------------- ### POST /websites/{website_id}/products/{product_id}/questions Source: https://developers.sitevibes.com/reference/get_product-questions Creates a new question for a specific product. Requires authentication. ```APIDOC ## POST /websites/{website_id}/products/{product_id}/questions ### Description Creates a new question for a specific product. Requires authentication. ### Method POST ### Endpoint `/websites/{website_id}/products/{product_id}/questions` ### Parameters #### Path Parameters - **website_id** (integer) - Required - The ID of the website. - **product_id** (integer) - Required - The ID of the product. #### Request Body - **question** (string) - Required - The content of the question. ### Request Example ```json { "question": "Is this product available in blue?" } ``` ### Response #### Success Response (200) - **data** (object) - An object containing the newly created question. - **id** (integer) - The ID of the question. - **product_id** (integer) - The ID of the product. - **user_id** (integer) - The ID of the user who asked the question. - **user_name** (string) - The name of the user. - **question** (string) - The content of the question. - **answer** (string) - The answer to the question (initially null). - **content_stripped** (string) - Stripped content of the answer (initially null). - **country** (string) - Null. - **city** (string) - Null. - **vote_up** (integer) - 0. - **vote_down** (integer) - 0. - **created_date** (string) - The date and time the question was created (format: date). - **created_at_text** (string) - A human-readable representation of the creation date. #### Response Example ```json { "data": { "id": 2, "product_id": 101, "user_id": 50, "user_name": "John Doe", "question": "Is this product available in blue?", "answer": null, "content_stripped": null, "country": null, "city": null, "vote_up": 0, "vote_down": 0, "created_date": "2023-03-01T10:00:00.000Z", "created_at_text": "March 01, 2023" } } ``` #### Error Response (401) - **message** (string) - Indicates an authorization error. - **status** (boolean) - False, indicating an error. - **data** (object) - Contains details about the access token issue. - **access_token** (array) - An array of strings explaining the token problem. #### Error Response (422) - **message** (string) - Indicates invalid data. - **status** (boolean) - False, indicating an error. - **errors** (object) - An object containing field-specific validation errors. - **field_name** (array) - An array of strings describing validation errors for a specific field (e.g., 'question' field is required). ``` -------------------------------- ### Get Order Review Requests (Ruby) Source: https://developers.sitevibes.com/reference/emails Example Ruby code to fetch order review requests using the 'httparty' gem. It demonstrates setting up the request URL, parameters, and headers for the GET request. ```ruby require 'httparty' class SiteVibesClient include HTTParty base_uri 'https://api.sitevibes.com/v1' def get_order_review_requests(order_id, app_id, page = 1, limit = 20) options = { query: { app_id: app_id, page: page, limit: limit }, headers: { 'accept' => 'application/json' } } self.class.get("/order-data/#{order_id}/review-requests", options) end end # Example usage: # client = SiteVibesClient.new # response = client.get_order_review_requests('YOUR_ORDER_ID', 'YOUR_APP_ID') # puts response.parsed_response ``` -------------------------------- ### Configuring Webhook Integration Source: https://developers.sitevibes.com/docs/comprehensive-guide-to-implementing-a-full-loyalty-program-using-sitevibes-api This configuration object defines the parameters for setting up webhooks. It requires app_id, scope (e.g., 'customer/loyalty/updated'), destination URL, and an enabled flag. Webhooks allow for real-time event notifications. ```javascript const webhookData = { // Required fields: app_id: "your-app-id", scope: "customer/loyalty/updated", // Available scopes: // - customer/loyalty/created: New member // - customer/loyalty/updated: Points changed destination: "https://your-domain.com/webhook-endpoint", // Your endpoint URL enabled: true // Webhook status }; ``` -------------------------------- ### Get Order Review Requests (Node.js) Source: https://developers.sitevibes.com/reference/emails Example Node.js code to make a GET request for order review requests. It uses the 'axios' library to handle the HTTP request and includes necessary headers and URL parameters. ```javascript const axios = require('axios'); const getOrderReviewRequests = async (orderId, appId, page = 1, limit = 20) => { try { const response = await axios.get(`https://api.sitevibes.com/v1/order-data/${orderId}/review-requests`, { params: { app_id: appId, page: page, limit: limit }, headers: { 'accept': 'application/json' } }); return response.data; } catch (error) { console.error('Error fetching order review requests:', error); throw error; } }; // Example usage: // getOrderReviewRequests('YOUR_ORDER_ID', 'YOUR_APP_ID').then(data => console.log(data)); ``` -------------------------------- ### Get Order Review Requests (cURL) Source: https://developers.sitevibes.com/reference/emails Example cURL request to fetch order review requests. It demonstrates how to specify the order ID and pagination parameters. ```shell curl --request GET \ --url 'https://api.sitevibes.com/v1/order-data/orderId/review-requests?page=1&limit=20' \ --header 'accept: application/json' ``` -------------------------------- ### GET /websites/developers_sitevibes/products/questions Source: https://developers.sitevibes.com/reference/get_product-questions-productid Retrieves a list of questions for a specific product. This endpoint is designed to fetch all inquiries or frequently asked questions related to a particular product. ```APIDOC ## GET /websites/developers_sitevibes/products/questions ### Description Returns a list of questions for a specific product. ### Method GET ### Endpoint /websites/developers_sitevibes/products/questions ### Parameters #### Query Parameters - **productId** (string) - Required - The unique identifier of the product for which to retrieve questions. ### Request Example ``` GET /websites/developers_sitevibes/products/questions?productId=prod123 ``` ### Response #### Success Response (200) - **questions** (array) - A list of question objects. - **questionId** (string) - The unique identifier of the question. - **questionText** (string) - The text of the question. - **askedBy** (string) - The user who asked the question. - **askedAt** (string) - The timestamp when the question was asked. #### Response Example ```json { "questions": [ { "questionId": "q1", "questionText": "What are the dimensions of this product?", "askedBy": "user123", "askedAt": "2023-10-27T10:00:00Z" }, { "questionId": "q2", "questionText": "Is this product available in blue?", "askedBy": "user456", "askedAt": "2023-10-27T11:30:00Z" } ] } ``` ``` -------------------------------- ### Get Webhooks List (Node.js) Source: https://developers.sitevibes.com/reference/webhooks This example shows how to fetch the list of webhooks using Node.js with the 'node-fetch' library. It constructs the GET request to the SiteVibes API endpoint and handles the JSON response. ```javascript const fetch = require('node-fetch'); const options = { method: 'GET', headers: { 'accept': 'application/json' } }; fetch('https://api.sitevibes.com/v1/webhooks', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Get Order Review Requests (PHP) Source: https://developers.sitevibes.com/reference/emails Example PHP code snippet using cURL to retrieve order review requests. It shows how to set the URL, request method, and accept header for the API call. ```php $appId, 'page' => $page, 'limit' => $limit ]); $fullUrl = "{$url}?{$queryParams}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $fullUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'accept: application/json' ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); return json_decode($response, true); } // Example usage: // $orderId = 'YOUR_ORDER_ID'; // $appId = 'YOUR_APP_ID'; // $data = getOrderReviewRequests($orderId, $appId); // print_r($data); ?> ``` -------------------------------- ### Get Product Questions - OpenAPI Definition Source: https://developers.sitevibes.com/reference/get_product-questions-productid This OpenAPI snippet defines the GET endpoint for retrieving product questions. It specifies path parameters like `productId`, query parameters for filtering and pagination (e.g., `app_id`, `page`, `limit`, `order_by`, `email`, `since_date`, `since_updated_at`), and includes options for fetching associated answers. The response structure includes metadata like page number, limit, and total count, along with the review data. ```json { "openapi": "3.0.0", "info": { "title": "SiteVibes - Enterprise API", "description": "This is SiteVibes Enterprise API specification", "contact": { "email": "admin@sitevibes.com" }, "version": "1.0.35" }, "externalDocs": { "description": "Find out more about SiteVibes", "url": "https://sitevibes.com/" }, "servers": [ { "url": "https://api.sitevibes.com/v1" }, { "url": "https://dev.sitevibes.com/api/v1" } ], "tags": [ { "name": "Reviews" } ], "paths": { "/product-questions/{productId}": { "get": { "tags": [ "Reviews" ], "summary": "Products Questions - Single product", "description": "Returns list of product questions", "parameters": [ { "name": "productId", "in": "path", "description": "ID of product to return", "required": true, "schema": { "type": "string", "example": 1001 } }, { "name": "app_id", "in": "query", "description": "Identifier used to differentiate different applications api is used in", "required": true, "schema": { "type": "string", "example": "openapi-test" } }, { "name": "page", "in": "query", "description": "The page of paginated data that will be returned", "required": false, "schema": { "type": "integer", "default": 1 } }, { "name": "limit", "in": "query", "description": "The maximum number of objects that may be returned", "required": false, "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } }, { "name": "order_by", "in": "query", "description": "Sorting logic for returned reviews\n * `newest` - order by Newest reviews\n * `oldest` - order by Oldest reviews\n * `votes-desc` - order by review votes descending\n * `votes-asc` - order by review votes ascending\n", "required": false, "schema": { "type": "string", "default": "newest", "enum": [ "newest", "oldest", "votes-desc", "votes-asc" ] } }, { "name": "email", "in": "query", "description": "return only questions created from specific email address", "required": false, "schema": { "type": "string", "example": "john@example.com" } }, { "name": "since_date", "in": "query", "description": "Return only questions created since selected date", "required": false, "schema": { "type": "string", "format": "date", "example": "2023-01-01T00:00:00.000Z" } }, { "name": "since_updated_at", "in": "query", "description": "Return only questions updated since selected date", "required": false, "schema": { "type": "string", "format": "date", "example": "2023-01-01T00:00:00.000Z" } }, { "name": "include", "in": "query", "description": "Include additional information\n * `answers` - include answers inside each review\n", "required": false, "schema": { "type": "string", "example": "answers" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Products Questions" }, "status": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "page": { "type": "integer", "example": 1 }, "limit": { "type": "integer", "example": 20 }, "total": { "type": "integer", "example": 50 } } } } } } } } } } } } } ``` -------------------------------- ### GET /product-questions/{productId} Source: https://developers.sitevibes.com/reference/get_product-questions-productid Retrieves a list of questions for a specific product. Supports filtering, sorting, and pagination. ```APIDOC ## GET /product-questions/{productId} ### Description Retrieves a list of product questions for a given product ID. This endpoint allows for detailed filtering based on creation date, update date, email address, and includes options for pagination and sorting. ### Method GET ### Endpoint `/product-questions/{productId}` ### Parameters #### Path Parameters - **productId** (string) - Required - ID of product to return #### Query Parameters - **app_id** (string) - Required - Identifier used to differentiate different applications api is used in - **page** (integer) - Optional - The page of paginated data that will be returned (default: 1) - **limit** (integer) - Optional - The maximum number of objects that may be returned (default: 20, min: 1, max: 100) - **order_by** (string) - Optional - Sorting logic for returned reviews (e.g., `newest`, `oldest`, `votes-desc`, `votes-asc`) (default: `newest`) - **email** (string) - Optional - Return only questions created from a specific email address - **since_date** (string) - Optional - Return only questions created since the specified date (format: `date`) - **since_updated_at** (string) - Optional - Return only questions updated since the specified date (format: `date`) - **include** (string) - Optional - Include additional information (e.g., `answers` to include answers within each review) ### Request Example ```json { "example": "GET /product-questions/1001?app_id=openapi-test&order_by=newest&include=answers" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of the request. - **status** (boolean) - Indicates the success status of the request. - **data** (object) - Contains the paginated list of product questions. - **page** (integer) - Current page number. - **limit** (integer) - Number of items per page. - **total** (integer) - Total number of questions available. #### Response Example ```json { "example": { "message": "Products Questions", "status": true, "data": { "page": 1, "limit": 20, "total": 150, "questions": [ { "id": "q123", "productId": "1001", "author": { "name": "John Doe", "email": "john.doe@example.com" }, "question": "What material is this made of?", "createdAt": "2023-10-26T10:00:00.000Z", "updatedAt": "2023-10-26T10:00:00.000Z", "answers": [ { "id": "a456", "author": { "name": "SiteVibes Support", "email": "support@sitevibes.com" }, "answer": "This product is made of high-quality recycled plastic.", "createdAt": "2023-10-26T11:00:00.000Z" } ] } ] } } } ``` ``` -------------------------------- ### GET /websites/{website_id}/products/{product_id}/questions Source: https://developers.sitevibes.com/reference/get_product-questions Retrieves a list of questions for a specific product. Supports filtering and pagination. ```APIDOC ## GET /websites/{website_id}/products/{product_id}/questions ### Description Retrieves a list of questions for a specific product. Supports filtering and pagination. ### Method GET ### Endpoint `/websites/{website_id}/products/{product_id}/questions` ### Parameters #### Path Parameters - **website_id** (integer) - Required - The ID of the website. - **product_id** (integer) - Required - The ID of the product. #### Query Parameters - **page** (integer) - Optional - The page number for pagination. - **limit** (integer) - Optional - The number of items per page. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **data** (array) - An array of product question objects. - **id** (integer) - The ID of the question. - **product_id** (integer) - The ID of the product associated with the question. - **user_id** (integer) - The ID of the user who asked the question. - **user_name** (string) - The name of the user who asked the question. - **question** (string) - The content of the question. - **answer** (string) - The answer to the question (can be null). - **content_stripped** (string) - The stripped content of the answer as plain text. - **country** (string) - The country of the user (nullable). - **city** (string) - The city of the user (nullable). - **vote_up** (integer) - The number of upvotes for the question. - **vote_down** (integer) - The number of downvotes for the question. - **created_date** (string) - The date and time the question was created (format: date). - **created_at_text** (string) - A human-readable representation of the creation date. #### Response Example ```json { "example": "{\"data\": [{\"id\": 1, \"product_id\": 101, \"user_id\": 50, \"user_name\": \"John Doe\", \"question\": \"What are the dimensions of this product?\", \"answer\": \"The dimensions are 10x5x2 inches.\", \"content_stripped\": \"The dimensions are 10x5x2 inches.\", \"country\": \"USA\", \"city\": \"New York\", \"vote_up\": 5, \"vote_down\": 0, \"created_date\": \"2023-02-28T00:00:00.000Z\", \"created_at_text\": \"February 28, 2023\"}] }" } ``` #### Error Response (401) - **message** (string) - Indicates an authorization error. - **status** (boolean) - False, indicating an error. - **data** (object) - Contains details about the access token issue. - **access_token** (array) - An array of strings explaining the token problem. #### Error Response (422) - **message** (string) - Indicates invalid data. - **status** (boolean) - False, indicating an error. - **errors** (object) - An object containing field-specific validation errors. - **field_name** (array) - An array of strings describing validation errors for a specific field. ``` -------------------------------- ### Get Order Review Requests (Python) Source: https://developers.sitevibes.com/reference/emails Example Python code to retrieve order review requests using the 'requests' library. It shows how to construct the URL with path and query parameters and includes the required 'accept' header. ```python import requests def get_order_review_requests(order_id, app_id, page=1, limit=20): base_url = "https://api.sitevibes.com/v1/order-data/{}/review-requests" url = base_url.format(order_id) params = { "app_id": app_id, "page": page, "limit": limit } headers = { "accept": "application/json" } try: response = requests.get(url, params=params, headers=headers) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching order review requests: {e}") return None # Example usage: # order_id = "YOUR_ORDER_ID" # app_id = "YOUR_APP_ID" # data = get_order_review_requests(order_id, app_id) # if data: # print(data) ``` -------------------------------- ### JavaScript: Error API Response Structure Source: https://developers.sitevibes.com/docs/comprehensive-guide-to-implementing-a-full-loyalty-program-using-sitevibes-api This is an example of an error API response structure. It includes an error message, a status flag set to false, and an 'errors' object which may contain field-specific validation errors. ```javascript { "message": "Error message", "status": false, "errors": { "field_name": [ "Error description" ] } } ``` -------------------------------- ### POST /websites/developers_sitevibes/promotions Source: https://developers.sitevibes.com/reference/post_loyalty-product-promotions Creates a new loyalty product promotion. This endpoint allows specifying promotion details such as type, dates, title, description, and the specific products, categories, or brands it applies to. ```APIDOC ## POST /websites/developers_sitevibes/promotions ### Description Creates a new loyalty product promotion. This endpoint allows specifying promotion details such as type, dates, title, description, and the specific products, categories, or brands it applies to. ### Method POST ### Endpoint /websites/developers_sitevibes/promotions ### Parameters #### Query Parameters None #### Request Body - **type** (string) - Required - Promotion type (products, categories, brands) - **enabled** (boolean) - Required - is this promotion enabled - **start_date** (string) - Required - Promotion start date/time (ISO 8601 format) - **end_date** (string) - Required - Promotion end date/time (ISO 8601 format) - **title** (string) - Required - Title of this promotion - **description** (string) - Optional - Description of this promotion - **products** (array) - Optional - Product IDs that promotion will be applied to (only if type is products). Each item is a string. - **categories** (array) - Optional - Product categories that promotion will be applied to (only if type is categories). Each item is a string. - **brands** (array) - Optional - Product brands that promotion will be applied to (only if type is brands). Each item is a string. - **tiers** (array) - Optional - Multipliers values for specific loyalty tiers. Each item is an object with `loyalty_tier_id` (string or null) and `multiplier` (number). ### Request Example ```json { "type": "products", "enabled": true, "start_date": "2025-01-01T00:00:00.000Z", "end_date": "2025-12-02T23:59:59.000Z", "title": "Example promotion", "description": "Example promotion description", "products": [ "1002", "1003" ], "tiers": [ { "loyalty_tier_id": null, "multiplier": 1.5 } ] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **status** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the details of the created promotion. - **id** (integer) - Id of this Product Promotion. - **type** (string) - Promotion type (products, categories, brands). - **enabled** (boolean) - is this promotion enabled. - **start_date** (string) - Promotion start date/time. - **start_date_formatted** (string) - Formatted promotion start date/time. - **end_date** (string) - Promotion end date/time. - **end_date_formatted** (string) - Formatted promotion end date/time. - **title** (string) - Title of this promotion. - **description** (string) - Description of this promotion. - **products** (array) - Products IDs that promotion will be applied to (only if type is products). - **categories** (array) - Products categories that promotion will be applied to (only if type is categories). - **brands** (array) - Products brands that promotion will be applied to (only if type is brands). - **tiers** (array) - Multipliers values for specific loyalty tiers. #### Response Example ```json { "message": "Loyalty Product Promotion created", "status": true, "data": { "id": 12, "type": "products", "enabled": true, "start_date": "2025-01-01T00:00:00.000Z", "start_date_formatted": "12:00:00AM January 01, 2025", "end_date": "2025-12-02T23:59:59.000Z", "end_date_formatted": "11:59:59PM January 02, 2025", "title": "Example promotion", "description": "Example promotion description", "products": [ "1002", "1003" ], "categories": null, "brands": null, "tiers": [ { "loyalty_tier_id": null, "multiplier": 1.5 } ] } } ``` ``` -------------------------------- ### JavaScript: Success API Response Structure Source: https://developers.sitevibes.com/docs/comprehensive-guide-to-implementing-a-full-loyalty-program-using-sitevibes-api This is an example of a successful API response structure. It typically includes a success message, a status flag set to true, and a 'data' object containing the actual response payload. ```javascript { "message": "Success message", "status": true, "data": { // Response data specific to the endpoint } } ``` -------------------------------- ### POST /websites/developers_sitevibes/orders Source: https://developers.sitevibes.com/reference/get_order-data-orderid Creates a new order with specified items, billing, and shipping details. Requires authentication. ```APIDOC ## POST /websites/developers_sitevibes/orders ### Description Creates a new order with the provided order details, including items, billing address, and shipping address. ### Method POST ### Endpoint /websites/developers_sitevibes/orders ### Parameters #### Request Body - **order_id** (string) - Required - The unique identifier for the order. - **items** (array) - Required - A list of items included in the order. - **product_id** (integer) - Required - The unique identifier for the product. - **quantity** (integer) - Required - The number of units of the product ordered. - **shipped_quantity** (integer) - Required - The number of units of the product that have been shipped. - **unit_price** (number) - Optional - The price per unit of the product. - **unit_price_after_discount** (number) - Optional - The price per unit after any applicable discounts. - **billing_address** (object) - Optional - The billing address for the order. - **country** (string) - Optional - The country of the billing address. - **state** (string) - Optional - The state of the billing address. - **city** (string) - Optional - The city of the billing address. - **zip** (string) - Optional - The zip code of the billing address. - **address_1** (string) - Optional - The first line of the billing address. - **address_2** (string) - Optional - The second line of the billing address. - **shipping_address** (object) - Optional - The shipping address for the order. - **country** (string) - Optional - The country of the shipping address. - **state** (string) - Optional - The state of the shipping address. - **city** (string) - Optional - The city of the shipping address. - **zip** (string) - Optional - The zip code of the shipping address. - **address_1** (string) - Optional - The first line of the shipping address. - **address_2** (string) - Optional - The second line of the shipping address. ### Request Example ```json { "order_id": "ORD12345", "items": [ { "product_id": 101, "quantity": 2, "shipped_quantity": 2, "unit_price": 25.50, "unit_price_after_discount": 22.00 } ], "billing_address": { "country": "USA", "state": "CA", "city": "Los Angeles", "zip": "90001", "address_1": "123 Main St" }, "shipping_address": { "country": "USA", "state": "CA", "city": "Los Angeles", "zip": "90001", "address_1": "123 Main St" } } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the order was created. - **status** (boolean) - True if the operation was successful. - **data** (object) - Contains details of the created order. - **order_id** (string) - The unique identifier for the created order. #### Response Example ```json { "message": "Order created successfully", "status": true, "data": { "order_id": "ORD12345" } } ``` #### Error Response (401) - **message** (string) - Error message indicating unauthorized access. - **status** (boolean) - False indicating the operation failed. - **data** (object) - Contains details about the access token issue. - **access_token** (array) - An array of strings describing the access token problem. #### Error Response Example (401) ```json { "message": "Unauthorized access", "status": false, "data": { "access_token": [ "Token is missing or invalid." ] } } ``` #### Error Response (422) - **message** (string) - Error message indicating validation failure. #### Error Response Example (422) ```json { "message": "Validation failed", "status": false, "data": { "field_name": ["Error message for the field"] } } ``` ```