post-templates-TEMPLATE_ID.rst (2510B)
1 .. http:post:: [/instances/$INSTANCES]/templates/$TEMPLATE_ID 2 3 This using template can be modified by everyone and will be used to create order. 4 5 6 **Request:** 7 8 The request must be a `UsingTemplateDetailsRequest` and we accept JSON application and URL encoded. 9 10 **Response:** 11 12 The response is exactly the same type of response as when 13 creating an order using :ref:`POST /private/orders <post-order>`. 14 15 **Details:** 16 17 .. ts:def:: UsingTemplateDetailsRequest 18 19 type UsingTemplateDetailsRequest = (UsingTemplateFixedOrderRequest | UsingTemplateInventoryCartRequest | UsingTemplatePaivanaRequest) & UsingTemplateCommonRequest; 20 21 .. ts:def:: UsingTemplateCommonRequest 22 23 interface UsingTemplateCommonRequest { 24 25 // Type of the template being instantiated. 26 // Possible values include "fixed-order", 27 // "inventory-cart" and "paivana". 28 // Since protocol **v25**. 29 // Defaults to "fixed-order" while supporting previous 30 // protocol versions. 31 template_type: string; 32 33 // Summary to use in the contract. Only if 34 // not already specified by the template. 35 summary?: string; 36 37 // The amount to be paid, including tip. 38 amount?: Amount; 39 40 // Optional tip amount. Must match the currency of ``amount`` or the 41 // fixed template currency. 42 // Since protocol **v25**. 43 tip?: Amount; 44 45 } 46 47 .. ts:def:: UsingTemplateFixedOrderRequest 48 49 interface UsingTemplateFixedOrderRequest { 50 template_type: "fixed-order"; 51 52 } 53 54 .. ts:def:: UsingTemplateInventoryCartRequest 55 56 interface UsingTemplateInventoryCartRequest { 57 template_type: "inventory-cart"; 58 59 // Inventory-cart: selected products and quantities. 60 // Since protocol **v25**. 61 inventory_selection?: InventorySelectionEntry[]; 62 } 63 64 .. ts:def:: InventorySelectionEntry 65 66 interface InventorySelectionEntry { 67 // Inventory product to add. 68 product_id: string; 69 70 // Quantity in "<integer>[.<fraction>]" form using the product unit rules. 71 quantity: DecimalQuantity; 72 } 73 74 .. ts:def:: UsingTemplatePaivanaRequest 75 76 interface UsingTemplatePaivanaRequest { 77 template_type: "paivana"; 78 79 // URL of the Paivana-protected website to be 80 // accessed. Will become the fulfillment URL in 81 // the contract. 82 website: string; 83 84 // Client Paivana ID to grant access to. 85 // This becomes the "session_id" for session-based 86 // access control. 87 paivana_id: string; 88 89 }