### Get Products API Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Retrieves a list of products for the shop, supporting search, category filtering, sorting, and pagination. ```APIDOC ## POST /shop/products ### Description Fetches products from the shop catalog with various filtering and pagination options. ### Method POST ### Endpoint /shop/products ### Parameters #### Request Body - **jsonrpc** (string) - Required - JSON RPC version, typically "2.0". - **method** (string) - Required - Method name, always "call". - **params** (object) - Required - Parameters for retrieving products. - **search** (string) - Optional - Search term to filter products. - **category_id** (integer) - Optional - The ID of the category to filter products by. - **offset** (integer) - Optional - The number of products to skip for pagination, defaults to 0. - **ppg** (integer) - Optional - Products per page, defaults to 20. - **attrib_list** (array of integers) - Optional - A list of attribute value IDs to filter products by. ### Request Example ```json { "jsonrpc": "2.0", "method": "call", "params": { "search": "", "category_id": 1, "offset": 0, "ppg": 20, "attrib_list": [] } } ``` ### Response #### Success Response (200) - **result** (object) - Contains a list of products and total count. - **products** (array of objects) - List of product details. - **total_count** (integer) - Total number of products matching the criteria. - **id** (integer) - The ID of the JSON RPC request. #### Response Example ```json { "jsonrpc": "2.0", "id": null, "result": { "products": [ { "id": 1001, "name": "Product A", "price": 25.00, "image_url": "/web/image/product_a.jpg" } ], "total_count": 50 } } ``` ``` -------------------------------- ### Get Combination Info API Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Retrieves product ID and price after selecting combination options on the product template page. ```APIDOC ## POST /shop/get_combination_info/{product_template_id} ### Description Provides the specific product ID and price for a selected combination of attributes, and allows specifying quantity. ### Method POST ### Endpoint /shop/get_combination_info/ ### Parameters #### Path Parameters - **product_template_id** (integer) - Required - The ID of the product template. #### Request Body - **jsonrpc** (string) - Required - JSON RPC version, typically "2.0". - **method** (string) - Required - Method name, always "call". - **params** (object) - Required - Parameters for getting combination info. - **combination_ids** (array of integers) - Required - An array of attribute value IDs representing the selected combination. - **add_qty** (integer) - Optional - The quantity to add to the cart, defaults to 1. ### Request Example ```json { "jsonrpc": "2.0", "method": "call", "params": { "combination_ids": [1, 2], "add_qty": 1 } } ``` ### Response #### Success Response (200) - **result** (object) - Contains information about the selected product variant. - **id** (integer) - The ID of the JSON RPC request. #### Response Example ```json { "jsonrpc": "2.0", "id": null, "result": { "product_id": , "price": 55.00, "combination_description": "Color: Red, Size: L" } } ``` ``` -------------------------------- ### Get Product Template Attributes API Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Retrieves all product template attributes for a given product template ID. ```APIDOC ## POST /shop/get_combinations/{product_template_id} ### Description Fetches all available combinations and attributes for a product template, typically used on a product detail page. ### Method POST ### Endpoint /shop/get_combinations/ ### Parameters #### Path Parameters - **product_template_id** (integer) - Required - The ID of the product template. #### Request Body - **jsonrpc** (string) - Required - JSON RPC version, typically "2.0". - **method** (string) - Required - Method name, always "call". ### Request Example ```json { "jsonrpc": "2.0", "method": "call" } ``` ### Response #### Success Response (200) - **result** (object) - Contains product attributes and combination information. - **id** (integer) - The ID of the JSON RPC request. #### Response Example ```json { "jsonrpc": "2.0", "id": null, "result": { "attributes": [ { "id": 1, "name": "Color", "values": [ {"id": 10, "name": "Red"}, {"id": 11, "name": "Blue"} ] } ], "variants": [ { "id": 101, "product_id": , "price": 50.00, "combination_ids": [1, 10] // Attribute value IDs } ] } } ``` ``` -------------------------------- ### Get Product Info from Combination using Axios Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Retrieves product ID and price after selecting a combination on the product template page via the /shop/get_combination_info/ endpoint. Requires combination IDs and quantity. Uses axios for the POST request and includes credentials. ```javascript axios.post('/shop/get_combination_info/', { "jsonrpc": "2.0", "method": "call" "params": { "combination_ids": [1, 2], add_qty=1 }}, { "withCredentials": true }) ``` -------------------------------- ### Image Access - Retrieve Product/Website Images (GET /web/image) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Accesses product and website images from Odoo, with support for resizing and SEO-friendly filenames. Image access is subject to system parameter limits to control resource usage. ```APIDOC ## Image Access - Retrieve Product/Website Images ### Description Accesses product and website images from Odoo, with support for resizing and SEO-friendly filenames. Image access is subject to system parameter limits to control resource usage. ### Method GET ### Endpoint /web/image/{model}/{id}/{field} ### Parameters #### Path Parameters - **model** (string) - Required - The Odoo model name (e.g., `product.template`, `product.product`). - **id** (integer) - Required - The record ID of the image. - **field** (string) - Required - The image field name (e.g., `image`, `image_1920`, `image_512`). #### Query Parameters - **width** (integer) - Optional - Desired width for resizing. - **height** (integer) - Optional - Desired height for resizing. - **filename** (string) - Optional - Filename for SEO and caching purposes. ### Request Example ```bash # Basic image access curl https://your-odoo-instance.com/web/image/product.template/42/image # Resized image with width/height curl https://your-odoo-instance.com/web/image/product.template/42/image/800x600 # With filename for SEO curl https://your-odoo-instance.com/web/image/product.template/42/image/800x600/blue-shirt.jpg ``` ### Response #### Success Response (200) - **Image Data** - The requested image file. #### Response Example (Binary image data, no JSON example) ``` ``` -------------------------------- ### Get Products with Filtering using Axios Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Fetches products for the shop with support for search, category filtering, sorting, pagination, and attribute filtering via the /shop/products endpoint. Parameters include search query, category ID, offset, products per page, and attribute list. Uses axios for the POST request and includes credentials. ```javascript axios.post('/shop/products', { "jsonrpc": "2.0", "method": "call" "params": { "search": "", "category_id": 1, "offset": 0, "ppg": 20, "attrib_list": [] }}, { "withCredentials": true }) ``` -------------------------------- ### REST Endpoints - Get Product Slugs (GET /alokai/products) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all published product slugs and their associated path templates from Odoo. This is useful for sitemap generation and dynamic route configuration on the frontend. ```APIDOC ## REST Endpoints - Get Product Slugs ### Description Retrieves all published product slugs and their associated path templates from Odoo. This is useful for sitemap generation and dynamic route configuration on the frontend. ### Method GET ### Endpoint /alokai/products ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET https://your-odoo-instance.com/alokai/products ``` ### Response #### Success Response (200) - **Array of Objects** - Each object contains 'name' and 'path' of the product. #### Response Example ```json [ { "name": "blue-shirt-42", "path": "/shop/mens-clothing/:slug" }, { "name": "red-dress-58", "path": "/shop/womens-clothing/:slug" } ] ``` ``` -------------------------------- ### Get Product Template Attributes using Axios Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Fetches all product template attributes for a given product template ID using the /shop/get_combinations/ endpoint. This function utilizes axios for the POST request and includes credentials. ```javascript axios.post('/shop/get_combinations/', { "jsonrpc": "2.0", "method": "call" }, { "withCredentials": true }) ``` -------------------------------- ### Get Shipping Rate API Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Retrieves the shipping rate for a given shipping method. ```APIDOC ## POST /shop/carrier_rate_shipment ### Description Calculates and retrieves the shipping rate for a specified carrier. ### Method POST ### Endpoint /shop/carrier_rate_shipment ### Parameters #### Request Body - **jsonrpc** (string) - Required - JSON RPC version, typically "2.0". - **method** (string) - Required - Method name, always "call". - **params** (object) - Required - Parameters for getting the shipping rate. - **carrier_id** (integer) - Required - The ID of the shipping carrier. ### Request Example ```json { "jsonrpc": "2.0", "method": "call", "params": { "carrier_id": } } ``` ### Response #### Success Response (200) - **result** (object) - The shipping rate information. - **id** (integer) - The ID of the JSON RPC request. #### Response Example ```json { "jsonrpc": "2.0", "id": null, "result": { "exact_price": 10.50, "display_price": "$10.50" } } ``` ``` -------------------------------- ### GraphQL Query: Get Product Variant Information Source: https://context7.com/erpgap/alokai-odoo/llms.txt This GraphQL query retrieves variant-specific details for a product, identified by its template ID and optionally a combination ID. It returns information such as the product's display name and image, pricing (including discounted prices), and whether the combination is possible. ```graphql query GetProductVariant($productTemplateId: Int!, $combinationId: [Int]) { productVariant(productTemplateId: $productTemplateId, combinationId: $combinationId) { product { id name barcode } productTemplateId displayName displayImage price listPrice hasDiscountedPrice isCombinationPossible } } ``` -------------------------------- ### REST - Get Product Slugs for Sitemap Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all published product slugs from Odoo for sitemap generation. The response includes the product name and a path template with a ':slug' placeholder. It fetches published products with a website_slug field and is used for static site generation and dynamic route configuration. ```bash curl -X GET https://your-odoo-instance.com/alokai/products # Response: JSON array of product objects with name and path [ { "name": "blue-shirt-42", "path": "/shop/mens-clothing/:slug" }, { "name": "red-dress-58", "path": "/shop/womens-clothing/:slug" } ] ``` -------------------------------- ### Get Shopping Cart Details (GraphQL) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves the current user's shopping cart, including product details, totals, partner information, and recommended products. This query uses session context and automatically filters out inactive products. It returns null if no cart exists. ```graphql query GetCart { cart { order { id name amountTotal amountUntaxed amountTax amountDelivery currency { id name symbol } orderLines { id name productId { id name image } productUomQty priceUnit priceTotal priceSubtotal } partnerShipping { id name street city zip country { id name } } stage cartQuantity } frequentlyBoughtTogether { id name slug price } } } ``` -------------------------------- ### REST - Get Website Redirects Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all configured URL redirects from Odoo, primarily for frontend router configuration and SEO maintenance. This endpoint returns an array of objects, each specifying a 'from' and 'to' path, based on website.rewrite records. ```bash curl -X GET https://your-odoo-instance.com/alokai/redirects # Response: JSON array of redirect objects [ { "from": "/old-product-page", "to": "/new-product-page" }, { "from": "/discontinued-category", "to": "/active-category" } ] ``` -------------------------------- ### Get Available Delivery Methods - GraphQL Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves shipping methods available for the current shopping cart. It returns a list of delivery methods with their ID, name, price, and delivery type. Only published methods are returned, and the query returns an empty array if no cart exists. ```graphql query GetDeliveryMethods { deliveryMethods { id name price deliveryType # fixed, base_on_rule, etc. productId { id name } } } ``` -------------------------------- ### Wishlist Management - Get User Wishlist (GraphQL) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all items from the current user's wishlist. This query does not require variables as it uses session context, but it mandates an authenticated user. It returns only published products that are available to be added to the cart, filtered by the current website. ```graphql query GetWishlist { wishlistItems { wishlistItems { id product { id name slug image price listPrice isInStock } } totalCount } } # No variables needed - uses session context # Requires authenticated user (not available for guests) # Returns only published products that can be added to cart # Filtered by current website context ``` -------------------------------- ### Payment Management - Get Available Payment Providers (GraphQL) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves a list of payment providers that are available for the current cart and shipping address. The results are filtered by provider status (enabled/test), cart company, current website, and country compatibility with the shipping address. This is useful for displaying payment options during checkout. ```graphql query GetPaymentProviders { paymentProviders { id name code state displayAs image fees supportedCurrencies { id name } } } # No variables needed # Filtered by: # - Provider state: enabled or test # - Cart company # - Current website # - Available countries matching cart shipping address # Returns all compatible payment providers (Stripe, Adyen, etc.) # Use case: Checkout payment method selection ``` -------------------------------- ### REST Endpoints - Get Category Slugs (GET /alokai/categories) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all published category slugs from Odoo. This endpoint is primarily used for sitemap generation and static site generation purposes. ```APIDOC ## REST Endpoints - Get Category Slugs ### Description Retrieves all published category slugs from Odoo. This endpoint is primarily used for sitemap generation and static site generation purposes. ### Method GET ### Endpoint /alokai/categories ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET https://your-odoo-instance.com/alokai/categories ``` ### Response #### Success Response (200) - **Array of Strings** - Each string is a category slug. #### Response Example ```json [ "/shop/mens-clothing", "/shop/womens-clothing", "/shop/accessories" ] ``` ``` -------------------------------- ### Product Query - Single Product Details Source: https://context7.com/erpgap/alokai-odoo/llms.txt Fetch detailed information for a specific product using its ID, slug, or barcode. This is ideal for product detail pages. ```APIDOC ## GET /graphql/alokai ### Description Retrieve detailed information for a single product using its unique identifier, slug, or barcode. This endpoint is commonly used for displaying product details on a dedicated product page. ### Method POST ### Endpoint `/graphql/alokai` or `/graphql/vsf` ### Parameters #### Query Parameters (This is a GraphQL endpoint, parameters are typically sent within the request body as part of the query) #### Request Body - **query** (String!) - The GraphQL query string. - **variables** (Object) - Variables to be used with the query. ### GraphQL Query Example ```graphql query GetProduct($id: Int, $slug: String, $barcode: String) { product(id: $id, slug: $slug, barcode: $barcode) { id name slug description descriptionSale price listPrice image alternativeProducts { id name slug } accessoryProducts { id name slug } attributeLines { attribute { id name } values { id name htmlColor priceExtra } } isInStock qty } } ``` ### Request Variables Example Use one of the following identifiers: ```json { "slug": "/shop/mens-clothing/blue-shirt-42" } ``` ```json { "id": 123 } ``` ```json { "barcode": "1234567890" } ``` ### Response #### Success Response (200) - **product** (Product): A single product object with detailed information. - **id** (Int): Unique identifier for the product. - **name** (String): Name of the product. - **slug** (String): URL-friendly identifier for the product. - **description** (String): Detailed description of the product. - **descriptionSale** (String): Promotional description if available. - **price** (Float): The current selling price of the product. - **listPrice** (Float): The original list price of the product. - **image** (String): URL for the product's main image. - **alternativeProducts** (Array): List of alternative product suggestions. - **id** (Int): Identifier for the alternative product. - **name** (String): Name of the alternative product. - **slug** (String): Slug of the alternative product. - **accessoryProducts** (Array): List of accessory products related to this product. - **id** (Int): Identifier for the accessory product. - **name** (String): Name of the accessory product. - **slug** (String): Slug of the accessory product. - **attributeLines** (Array): Lines of attributes for the product (e.g., color, size). - **attribute** (Attribute): Details about the attribute. - **id** (Int): Identifier for the attribute. - **name** (String): Name of the attribute (e.g., 'Color'). - **values** (Array): Available values for this attribute. - **id** (Int): Identifier for the attribute value. - **name** (String): Name of the attribute value (e.g., 'Blue', 'XL'). - **htmlColor** (String): Hex code for the color if applicable. - **priceExtra** (Float): Additional price for this attribute value. - **isInStock** (Boolean): Indicates if the product is currently in stock. - **qty** (Int): Quantity available in stock. #### Response Example ```json { "data": { "product": { "id": 123, "name": "Blue T-Shirt", "slug": "/shop/mens-clothing/blue-t-shirt", "description": "A stylish blue t-shirt made from premium cotton.", "descriptionSale": null, "price": 29.99, "listPrice": 34.99, "image": "/web/image/product/123/image_1024", "alternativeProducts": [], "accessoryProducts": [ { "id": 456, "name": "Jeans", "slug": "/shop/mens-clothing/jeans" } ], "attributeLines": [ { "attribute": {"id": 1, "name": "Color"}, "values": [ {"id": 5, "name": "Blue", "htmlColor": "#0000FF", "priceExtra": 0.0} ] }, { "attribute": {"id": 2, "name": "Size"}, "values": [ {"id": 8, "name": "M", "htmlColor": null, "priceExtra": 0.0} ] } ], "isInStock": true, "qty": 50 } } } ``` ``` -------------------------------- ### REST Endpoints - Get Website Redirects (GET /alokai/redirects) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all configured URL redirects for the website from Odoo. This endpoint is used to configure frontend router redirects and maintain SEO for URL changes. ```APIDOC ## REST Endpoints - Get Website Redirects ### Description Retrieves all configured URL redirects for the website from Odoo. This endpoint is used to configure frontend router redirects and maintain SEO for URL changes. ### Method GET ### Endpoint /alokai/redirects ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET https://your-odoo-instance.com/alokai/redirects ``` ### Response #### Success Response (200) - **Array of Objects** - Each object contains 'from' and 'to' URL paths for the redirect. #### Response Example ```json [ { "from": "/old-product-page", "to": "/new-product-page" }, { "from": "/discontinued-category", "to": "/active-category" } ] ``` ``` -------------------------------- ### User Registration (GraphQL Mutation) Source: https://context7.com/erpgap/alokai-odoo/llms.txt Creates a new user account in the system. This mutation requires the user's name, email, and password, and supports an option to subscribe to the newsletter. Upon successful registration, it returns basic user information. ```graphql mutation Register($name: String!, $email: String!, $password: String!, $subscribeNewsletter: Boolean) { register(name: $name, email: $email, password: $password, subscribeNewsletter: $subscribeNewsletter) { id name email login } } ``` -------------------------------- ### Wishlist Management - Get User Wishlist Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves all wishlist items for the current authenticated user. ```APIDOC ## POST /graphql ### Description Retrieves all wishlist items for the current authenticated user. ### Method POST ### Endpoint /graphql ### Parameters No query parameters or request body are needed as this query uses session context. ### Request Example ```json { "query": "query GetWishlist { wishlistItems { wishlistItems { id product { id name slug image price listPrice isInStock } } totalCount } }" } ``` ### Response #### Success Response (200) - **data.wishlistItems.wishlistItems** (Array) - A list of items in the user's wishlist. - **id** (Int) - The unique identifier of the wishlist item. - **product** (Object) - Information about the product in the wishlist. - **id** (Int) - The product ID. - **name** (String) - The product name. - **slug** (String) - The product slug for URL identification. - **image** (String) - The URL of the product image. - **price** (Float) - The current price of the product. - **listPrice** (Float) - The list price of the product. - **isInStock** (Boolean) - Indicates if the product is currently in stock. - **data.wishlistItems.totalCount** (Int) - The total number of items in the wishlist. #### Response Example ```json { "data": { "wishlistItems": { "wishlistItems": [ { "id": 1, "product": { "id": 42, "name": "Wireless Mouse", "slug": "wireless-mouse", "image": "/web/image/product.product/42/image", "price": 25.99, "listPrice": 29.99, "isInStock": true } } ], "totalCount": 1 } } } ``` ``` -------------------------------- ### Order Management - Get Single Order Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves detailed information for a specific order by its ID. ```APIDOC ## POST /graphql ### Description Retrieves detailed information for a specific order by its ID. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **id** (Int!) - Required - The unique identifier of the order to retrieve. #### Request Body - **query** (String) - The GraphQL query string. - **variables** (Object) - The variables for the GraphQL query. ### Request Example ```json { "query": "query GetOrder($id: Int!) { order(id: $id) { id name dateOrder amountTotal amountUntaxed amountTax amountDelivery stage invoiceStatus orderLines { id name productId { id name image } productUomQty priceUnit priceTotal priceSubtotal } partnerInvoice { name street city zip country { name } } partnerShipping { name street city zip country { name } } invoices { id name state amountTotal } transactions { id reference state amount } } }", "variables": { "id": 12345 } } ``` ### Response #### Success Response (200) - **data.order** (Object) - The detailed order object. - **id** (Int) - The unique identifier of the order. - **name** (String) - The name or number of the order. - **dateOrder** (String) - The date the order was placed. - **amountTotal** (Float) - The total amount of the order. - **amountUntaxed** (Float) - The total amount of the order before tax. - **amountTax** (Float) - The total tax amount for the order. - **amountDelivery** (Float) - The delivery cost for the order. - **stage** (String) - The current stage of the order. - **invoiceStatus** (String) - The status of the order's invoice. - **orderLines** (Array) - A list of order line items. - **id** (Int) - The unique identifier of the order line. - **name** (String) - The name of the product in the order line. - **productId** (Object) - Information about the product. - **id** (Int) - The product ID. - **name** (String) - The product name. - **image** (String) - The URL of the product image. - **productUomQty** (Float) - The quantity of the product ordered. - **priceUnit** (Float) - The unit price of the product. - **priceTotal** (Float) - The total price for this order line. - **priceSubtotal** (Float) - The subtotal price for this order line. - **partnerInvoice** (Object) - Invoice address details. - **name** (String) - The name of the partner. - **street** (String) - The street address. - **city** (String) - The city. - **zip** (String) - The zip code. - **country** (Object) - Country details. - **name** (String) - The country name. - **partnerShipping** (Object) - Shipping address details. - **name** (String) - The name of the partner. - **street** (String) - The street address. - **city** (String) - The city. - **zip** (String) - The zip code. - **country** (Object) - Country details. - **name** (String) - The country name. - **invoices** (Array) - A list of associated invoices. - **id** (Int) - The invoice ID. - **name** (String) - The invoice name or number. - **state** (String) - The state of the invoice. - **amountTotal** (Float) - The total amount of the invoice. - **transactions** (Array) - A list of payment transactions. - **id** (Int) - The transaction ID. - **reference** (String) - The transaction reference. - **state** (String) - The state of the transaction. - **amount** (Float) - The transaction amount. #### Response Example ```json { "data": { "order": { "id": 12345, "name": "SO001-12345", "dateOrder": "2023-10-27T10:00:00Z", "amountTotal": 150.00, "amountUntaxed": 130.00, "amountTax": 20.00, "amountDelivery": 10.00, "stage": "SALE", "invoiceStatus": "INVOICED", "orderLines": [ { "id": 101, "name": "Product A", "productId": { "id": 1, "name": "Product A Name", "image": "/web/image/product.product/1/image" }, "productUomQty": 2.0, "priceUnit": 50.0, "priceTotal": 100.0, "priceSubtotal": 100.0 } ], "partnerInvoice": { "name": "Customer Corp", "street": "123 Main St", "city": "Anytown", "zip": "12345", "country": { "name": "USA" } }, "partnerShipping": { "name": "Customer Corp", "street": "123 Main St", "city": "Anytown", "zip": "12345", "country": { "name": "USA" } }, "invoices": [ { "id": 201, "name": "INV001", "state": "paid", "amountTotal": 150.00 } ], "transactions": [ { "id": 301, "reference": "PAYMENTREF123", "state": "authorized", "amount": 150.00 } ] } } } ``` ``` -------------------------------- ### Payment Management - Get Payment Transaction Status Source: https://context7.com/erpgap/alokai-odoo/llms.txt Checks the status of a payment transaction using its ID or reference. ```APIDOC ## POST /graphql ### Description Checks the status of a payment transaction using its ID or reference. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **id** (Int) - Optional - The unique identifier of the payment transaction. - **reference** (String) - Optional - The reference code of the payment transaction. (Provide either `id` or `reference`, not both). #### Request Body - **query** (String) - The GraphQL query string. - **variables** (Object) - The variables for the GraphQL query. ### Request Example ```json { "query": "query GetPaymentTransaction($id: Int, $reference: String) { paymentTransaction(id: $id, reference: $reference) { id reference amount currency { name symbol } state providerId { id name code } saleOrderIds { id name } } }", "variables": { "reference": "SO001-12345" } } ``` ### Response #### Success Response (200) - **data.paymentTransaction** (Object) - Information about the payment transaction. - **id** (Int) - The unique identifier of the transaction. - **reference** (String) - The reference code for the transaction. - **amount** (Float) - The transaction amount. - **currency** (Object) - Currency details. - **name** (String) - The currency code (e.g., USD). - **symbol** (String) - The currency symbol. - **state** (String) - The current state of the transaction (e.g., draft, pending, authorized, confirmed, canceled, error). - **providerId** (Object) - Information about the payment provider. - **id** (Int) - The provider's ID. - **name** (String) - The provider's name. - **code** (String) - The provider's code. - **saleOrderIds** (Array) - A list of associated sales order IDs. - **id** (Int) - The sales order ID. - **name** (String) - The sales order name/number. #### Response Example ```json { "data": { "paymentTransaction": { "id": 789, "reference": "SO001-12345", "amount": 150.00, "currency": { "name": "USD", "symbol": "$" }, "state": "authorized", "providerId": { "id": 1, "name": "Stripe", "code": "stripe" }, "saleOrderIds": [ { "id": 1001, "name": "SO001" } ] } } } ``` ``` -------------------------------- ### REST - Retrieve Product/Website Images Source: https://context7.com/erpgap/alokai-odoo/llms.txt Provides access to product and website images from Odoo, with support for resizing and SEO-friendly filenames. Images can be accessed directly or with specified dimensions and filenames. The maximum image size is controlled by the 'alokai_image_resize_limit' system parameter. ```bash # Basic image access curl https://your-odoo-instance.com/web/image/product.template/42/image # Resized image with width/height curl https://your-odoo-instance.com/web/image/product.template/42/image/800x600 # With filename for SEO curl https://your-odoo-instance.com/web/image/product.template/42/image/800x600/blue-shirt.jpg ``` -------------------------------- ### Shopping Cart Query Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves the current user's shopping cart, including product details, pricing, and partner information. ```APIDOC ## Shopping Cart Query ### Description Retrieve current user's shopping cart with product details and totals. ### Method QUERY ### Endpoint /graphql ### Parameters This query does not require any variables as it uses session context. ### Request Example ```graphql query GetCart { cart { order { id name amountTotal amountUntaxed amountTax amountDelivery currency { id name symbol } orderLines { id name productId { id name image } productUomQty priceUnit priceTotal priceSubtotal } partnerShipping { id name street city zip country { id name } } stage cartQuantity } frequentlyBoughtTogether { id name slug price } } } ``` ### Response #### Success Response (200) Returns the user's cart object, which may be null if no cart exists. It automatically removes inactive products and includes frequently bought together recommendations. #### Response Example ```json { "data": { "cart": { "order": { "id": 1, "name": "SO001", "amountTotal": 150.00, "amountUntaxed": 120.00, "amountTax": 30.00, "amountDelivery": 10.00, "currency": { "id": 1, "name": "USD", "symbol": "$" }, "orderLines": [ { "id": 10, "name": "Product A", "productId": { "id": 42, "name": "Awesome T-Shirt", "image": "/web/image/product.template/42/image_128" }, "productUomQty": 2, "priceUnit": 50.00, "priceTotal": 100.00, "priceSubtotal": 100.00 } ], "partnerShipping": { "id": 5, "name": "John Doe", "street": "123 Main St", "city": "Anytown", "zip": "12345", "country": { "id": 240, "name": "United States" } }, "stage": "draft", "cartQuantity": 2 }, "frequentlyBoughtTogether": [ { "id": 58, "name": "Complementary Socks", "slug": "complementary-socks", "price": 20.00 } ] } } } ``` ``` -------------------------------- ### Product Variant Query Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieve variant-specific information for a product, including pricing, availability, and validation for product combinations. Useful for selecting product options. ```APIDOC ## GET /graphql/alokai ### Description Fetch specific details for a product variant based on its template ID and combination. This is useful for displaying variant-specific information like price, availability, and checking if a particular combination of attributes is possible. ### Method POST ### Endpoint `/graphql/alokai` or `/graphql/vsf` ### Parameters #### Query Parameters (This is a GraphQL endpoint, parameters are typically sent within the request body as part of the query) #### Request Body - **query** (String!) - The GraphQL query string. - **variables** (Object) - Variables to be used with the query. ### GraphQL Query Example ```graphql query GetProductVariant($productTemplateId: Int!, $combinationId: [Int]) { productVariant(productTemplateId: $productTemplateId, combinationId: $combinationId) { product { id name barcode } productTemplateId displayName displayImage price listPrice hasDiscountedPrice isCombinationPossible } } ``` ### Request Variables Example ```json { "productTemplateId": 10, "combinationId": [5, 8] # Example: Color ID 5, Size ID 8 } ``` ### Response #### Success Response (200) - **productVariant** (ProductVariant): An object containing details about the specific product variant. - **product** (Product): Basic product information. - **id** (Int): Product ID. - **name** (String): Product Name. - **barcode** (String): Product Barcode. - **productTemplateId** (Int): The ID of the product template this variant belongs to. - **displayName** (String): The display name of the variant (e.g., 'Blue T-Shirt - M'). - **displayImage** (String): URL for the image associated with this variant. - **price** (Float): The current selling price of this variant. - **listPrice** (Float): The original list price of this variant. - **hasDiscountedPrice** (Boolean): Indicates if the variant has a discounted price. - **isCombinationPossible** (Boolean): Indicates if the selected combination of attributes is valid and possible. #### Response Example ```json { "data": { "productVariant": { "product": { "id": 123, "name": "Blue T-Shirt", "barcode": "1234567890-BLU-M" }, "productTemplateId": 10, "displayName": "Blue T-Shirt - M", "displayImage": "/web/image/product/123/image_1024", "price": 29.99, "listPrice": 34.99, "hasDiscountedPrice": true, "isCombinationPossible": true } } } ``` ``` -------------------------------- ### Add to Wishlist API Source: https://github.com/erpgap/alokai-odoo/blob/18.0/graphql_alokai/README.rst Adds a product to the user's wishlist. ```APIDOC ## POST /shop/wishlist/add ### Description Adds a specific product to the user's wishlist. ### Method POST ### Endpoint /shop/wishlist/add ### Parameters #### Request Body - **jsonrpc** (string) - Required - JSON RPC version, typically "2.0". - **method** (string) - Required - Method name, always "call". - **params** (object) - Required - Parameters for adding to the wishlist. - **product_id** (integer) - Required - The ID of the product to add to the wishlist. ### Request Example ```json { "jsonrpc": "2.0", "method": "call", "params": { "product_id": } } ``` ### Response #### Success Response (200) - **result** (boolean) - Indicates if the product was successfully added to the wishlist. - **id** (integer) - The ID of the JSON RPC request. #### Response Example ```json { "jsonrpc": "2.0", "id": null, "result": true } ``` ``` -------------------------------- ### Payment Management - Get Available Payment Providers Source: https://context7.com/erpgap/alokai-odoo/llms.txt Retrieves a list of payment providers that are available for the current cart and shipping address. ```APIDOC ## POST /graphql ### Description Retrieves a list of payment providers that are available for the current cart and shipping address. ### Method POST ### Endpoint /graphql ### Parameters No query parameters or request body are needed as this query uses session context and filters automatically. ### Request Example ```json { "query": "query GetPaymentProviders { paymentProviders { id name code state displayAs image fees supportedCurrencies { id name } } }" } ``` ### Response #### Success Response (200) - **data.paymentProviders** (Array) - A list of available payment providers. - **id** (Int) - The unique identifier of the payment provider. - **name** (String) - The display name of the payment provider. - **code** (String) - The internal code for the payment provider. - **state** (String) - The state of the payment provider (e.g., enabled, test). - **displayAs** (String) - How the provider should be displayed. - **image** (String) - The URL of the provider's logo. - **fees** (Float) - Any applicable fees for using this provider. - **supportedCurrencies** (Array) - A list of currencies supported by the provider. - **id** (Int) - The currency ID. - **name** (String) - The currency name (e.g., USD). #### Response Example ```json { "data": { "paymentProviders": [ { "id": 1, "name": "Stripe", "code": "stripe", "state": "enabled", "displayAs": "Card", "image": "/payment_stripe/static/src/img/stripe_logo.png", "fees": 0.029, "supportedCurrencies": [ { "id": 1, "name": "USD" } ] }, { "id": 2, "name": "PayPal", "code": "paypal", "state": "enabled", "displayAs": "Online Payment", "image": "/payment_paypal/static/src/img/paypal_logo.png", "fees": 0.035, "supportedCurrencies": [ { "id": 1, "name": "USD" }, { "id": 2, "name": "EUR" } ] } ] } } ``` ```