Spendint API
The Spendint API provides endpoints that push the catalog, price, availability, order, shipment, and invoice information from a third party to the ServiceNow instance. This API is part of the Source-to-Pay Integration Framework application.
This API requires the Procurement Integration Framework (com.glide.sn_spend_intg) store application and is provided within the sn_spend_intg namespace. For information, see Procurement File Transfer Framework.
To access this API, you must have the sn_spend_intg.procurement_integrator role.
Parent Topic:REST API reference
Spendint API - POST /sn_spend_intg/spendint/catalog
Allows suppliers to post multiple catalogs for creating supplier products, model products, contracts, and pricing records.
In the catalog API integration, when you receive data from a third-party catalog, you can:
- Create any new third-party categories and map these categories to model categories.
- If available, use the United Nations Standard Products and Services Code (UNSPSC) and then the category name.
- If UNSPSC is not available, use just the category name.
- After you map a third-party category to a model category, use the Manufacturer Part Number (MPN) to find an existing product model, if one is available.
- If a product model is found for the MPN, update the product model with any changes, and then create or update any supplier products that are related to the product model.
- If a product model does not exist for the MPN, do the following:
- A product model class is usually available on the model category that is referenced by the third-party category for the product. Use this product model class to get the product model table in which the product model should be created, for example, hardware, software, consumable, and so on. If no product model class is available, create the product model in the base product model table.
- After the correct product model class is identified, create a new product model in the correct class as follows:
- Manufacturer, publisher, or provider should map to the manufacturer on the product model.
- Product name from the API should map to the name on the product model.
- MPN from the API should update the model number.
- Product description from the API should update the description on the product model.
- Model category should be updated with the product category referenced on the third-party category record.
- Product category should be updated with the product category referenced on the third-party category record.
- If there are values in the substitute products in the API, create the substitute product records between the current product model and the other product models.
- If there are values in the compatible products in the API, create the compatible product records between the current product model and the other product models.
- Product attributes from the API should be created or updated in the product attribute related list for the product model.
- If a product model is available, use the supplier part number to create or update the supplier products that are related to the product model.
Third-party mapping
Use the following tables to perform the third-party category, model, and unit mappings:
- Third-Party Categories: Stores all the third-party category records for the ShoppingHub administrator to map with internal existing model categories.
- Third-Party Model Mappings: Stores all the mapping information between product models and third-party model categories.
- Third-Party Units: Stores all the third-party unit records for the ShoppingHub administrator to map with supplier product units.
- Third-Party Unit Mappings: Stores all the mapping information between product models and third-party units.
Note: A third-party integration product is auto-published when both the third-party category and third-party unit are mapped appropriately.
Supplier product sales dates
A supplier product is discontinued and no longer published in the catalog when it has reached its sales end date. The Sales start date and Sales end date fields on the Supplier product form are populated through third-party integration from theCatalog API.
Status tables
To know the status of the bulk product import request, make a REST call into the ServiceNow database using the Table REST API. The response from the API lists the records where the bulk import request failed. For bulk product import response, query the Catalog Error table with the following parameter:
sysparm_query=outbound_error.supplier_id=<supplier_id>^outbound_error.state=20
Details on the customer id, supplier id, error type, unique import set id, and state can be found in the Outbound Status table, which is the parent error table.
URL format
/api/sn_spend_intg/spendint/catalog
Supported request parameters
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| mode | Support for asynchronous and synchronous modes for third-party integration.Data type: String Valid values: - async: Asynchronous mode. - sync: Synchronous mode. Default: async |
| Name | Description |
|---|---|
| customer\_id | Identifier for the customer.Data type: String Maximum length: 100 |
| catalog\_id | Identifier for the catalog content that can be purchased by a customer.Data type: String Maximum length: 100 |
| products | List of objects that define products to create or update. Each transaction has a limit of 1000 products.Data type: Array ``` "products": [ { "available_units": "String", "available_for_country": [Array], "bundled_components": [Array], "contract_agreement": {Object}, "delivery_time": "String", "images": [Array], "manufacturer": "String", "mpn": "String", "parent_bundle": "String", "product_attributes": {Object}, "product_category_name": "String", "product_description": "String", "product_name": "String", "sku": "String", "unit": "String", "unspsc": "String", } ] |
| products.bundled\_components | Valid only for scenarios when sending a product bundle as part of the catalog payload, and applicable only for the parent bundle payloads. This value contains the reference to the child bundle components. The list of the MPN and quantities for the child bundle components are maintained here.Note: Since the same child bundle component can be added more than once within a bundle, the entered quantity is the differentiator between the same children bundle components. The child bundle components and their details (MPN and quantities) should be mapped to the same supplier.Data type: Array
|
| products.contract\_agreement | Details of the contract for a product.Note: This is not required for child bundle components. Data type: Object
|
| products.contract\_agreement.contract\_end\_date | Date on which the contract term ends.Data type: String Maximum length: 40 Format: YYYY-MM-DD |
| products.contract\_agreement.contract\_number | Required. Number of the active contract that is associated with the product.Data type: String Maximum length: 100 |
| products.contract\_agreement.contract\_start\_date | Date on which the contract term starts.Data type: String Maximum length: 40 Format: YYYY-MM-DD |
| products.contract\_agreement.negotiated\_currency | Required. Currency of the negotiated price.Data type: String Maximum length: 40 |
| products.contract\_agreement.negotiated\_price | Required. Unit price of a product as negotiated through a contract with the supplier or reseller.Data type: String Maximum length: 40 |
| products.delivery\_time | Estimated number of days it takes to ship a product to the customer. This value must represent the number of days and be a whole integer.Data type: String Maximum length: 40 |
| products.images | List of strings that specify the image URLs for the supplier product.Data type: Array |
| products.manufacturer | Required. Company that manufactures, publishes, or provides the product. This is not the supplier or reseller of the product.Data type: String Maximum length: 100 |
| products.mpn | Required. Identifier for a product that is provided by the manufacturer, publisher, or provider.Note: This is not required for reseller parent bundles if the SKU value is available. Data type: String Maximum length: 100 |
| products.parent\_bundle | Valid only for scenarios when sending a product bundle as part of the catalog payload, and applicable only for the child bundle component payloads. In the case of a child bundle component, the reference to the parent is maintained here. The parent MPN and SKU values are also set here.Data type: String Maximum length: 100 |
| products.product\_attributes | List of key-value pairs that define product attributes, for example, `"Color": "Space Grey"`. Multiple attributes for a product are allowed. However, only those attributes that impact pricing or stock availability should be provided through the API.Data type: Object |
| products.product\_category\_name | Required. Name that you enter if you are not setting the unspsc property. This name is the category to which a product belongs. This category name can be used in a commerce scenario to shop for the product. For example, a power strip product could belong to an Office Equipment category.Data type: String Maximum length: 100 |
| products.product\_description | Full description of the product that appears to a shopper within a commerce experience.Note: It is recommended that the supplier be as descriptive as possible here, especially for product bundle catalog items where there are child bundle components. Data type: String Maximum length: 65000 |
| products.product\_name | Required. Name of the product.Data type: String Maximum length: 1000 |
| products.sku | Required. Number that is generated by a supplier that uniquely identifies a product that is sold by that supplier.Data type: String Maximum length: 100 |
| products.unit | Required. Unit or rate at which the product is sold by the supplier. For example, pieces, hours, and so on.Data type: String Maximum length: 40 |
| products.unspsc | Required. Identifier that you enter if you are not setting the product_category_name property. This identifier is the UNSPSC for the category to which a product belongs. For example, UNSPSC code 43210000 is the identifier for the product category Computers.Data type: String Maximum length: 100 |
| supplier\_id | Required. Identifier for the reseller or supplier with whom the customer can place orders.Data type: String Maximum length: 100 |
| third\_party\_import\_id | Identifier that enables a third party to pass a string value to uniquely identify a set of imported data.Data type: String Maximum length: 100 |
Headers
The following request and response headers apply to this HTTP action only or apply to this action in a distinct way.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml. Default: application/json |
Note: Only the application/json data format is supported for Procurement Integration Framework.
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action.
| Status code | Description |
|---|---|
| success | Successful. The request was successfully processed. |
| failure | Unsuccessful. The request was processed with errors. |
Response body parameters (JSON)
These response body parameters are received when queried in synchronous mode.
| Name | Description |
|---|---|
| error\_response\_body | Description of the errors, listed by sku, mpn, and the error message.Data type: Array |
| error\_response\_body.error\_message | Detailed error message.Data type: String |
| status\_code | Response status such as "success" or "failure."Data type: String |
cURL request
curl "https://instance.service-now.com/api/sn_spend_intg/spendint/catalog" \
--request POST \
--header "Accept:application/json" \
--user 'username':'password'
{"root": [{
"customer_id": "AB-1234323",
"catalog_id": "ACME CORP-12347898",
"supplier_id": "SUP-123456",
"third_party_import_id": "DELL1234567",
"products": [
{
"product_name": "Apple MacBook Pro 13 Core i7",
"mpn": "Z0WQ-20004301931",
"sku": "55788741",
"manufacturer": "Apple",
"product_category_name": "Computer",
"parent_bundle": "920-0045362002",
"bundled_components": {
"mpn": "Z0WQ-20004301931",
"quantity": "4",
},
"unspsc": "43211500",
"product_description": "Apple MacBook Pro 13 Core i7 2.8GHz 16GB 512GB - Touch Bar - Space Gray",
"product_attributes": {
"Color": "Space Grey",
"RAM": "16GB",
"Screen Size": "13inch"
},
"images": ["http://test123.image1.png", "http://test123.image2.jpeg"],
"unit": "Each",
"available_units": "4",
"available_for_country": ["US","IN","GB"],
"delivery_time": "4",
"contract_agreement": {
"contract_number": "34567892",
"contract_start_date": "YYYY-MM-DD",
"contract_end_date": "YYYY-MM-DD",
"negotiated_price": "456",
"negotiated_currency ": "USD"
}
}
]
}
]}
Possible responses:
// Success response:
{
"result": {
"response": "success"
}
}
// Error response:
{
"result": {
"response": [
{
"customer_id": "AB-1234323",
"supplier_id": "SUP-123456",
"third_party_import_id": "DELL1234567",
"status_code": "failure",
"error_response_body": [
{
"sku": "55788741",
"mpn": "Z0WQ-20004301931",
"error_message": "Field Value empty/Formatting issue Negotiated currency \n"
}
]
}
]
}
}
Spendint API - POST /sn_spend_intg/spendint/price
Updates any pricing for supplier product records.
When pricing is available for supplier product records, the API uses the product SKU to find an existing supplier product. If a matching supplier product exists, the corresponding contract price is updated. If no matching supplier product is found, an error message is generated, stating that the product for which you are trying to update pricing for does not exist.
Status tables
To know the status of the price import request, make a REST call into the ServiceNow database using the Table REST API. The response from the API lists the records where the price import request failed. For a price import response, query the Price Error table with the following parameter:
sysparm_query=outbound_error.supplier_id=<supplier_id>^outbound_error.state=20
You can find the details on the customer ID, supplier ID, error type, unique import set ID, and state can in the Outbound Status table, which is the parent error table.
URL format
/api/sn_spend_intg/spendint/price
Supported request parameters
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| mode | Support for asynchronous and synchronous modes for third-party integration.Data type: String Valid values: - async: Asynchronous mode. - sync: Synchronous mode. Default: async |
| Name | Description |
|---|---|
| catalog\_id | Required. Identifier for the catalog content that can be purchased by a customer.Data type: String Maximum length: 100 |
| customer\_id | Required. Identifier for the customer.Data type: String Maximum length: 100 |
| products | List of objects that define products to create or update. Each transaction has a limit of 1000 products.Data type: Array ``` "products": [ { "contract_agreement": {Array}, "sku": "String" } ] |
| products.contract\_agreement.contract\_end\_date | Date on which the contract term ends.Data type: String Maximum length: 40 Format: YYYY-MM-DD |
| products.contract\_agreement.contract\_number | Required. Number of the active contract that is associated with the product.Data type: String Maximum length: 100 |
| products.contract\_agreement.contract\_start\_date | Date on which the contract term starts.Data type: String Maximum length: 40 Format: YYYY-MM-DD |
| products.contract\_agreement.negotiated\_currency | Required. Currency of the negotiated price.Data type: String Maximum length: 40 |
| products.contract\_agreement.negotiated\_price | Required. Unit price of a product as negotiated through a contract with the supplier or reseller.Data type: String Maximum length: 40 |
| products.sku | Required. Number that is generated by a supplier that uniquely identifies a product that is sold by that supplier.Data type: String Maximum length: 100 |
| supplier\_id | Required. Identifier for the reseller or supplier that the customer can place orders with.Data type: String Maximum length: 100 |
| third\_party\_import\_id | Identifier that enables a third party to pass a string value to uniquely identify a set of imported data.Data type: String Maximum length: 100 |
Headers
The following request and response headers apply to this HTTP action only or apply to this action in a distinct way.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml. Default: application/json |
Note: Only the application/json data format is supported for Procurement Integration Framework.
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action.
| Status code | Description |
|---|---|
| success | Successful. The request was successfully processed. |
| failure | Unsuccessful. The request was processed with errors. |
Response body parameters (JSON)
These response body parameters are received when queried in synchronous mode.
| Name | Description |
|---|---|
| error\_response\_body | Description of the errors, listed by sku and the error message.Data type: Array |
| error\_response\_body.error\_message | Detailed error message.Data type: String |
| status\_code | Response status such as "success" or "failure."Data type: String |
cURL request
curl "https://instance.service-now.com/api/sn_spend_intg/spendint/price" \
--request POST \
--header "Accept:application/json" \
--user 'username':'password'
{"root": [{
"customer_id": "ACME CORP",
"catalog_id": "AB-1234323",
"supplier_id": "SUP-123456",
“third_party_import_id”: “DEL789876",
"products": [
{
"sku": "5578874",
"contract_agreement": {
"contract_number": "34567892",
"contract_start_date": "YYYY-MM-DD",
"contract_end_date": "YYYY-MM-DD",
"negotiated_price": "456",
"negotiated_currency ": "USD"
}
}
]
}
]}
Possible responses:
// Success response:
{
“result”: {
“response”: “success”
}
}
// Error response:
{
“result”: {
“response”: [
{
“customer_id”: “ACME CORP”,
“supplier_id”: “SUP-123456”,
“third_party_import_id”: “DEL789876",
“status_code”: “failure”,
“error_response_body”: [
{
“sku”: “5578874”,
“error_message”: “The product for which you are trying to update pricing does not exist\nField Value empty/Formatting issue Negotiated currency\nField Value empty/Formatting issue Contract start date\nField Value empty/Formatting issue Contract end date\n”
}
]
}
]
}
}
Spendint API - POST /sn_spend_intg/spendint/availability
Updates the availability for supplier product records.
When supplier product records are available, the API uses the product SKU to find an existing supplier product. If a matching supplier product exists, the corresponding available_units field is updated. If no matching supplier product is found, an error message generates stating that the product for which you are trying to update availability for does not exist.
Status tables
To know the status of the update availability request, make a REST call into the ServiceNow database using the Table REST API. The response from the API lists the records where the update availability request failed. For update availability response, query the Availability Error table with the following parameter:
sysparm_query=outbound_error.supplier_id=<supplier_id>^outbound_error.state=20
The details on the customer ID, supplier ID, error type, unique import set ID, and state can be found in the Outbound Status table, which is the parent error table.
URL format
/api/sn_spend_intg/spendint/availability
Supported request parameters
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| mode | Support for asynchronous and synchronous modes for third-party integration.Data type: String Valid values: - async: Asynchronous mode. - sync: Synchronous mode. Default: async |
| Name | Description |
|---|---|
| catalog\_id | Required. Identifier for the catalog content that can be purchased by a customer.Data type: String Maximum length: 100 |
| customer\_id | Required. Identifier for the customer.Data type: String Maximum length: 100 |
| products | List of objects that define the products to update. Each transaction has a limit of 1000 products.Data type: Array ``` "products": [ { "available_units": "String", "sku": "String", "unit": "String" } ] |
| sales\_order\_lines.estimated\_arrival\_date | Estimated arrival date of the order.Data type: String Maximum length: 40 Format: YYYY-MM-DD |
| sales\_order\_lines.line\_number | Required. Purchase order line number that was generated by the customer for a particular purchase.Data type: String Maximum length: 40 |
| sales\_order\_lines.sales\_order\_line\_number | Sales order line number that was generated by the supplier. This number is required only for revisions to this purchase.Data type: String Maximum length: 40 |
| sales\_order\_number | Number or value that is generated by the supplier for this order.Data type: String Maximum length: 40 |
| status\_code | Required. Status of the submitted order that confirms if the order was successfully placed.Data type: String Valid values: - confirmed: Order placed successfully. - rejected: Order not placed. |
| status\_message | Message that is attached to a status code. For example, the message could be that the order was successfully placed and is on back order.Data type: String Maximum length: 1000 |
| supplier\_id | Required. Identifier for the reseller or supplier that the customer can place orders with.Data type: String Maximum length: 100 |
| third\_party\_import\_id | Identifier that enables a third party to pass a string value to uniquely identify a set of imported data.Data type: String Maximum length: 100 |
Headers
The following request and response headers apply to this HTTP action only or apply to this action in a distinct way.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types: application/json or application/xml. Default: application/json |
Note: Only the application/json data format is supported for Procurement Integration Framework.
| Header | Description |
|---|---|
| None |
Status codes
The following status codes apply to this HTTP action.
| Status code | Description |
|---|---|
| success | Successful. The request was successfully processed. |
| failure | Unsuccessful. The request was processed with errors. |
Response body parameters (JSON)
These response body parameters are received when queried in synchronous mode.
| Name | Description |
|---|---|
| error\_response\_body | Description of the errors, listed by the sales order number, sales order line number, and the error message.Data type: Array |
| error\_response\_body.error\_message | Detailed error message.Data type: String |
| status\_code | Response status such as "success" or "failure."Data type: String |
cURL request
curl "https://instance.service-now.com/api/sn_spend_intg/spendint/orderack" \
--request POST \
--header "Accept:application/json" \
--user 'username':'password'
{"root":[{
"customer_id": "ACME CORP",
"supplier_id": "SUP-123456",
"third_party_import_id": "undefined",
"order_number": "PO08903323",
"sales_order_number": "SO03323212",
"status_code": "CONFIRMED",
"status_message": "BACKORDERED",
"sales_order_lines":[
{
"line_number": "POL6789876",
"sales_order_line_number": "SOL5678909",
"estimated_arrival_date": "YYYY-MM-DD"
}
]
}
]}
Possible responses:
// Success response:
{
"result": {
"response": "success"
}
}
// Error response:
{
"result": {
"response": [
{
"customer_id": "ACME CORP",
"supplier_id": "SUP-123456",
"third_party_import_id": "undefined",
"status_code": "failure",
"error_response_body": [
{
"sales_order_number": "SO03323212",
"sales_order_line_number": "SOL5678909",
"error_message": "Field Value empty/Formatting issue Purchase order number\nField Value empty/Formatting issue Purchase order line number\n"
}
]
}
]
}
}
Spendint API - POST /sn_spend_intg/spendint/shipment
Use this endpoint to accept updates on purchases from third parties.
When you receive data, you must match the shipment data to a purchase order line by using the sales order line number. You can use the tracking number to find an existing shipment detail record that is related to the purchase order line. If no such record is found, create a new shipment detail record. If no purchase order or purchase order line exists for the shipment data, you see an error message that states that the purchase order for this shipment does not exist.
Note: If the purchase order and purchase order lines are in the Pending Submission status, and the sales order and sales order lines are not populated, then the shipment and invoice posting from the third-party reseller is not allowed. It is only allowed when the status of the purchase order and purchase order lines are Ordered. Also, there is no sequential restriction on shipment and invoice posting.
Status tables
To know the status of the shipping request, make a REST call into the ServiceNow database using the Table REST API. The response from the API lists the records where the shipping update failed. To get a shipping response, query the Shipment Error table with the following parameter:
sysparm_query=outbound_error.supplier_id=<supplier_id>^outbound_error.state=20
The details on the customer ID, supplier ID, error type, unique import set ID, and state can be found in the Outbound Status table, which is the parent error table.
URL format
/api/sn_spend_intg/spendint/shipment
Supported request parameters
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| mode | Support for asynchronous and synchronous modes for third-party integration.Data type: String Valid values: - async: Asynchronous mode. - sync: Synchronous mode. Default: async |
| Name | Description |
|---|---|
| customer\_id | Identifier for the customer.Data type: String Maximum length: 100 |
| order\_number | Required. Purchase order number that is provided by the customer for this order.Data type: String Maximum length: 40 |
| sales\_order\_number | Required. Number or value that is generated by the supplier for this order.Data type: String Maximum length: 40 |
| shipment\_lines | List of shipment lines that can contain the serial number, IMEI number, and asset tag details of the assets.Data type: Array ``` "shipment_lines": [ { "actual_shipment_date": "String", "estimated_arrival_date": "String", "line_number": "String", "planned_shipment_date": "String", "product_details": [Array], "sales_order_line_number": "String", "shipping_address": {Object}, "shipping_carrier": "String", "shipment_quantity": "String", "ship_to": "String", "tracking_number": "String" } ] |
| shipment\_lines.product\_details.asset\_tag | Asset tag of the shipped product.Data type: String Maximum length: 100 |
| shipment\_lines.product\_details.imei | IMEI number of the shipped product.Data type: String Maximum length: 100 |
| shipment\_lines.product\_details.serial\_number | Required. Serial number of the shipped product.Data type: String Maximum length: 100 |
| shipment\_lines.sales\_order\_line\_number | Sales order line number that is generated by the supplier. This number is required only for revisions to this purchase.Data type: String Maximum length: 40 |
| shipment\_lines.shipping\_address | Address where the products are being shipped to.Data type: Object ``` "shipping_address": { "city": "String", "country": "String", "name": "String", "state": "String", "street": "String", "zip_code": "String" } |