.. _quoting-tutorial: Tutorial ======== Quoting service is a very straightforward product. In this tutorial I’m going to show you how to get price quote for few models. We’ll start with a few models that I’ve uploaded: .. image:: images/crank_handle.png :height: 200px :width: 221px For my tutorial I will be working on this model. It will be called ‘Crank handle’. I have uploaded this model and gotten back the URI. You can learn more about how to upload models to 3Diax in :ref:`3diax-reference`. The URI is as follows: .. csv-table:: model URIs :header: "Model", "Model URI" "Crank handle", "https://models.authentise.com/model/29301921-2dcd-4281-bb3f/" This is important because Quoting service relies on model URIs to do its work. Quoting module doesn’t expect you to move model data around yourself - that would be extremely inconvenient since they may be many hundreds of megabytes in size. Instead you use URIs as a pointer to a model and keep the data very light and fast. Two primary things to look up before making a request for quoting price for printing is to check: ``/bureau/``: This is the list of third party vendors that we support. ``/material/``: This is the list of materials that we support for quoting. To obtain the list of Bureaus that we support, you can do a request on ``/bureau/`` endpoint. .. sourcecode:: javascript GET https://quoting.authentise.com/bureau/ {'resources': [{ 'name': "shapeways", 'uri': "https://quoting.authentise.com/bureau/613d90ad-50ff-4e7b-85fd-853119bd319a/", }, { 'name': "materialise", 'uri': "https://quoting.authentise.com/bureau/70e3199c-c1b0-4358-94a1-8dd0f66d49ed/", }] } The list is returned embedded in ``resources`` object. It can be understood in the following: ``name`` : Name of the bureau. ``uri`` : Unique identifier of the bureau. So, when you want a price quote from a specific bureau, you will use the ``name`` of the bureau. To obtain the list of Materials that we support, you can do a request on ``/material/`` endpoint. .. sourcecode:: javascript GET https://quoting.authentise.com/material/ {'resources': [ { 'swatch': "https://external-url.com/img/materials/white-gold-14k.png", 'name': "Gold White 14k", 'identifiers': [{ 'bureau': "shapeways", 'id': "101", 'finish_id': Null, }], 'uri': "https://quoting.authentise.com/material/2e169d93-96d9-4c8c-821b/" }, { 'swatch': "https://external-url.com/img/materials/white-gold-14k.png", 'name': "Gold White 14k", 'identifiers': [{ 'bureau': 'materialise', 'id': 'd01a95ab-aaba-44f0-a4b6-8f72b66655b1', 'finish_id': '8f1cc7fa-8422-43e3-abf7-a7a2f8f63b8f', }], 'uri': "https://quoting.authentise.com/material/9463728-96d9-4c8c-5462/" } ]} The list of materials is returned embedded in ``resources`` object. It can be understood in the following: ``swatch``: image of the material. ``name`` : Name of the material. ``identifiers``: ``id``: identifier as provided by the bureau. ``bureau``: bureau the material belongs to. ``finish_id``: identifier for finish of the material. ``uri`` : Unique identifier of the material. So, when you want a price quote from a specific bureau, you will use the URI of the material. Now we are ready to quote a price for the model I have uploaded. The request would be like this: .. sourcecode:: javascript POST https://quoting.authentise.com/quote/ Content-Type: application/json { 'bureau' : 'shapeways', 'callback' : { 'method' : "POST", 'url' : "http://localhost/callback", }, 'currency' : 'USD', 'material' : "https://quoting.authentise.com/material/2e169d93-96d9-4c8c-821b/", 'model' : "https://models.authentise.com/model/29301921-2dcd-4281-bb3f/", } The response from the ``POST`` request for the ``crank handle`` will have ``response header`` with ``204`` status once the request is successful. The user should have set the callback URL in order to obtain the price quote. You can checkout our callback service here :ref:`callback-service`. Once the user gets a success on the POST resource, he can do a ``GET`` on the callback URL to get the price quote. .. sourcecode:: javascript GET http://localhost/callback {'resources': [{ 'bureau' : 'shapeways', 'callback' : { 'method' : "POST", 'url' : "http://localhost/callback", }, 'currency' : 'USD', 'error' : null, 'material' : "https://quoting.authentise.com/material/2e169d93-96d9-4c8c-821b/", 'model' : "https://models.authentise.com/model/29301921-2dcd-4281-bb3f/", 'price' : 488, "status" : "complete", }]} The result would be for the ``shapeways`` bureau, for the ``crank handle`` model, in USD and for ``Gold White 14k`` material. If the user would have made a POST request to ``https://quoting.authentise.com/quote/`` using ``materialise`` bureau he would have got a response as as below: .. sourcecode:: javascript GET http://localhost/callback {'resources': [{ 'bureau' : 'materialise', 'callback' : { 'method' : "POST", 'url' : "http://localhost/callback", }, 'currency' : 'USD', 'error' : null, 'material' : "https://quoting.authentise.com/material/9463728-96d9-4c8c-5462/", 'model' : "https://models.authentise.com/model/29301921-2dcd-4281-bb3f/", 'price' : 478.73, "status" : "complete", }]} These both responses are shown to demonstrate the price quote from two difefrent bureaus. This will help in knowing the true cost of printing a model with particular material and bureau. You can find detailed information on how to use the Price Quoting Service in :ref:`quoting-reference`.