Creating a Quote
Introduction
Now that you understand how to read, write and delete data, you'll now need to know the process for creating a quote and opening it in the Blueprint Configurator. There are three records you will need to create/read before you can configure a quote (assuming your system has Currencies and Price Books configured), these are;
- A Company
- A Contact
- A Quote
Companies
In order to create a quote, we first need a company. You have two options here;
- Pick an existing company from your database.
- Create a new company.
If you need to create a company, follow the steps in writing data to add a new record. If you already have a company you will need to have its record identifier to hand (if you don't have the identifier, you can follow the steps from the reading data article to help you get it).
Contacts
The same then applies for contacts. If the company doesn't have any contacts, you will need to create one. You will then need to keep the contact record identifier for creating a quote.
Quotes
Finally, you will need to create a quote record. To work out what fields need to be sent, it is worth checking the metadata to see what fields are required. Two of the fields you will need to fill in against the quote will be the Company and Contact fields. These should be the identifiers you previously created/looked up.
Once you have written the record to XaitCPQ you will need to make a note of the record identifier. You will then be able to open the quote in the configurator.
Quote Products
Once you have created a quote, you may wish to add products. To get a list of the products that can be added you can call the following URL;
https://ofd-api.blueprintcpq.net/data/lookup/table/product
This will return you a list similar to the following;
[ { "Id" : "c2f66e1d-4975-4663-8aed-985a36013dc7", "HumanReadableValue" : "Example Product 1" }, { "Id" : "7777ff96-5ab8-4c09-a131-21fea6d03a4d", "HumanReadableValue" : "Example Product 2" }, { "Id" : "4b01c1c5-5b6a-433e-8d19-ddb24b1f24ab", "HumanReadableValue" : "Example Product 3" }, ... ]
In order to add one of these products to a quote, create a POST request similar to the following, replacing the first identifier with the quote identifier and the second identifier with the product identifier;
https://ofd-api.blueprintcpq.net/quote/product/add/8503d6d4-94ae-4416-b3b6-291e20d9d96e/c2f66e1d-4975-4663-8aed-985a36013dc7
Adding Parts, Notes & Documents
As well as products, Parts, Notes and Documents can also be added to quotes. These are documented in the API Reference under the Quote section.
Configuring a Quote
The first thing you need to do is get the configurator URL that needs to be opened. You can get the URL by calling the following API method, replacing the record identifier with the one you received after creating the quote;
https://ofd-api.blueprintcpq.net/quote/configurator/8503d6d4-94ae-4416-b3b6-291e20d9d96e
This will return the URL that you should call. It is also possible to add an optional return URL to the
request by added ?returnUrl=
to produce an API call similar to;
https://ofd-api.blueprintcpq.net/quote/configurator/8503d6d4-94ae-4416-b3b6-291e20d9d96e?returnUrl=http://www.google.co.uk
You can then open/redirect to the URL that is returned in order to configure your quote.
Reading the Quote Data
Once you've configured and saved the quote, you then may wish to read back the quote data.
Quote
Using the record identifier you already had from the API you can call the API using one of two methods.
-
If you have used a section identifier to read and write data, you can call a URL similar to the following
with both the section identifier and record identifier;
https://ofd-api.blueprintcpq.net/data/quote/a0983d68-3fe5-e511-80cd-00155d2d8e03/8503d6d4-94ae-4416-b3b6-291e20d9d96e
-
If you don't have a section identifier, you can call a URL similar to the following with just the record identifier
to access the whole quote record;
https://ofd-api.blueprintcpq.net/data/quote/8503d6d4-94ae-4416-b3b6-291e20d9d96e
Quote BOM
As well as the quote details, you may want to access other parts of the quote such as the BOM. In order to access the BOM, you will need to find out using metadata which section on the quote is the BOM. Once you have done that, you can call the following URL with the BOM section identifier and the record identifier as the base record;
https://ofd-api.blueprintcpq.net/data/list/Quote/882f6510-9beb-e511-80cd-00155d2d8e03/1/25?baseRecord=8503d6d4-94ae-4416-b3b6-291e20d9d96e
The number 1 in the URL indicates the page and 25 indicates the number of records per page. You can change these as required up to the maximum page size of records per page. These parameters are documented in the API Reference.