Retrieving a Product List with the Network Catalog Management API
The GET /products endpoint of the Network Catalog Management API enables you to retrieve a product list from your network catalog using the OData protocol. You can use query parameters to filter, sort, and paginate the results.
Procedure
To retrieve a product list, use the GET /products endpoint.
In the API header, specify the following parameters:
|
Header Parameter |
Type |
Description |
|---|---|---|
|
X-ARIBA-NETWORK-ID |
String |
Required. Your SAP Business Network ID (ANID). |
|
Accept-Language |
String |
Optional. Specifies the language used for searching the product names given in the $search parameter. The default is en (English). You can specify up to two languages, separated by a comma. The second language is used when a product name in the first language is not available. For a list of language codes, see Language Codes. |
|
apiKey |
String |
Required. The application key of the application you created in SAP Ariba Developer Portal. If you don’t have an application, create one as described in Steps to Start Using the Network Catalog Management API. |
In the request body, apply query parameters based on your needs. You can refer to the sample codes in Examples.
|
Query Parameter |
Type |
Description |
|---|---|---|
|
$top |
Integer |
The maximum number of products to return in the response. The default is 20. |
|
$skip |
Integer |
Number of products to skip before starting to return results. If it's not specified, no products are skipped and the response starts with the first product.
$skip can be used together with $top to divide a long list into smaller "pages". For example, to show 100 products at a time:
|
|
$count |
Boolean |
Set this to true if you want to return the total number of matching products in the response. |
|
$filter |
String |
Filters products by product properties. Supported properties and operations are:
|
|
$search |
String |
Searches products by product names. It supports full text search. For example, $search=PROD243 returns products with names that contain PROD243. A product can have different names in different languages. You can use the Accept-Language header parameter to specify in which language you want to search the name. For example, if your request contains $search=PROD243 and you've set Accept-Language to fr (French), the search will return products with French names that contain PROD243. |
|
$expand |
String |
By default, the retrieved product list does not include information on prices, images, carbonEmission, and circularEconomy. You can use $expand to include these properties in the response. Separate each property with a comma. |
|
$orderby |
String |
Sorts the product list by a specified property. You can only sort by validTo, validFrom, or modifiedTime in either ascending (asc, default) or descending (desc) order. By default, the list is sorted by modifiedTime in descending order. |
If the request is successful, the endpoint returns HTTP status code 200 OK and the requested product list.
If the request is unsuccessful, the response includes an error message. See Error Messages Returned by the Network Catalog Management API to troubleshoot your request.
Examples
List all products in your network catalog
Sample request: GET /products
{
"value": [
{
"productId": "PROD243T1",
"categoryCode": "503036",
"ean": "101",
"upc": "201",
"unit": "EA",
"validTo": "2024-06-19",
"validFrom": "2024-06-10",
"productUrl": "https://www.example.com/product/1029995.html",
"manufacturerName": "SAP",
"manufacturerPartId": "ARIBA1000",
"manufacturerUrl": "https://www.example.com",
"name": [
{
"lang": "en",
"value": "SAP Network Catalog Product Name"
}
],
"description": [
{
"lang": "en",
"value": "SAP Network Catalog Product Description"
}
],
"summary": [
{
"lang": "en",
"value": "SAP Network Catalog Product Description"
}
],
"leadShippingTime": 2,
"productStatus": "DRAFT",
"categoryName": "Wine Grapes",
"modifiedTime": "2024-05-10T16:00:00Z"
}
{
"productId": "PROD243T2",
......
},
{
"productId": "PROD243T8",
......
}
]
}
List products and show the total count of retrieved products
Sample request: GET /products?$count=true
{
"count": 100,
"value": [
......
]
}
List products with $skip and $top
Sample request: GET /products?$skip=1&$top=2
{
"value": [
{
"productId": "PROD243T1",
......
},
{
"productId": "PROD243T2",
......
}
]
}
List products with expanded product information
Sample request: GET /products?$expand=prices,images
{
"value": [
{
"productId": "PROD243T1",
......,
"prices": [
{
"currencyIso": "USD",
"countryIsoCode": "US",
"unit": "H87",
"validFrom": "2024-06-10",
"validTo": "2024-06-19",
"regionIsoCode": "US-CA",
"value": 100,
"scale": 1
},
......
],
......,
"images": {
"image1": "https://api.cc.commerce.ondemand.com/occ/v2/bnCatalog/medias/image1.jpg",
"image2": "https://api.cc.commerce.ondemand.com/occ/v2/bnCatalog/medias/image2.jpg",
"image3": "https://api.cc.commerce.ondemand.com/occ/v2/bnCatalog/medias/image2.jpg",
"image4": "https://api.cc.commerce.ondemand.com/occ/v2/bnCatalog/medias/image4.jpg",
"image5": "https://api.cc.commerce.ondemand.com/occ/v2/bnCatalog/medias/image5.jpg"
},
......
},
......
]
}
If you include an unsupported property in the $expand parameter, for example GET /products?$expand=prices,images,summary, the response will include an error message similar to the following:
{
"error": {
"code": "101056",
"message": "Invalid request: The property 'summary', used in a query expression, is not defined in type 'product'."
}
}
List products with $filter
Filter the list by a single property (productId):
GET /products?$filter=(productId eq 'prod3881026') or (productId eq 'prod3881027') or (productId eq 'prod3881028')
{
"value": [
{
"productId": "prod3881026",
......
},
{
"productId": "prod3881028",
......
}
]
}
Filter the list by multiple properties:
GET /products?$filter=(productId eq 'prod3881026' or productId eq 'prod3881027') and (productStatus eq 'DRAFT') and (categoryCode eq '352200' or categoryCode eq '567800' or categoryCode eq '437600') and (modifiedTime ge 2024-05-24T08:06:39+02:00 and modifiedTime le 2024-08-24T08:06:39Z)
{
"value": [
{
"productId": "prod3881026",
"categoryCode": "437600",
......
"productStatus": "DRAFT",
......
"modifiedTime": "2024-06-16T16:00:00Z"
}
]
}
If you include an unsupported property in the $filter parameter, for example, GET /products?$filter=manufacturerName eq 'SAP', the response will include an error message similar to the following:
{
"error": {
"code": "101056",
"message": "Invalid request: The property 'manufacturerName', used in a query expression, is not defined in type 'OData.OpenAPI.product'."
}
}
List products in a specific order
Sample request (ascending order): GET /products?$orderby=validTo
Sample request (descending order): GET /products?$orderby=modifiedTime desc
List products with $search
You can search product names in a specific language. For example, if your request contains $search=PROD243 and you've set Accept-Language to fr (French), the search will return products with French names that contain PROD243.
Get /products?$search=Traube Accept-Language: "fr"
{
"value": [
{
......,
"name": [
{
"lang": "en",
"value": "Grape"
},
{
"lang": "fr",
"value": "Traube"
}
],
......
},
......
]
}