Symptom
- Unable to extract more than 100 material masters using Product Master APIs for both API_PRODUCT_SRV (OData V2) and CE_PRODUCT_0002(OData V4).
- How to retrieve more than 100 materials in APIs.
- Do not know what OData V4 "Product (Version 2)" default paging size constraints are.
- How to check if other APIs contain specifications to avoid the possibility of a DOS attack.
- How to find default paging size constraints and retrieval of material master's product data using Product Master APIs.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Attempt to extract more than 100 material masters using the OData V4 "Product (Version 2)" or OData V2 "Product Master (A2X)" API.
- Request is succeeded but only returned 100 materials.
Cause
The feature of default paging for entity sets in OData V4 "Product (Version 2)" and OData V2 "API_PRODUCT_SRV" has been enabled to prevent the possibility of a DOS attack.
Default paging size is set to 100, and the maximum limit is 5000 when using the $top token.
This applies only to GET operations.
Resolution
OData V4 "Product (Version 2)" and OData V2 "API_PRODUCT_SRV" has a default paging size constraint of 100, which can be increased to a maximum of 5000 using the $top token.
To retrieve more than 5000 products, use the $skip token in combination with $top to iterate through the data in chunks. For example:
- Request the first 5000 products using "?$top=999999".
- Request the next 5000 products using ?$top=999999&$skip=5000" to request the next set of 5000 products.
- Repeat the process until all products are retrieved.
To check the maximum $top value for an API do the following:
- Use the GET method with the token "?$top=999999" at the end of the request URL.
- Check at the end of response for the presence of $skiptoken value. The skip token associated value is the maximum paging size.
See Also
Keywords
Product Master API, default paging size, $top token, $skip token, DOS attack prevention, material master extraction, odata constraints, pagination, API Limit product retrieval, odata v 2, odata v 4. , KBA , LO-MD-MM-2CL , Product Master for Public Cloud , Problem