Aggregate Request
The aggregate
endpoint in Sleekshop allows you to bundle several requests into one, returning multiple results in a single response. This is useful for scenarios where you need to retrieve different pieces of data simultaneously, such as product details and distinct product fields.
POSTaggregate
Aggregate Request
This endpoint allows you to perform multiple API calls in a single request, aggregating the results. Each request is identified by a key, which is used to separate the responses in the aggregate object.
Required attributes
- Name
licence_username
- Type
- string
- Description
Your licence username.
- Name
licence_password
- Type
- string
- Description
Your licence password.
- Name
pipe
- Type
- json-array
- Description
A JSON array of requests. Each request must include a unique identifier and the corresponding request and arguments.
Request
POST
aggregatecurl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='aggregate' \
-d pipe='{
"names": {
"request": "search_distinct_products",
"args": {
"field": "name",
"constraint": [],
"language": "de_DE"
}
},
"special_product": {
"request": "get_product_details",
"args": {
"id_product": 42,
"language": "de_DE",
"country": "DE",
"needed_attributes": "[]"
}
}
}'
Response
{
"object": "aggregate",
"aggregate_names": {
"object": "search_distinct_products_result",
"count": 18,
"result": [
"Mütze orange",
"Hunting Pullover S",
"winterjacke rot XL",
"Laufschuh rot",
"Laufschuh blau",
"Laufschuh grün",
"Sneakers grün",
"Schneehut schwarz",
"Polar Jacket pink",
"Mütze blau",
"Polar Jacket blau",
"Schneehut dunkelblau",
"Sneakers italian",
"Hunting Pullover L",
"Hunting Pullover M",
"Winterjacke rot M",
"Winterjacke rot S",
"winterjacke rot L"
]
},
"aggregate_special_product": {
"object": "product",
"id": 42,
"name": "Schneehut dunkelblau",
"creation_date": "2016-03-25 17:22:22",
"class": "colorprod",
"seo": {
"permalink": "dunkelblau-schneehut-warm",
"title": "Dunkelblauer Schneehut",
"description": "Cooler Schneehut in dunkelblau",
"keywords": "dunkelblau, Schneehut, Muetze"
},
"availability": {
"quantity": 12,
"quantity_warning": 6,
"allow_override": 0,
"active": 1
},
"metadata": {
"element_number": "123321",
"taxclass": {
"name": "Standard",
"calculation": "INC",
"value": 0.19
},
"length": 20,
"width": 18,
"height": 25,
"weight": 0,
"notes": "",
"attributes": {
"name": {
"type": "CHAR",
"id": 532,
"name": "name",
"label": "Name",
"value": "Schneehut dunkelblau"
},
"short_description": {
"type": "TXT",
"id": 533,
"name": "short_description",
"label": "Kurzbeschreibung",
"value": "Warmer und superweicher Schneehut in dunkelblau"
},
"description": {
"type": "HTML",
"id": 534,
"name": "description",
"label": "Beschreibung",
"value": "<p>Dieser trendige Schneehut in der Farbe dunkelblau hat eine hohe Qualitu00e4t, ist sehr robust und gemu00fctlich.nAuu00dferdem besitzt er ein su00fcu00dfes Detail aus vielen Fransen am oberen Ende des Hutes.n-Rollsaumn-sehr fein gewebter Stoffn-Stoff: leicht und elastischn-Passform: normaln-Muster: unin-Material: 65%Baumwolle 35%PolyesternPflegehinweise: Maschinenwu00e4sche bei 30 GradnArtikelnummer: XX932048-34</p><br><p><br></p>"
},
"price": {
"type": "FLOAT",
"id": 535,
"name": "price",
"label": "Preis",
"value": 27.9
},
"img1": {
"type": "IMG",
"id": 536,
"name": "img1",
"label": "Bild 1",
"value": "https://demo.sleekshop.net/srv/uploads/shopobject_images/cadf5ae384c909a010d3ab31bdb94456.jpg",
"width": "200",
"height": "200"
}
}
}
}