Skip to main content

Search

About the API

Search API is used to Discover the product for the Buyer from theONDC

  • The Search API allows users to search the full list of products based on the search query available in the Care Commerce.

  • Use the Search API to get a list of products available based on the Search parameter, Location, Mode of Payments etc..

Buyer Application can use Search API by Multiple ways:

  1. Search Product by City (Based on the City)
  2. Search Product by Product Name ( Based on the Product Name)
  3. Search Product by Category (Based on the Product Category)
  4. Search Product by Fulfillment (Based on the specified drop location or Pickup Location)
Method:               POST
Required Parameters: Need Products name and customer locations
Url: /protocol/v1/search
Description: On the buyer node, the user searches for a Product using the name (change based on requirements). The user expects a list of Products with matching name

Search API :

Parameters

FieldsPurposeLogic
intent.item.descriptor.name: coffeeThis field is used to search the item with their nameThis name matches with our database products name
intent.Fulfillment.type: DeliveryMention the type of deliveryNeed to check with logistic API
intent.Fulfillment.type.end.location.gps: 12.974002,77.613458End user locationNeed to check logistic service availability for the given location
intent.Fulfillment.type.end.location.address:area_code:560001End user area codeNeed to check logistic service availability
payment.@ondc/org/buyerapp finder_fee_typeBuyer app commission for selling the productBoth seller and buyer agree to the finder fee
payment.@ondc/org/buyerapp finder_fee_amountMention the amount of buyer app commissionBoth seller and buyer agree to the finder fee

Request Sample Data:

{
"context": {
"domain": "nic2004:52110",
"country": "IND",
"city": "std:080",
"core_version": "1.0.0",
"action": "search",
"bap_id": "carecommerce.in",
"bap_uri": "https://carecommerce.in/ondc/1.0/",
"transaction_id": "5b2b3137-5922-4592-82d0-5734446f4994",
"message_id": "7dd14992-ba43-42b8-ba02-a613e9e206fc",
"timestamp": "2022-11-17T12:34:03.992Z",
"ttl": "PT30S"
},
"message": {
"intent": {
"item": {
"descriptor": {
"name": "butter"
}
},
"fulfillment": {
"type": "Delivery",
"end": {
"location": {
"gps": "13.01659,77.68040"
}
}
},
"payment": {
"@ondc/org/buyer_app_finder_fee_type": "percent",
"@ondc/org/buyer_app_finder_fee_amount": "3"
}
}
}
}

ONDC uses async APIs, So the Seller App is taking some time to process the request. Search request response will be passed on the on_search API response it is also called as Callback API.

So the Search request response will be unique message id and +ve Ack

Response Sample Data:

{
"context": {
"domain": "nic2004:52110",
"country": "IND",
"city": "std:044",
"action": "search",
"core_version": "1.0.0",
"bap_id": "carecommerce.in",
"bap_uri": "https://carecommerce.in/protocol/v1",
"transaction_id": "ea2766e0-357c-4add-88c8-f6c5f64a170c",
"message_id": "37fd9c02-0f8b-4a3e-8397-b9ea64258c57",
"timestamp": "2022-11-24T07:31:47.870Z",
"ttl": "PT30S"
},
"message": {
"ack": {
"status": "ACK"
}
}
}

On_Search API:

Whenever the Buyer App calls the Search API with specific parameters, the OnSearch API can be called using the Unique Message ID to get the response for the Search API request.

An Unique Message ID will be generated for the specific request to the Buyer, Using the Unique Message ID, The product details can be fetched for the buyer.

Method:               POST
Required Parameters: Need provider_details,location_details,bpp_details,category_details,fulfillment_details
Url: /protocol/v1/on_search
Description: The seller node receives a search query and based on the request, it identifies matching items from the various seller catalogs on the platform. It consolidates all matching results and returns a list of items

Parameters

FieldsPurposeLogic
bpp/fulfillments.idUnique id of the fulfillmentThis field is used as the primary key to find the fulfillment
bpp/fulfillments.typeType of the deliveryThis describes the type of fulfillment ("Pickup" - Buyer picks up from store by themselves or through their logistics provider; "Delivery" - seller delivers to the buyer) Enum: [ Delivery, Pickup, Delivery and Pickup, Reverse QC ]
bpp/descriptor.nameRepresent the store nameIdentify the name of the store
bpp/descriptor.symbolRepresent the store symbol or logoAdditional information
bpp/descriptor.short_descDescription about the storeAdditional information
bpp/descriptor.long_descDescription about the storeAdditional information
bpp/descriptor.images[0]List of imagesAdditional information
bpp/providers[0].bpp/descriptorIts contains name,symbol, short_desc,long_desc and images of the providerAdditional information
bpp/providers[0].items[0].idUnique id of the productUse this field to identify the exact product
bpp/providers[0].items[0].descriptorDescribes a product or a service offered to the end consumer by the provider - Statutory requirements for category_id "Packaged Commodities" - descriptor.name (for item name), price.value (for declared price), price.maximum_value (for MRP); Statutory requirements for category_id "Packaged Foods" - descriptor.name (for item name), descriptor.symbol (for veg or non-veg), descriptor.short_desc (for food allergen), descriptor.long_desc (for instructions for use), price.value (for declared price); All other statutory attributes must be provided, as applicable, for the above; No statutory requirement for category_id "F&B" or "Fruits and Vegetables"Additional information
bpp/providers[0].items[0].quantityDescribes the count or amount of an itemQuantity will be decreased by a selected amount of count.
bpp/providers[0].items[0].priceDescribes the price of an item. Allows for domain extension.Used sort and filter the products based on the price
bpp/providers[0].items[0].fulfillment_idUnique reference ID to the fulfillment of an orderUse this id to what kind of delivery methods are used for the particular item
bpp/providers[0].items[0].location_idLocation/properties/idIdentify the location of product origin in case of any return
bpp/providers[0].items[0].@ondc/org/returnablewhether the item is returnableThis field is boolean. If it is a true need to check with logistic providers
bpp/providers[0].items[0].@ondc/org/cancellablewhether the item is cancellableThis field is boolean. If it is a true need to check with logistic providers
bpp/providers[0].items[0].@ondc/org/seller_pickup_returnin case of a return, whether the item should be picked up by sellerNeed check seller agrees to pick up the product
bpp/providers[0].items[0].@ondc/org/time_to_shiptime from order confirmation by which item ready to ship in ISO8601 durations format (e.g. 'PT30M' indicates item ready to ship in 30 mins). Mandatory for category_id "F&B"Check with logistic API to delivery person can pickup
bpp/providers[0].items[0].@ondc/org/available_on_codwhether the catalog item is available on CODLogistic provider to accept the payment, need to check with logistic provider
bpp/providers[0].items[0].@ondc/org/contact_details_consumer_carecontact details for consumer careThis fields allows the end-user to contact the seller in case of any query about the product.
bpp/providers[0].items[0].@ondc/org/statutory_reqs_packaged_commoditiesmandatory for category_id "Packaged Commodities" - required attributes for all include the following - manufacturer_or_packer_name, manufacturer_or_packer_address, common_or_generic_name_of_commodity, net_quantity_or_measure_of_commodity_in_pkg, month_year_of_manufacture_packing_import; other attributes are required on case-by-case basisAdditional information about the package
bpp/providers[0].items[0].@ondc/org/statutory_reqs_prepackaged_foodmandatory for category_id "Packaged food" - required attributes include the following - nutritional_info, additives_info, net_quantity; other attributes are required on case-by-case basisCheck with the logistic API if the item is in the food category and needs to be delivered on time.
bpp/providers[0].items[0].@ondc/org/mandatory_reqs_veggies_fruitsmandatory for category_id "Fruits and Vegetables" required attributes include the following - net_quantityCheck with logistic API if the item is food category is Fruits and Vegetables. And order should be delivered on given time period.
bpp/providers[0].items[0].tagsDescribes a tag. This is a simple key-value store which is used to contain extended metadataMetadata about the order

Request Sample Data

messageId=37fd9c02-0f8b-4a3e-8397-b9ea64258c57

Response Sample Data

{
"context": {
"action": "on_search",
"bap_id": "carecommerce.in",
"bap_uri": "https://carecommerce.in/ondc/1.0/",
"bpp_id": "carecommerce.in",
"bpp_uri": "https://carecommerce.in/ondc/v1/148762/bpp/",
"city": "std:080",
"core_version": "1.0.0",
"country": "IND",
"domain": "nic2004:52110",
"message_id": "7dd14992-ba43-42b8-ba02-a613e9e206fc",
"timestamp": "2022-11-17T12:34:05.226Z",
"transaction_id": "5b2b3137-5922-4592-82d0-5734446f4994",
"ttl": "PT30S"
},
"message": {
"catalog": {
"bpp/descriptor": {
"images": [""],
"long_desc": "We are a collaborative commerce platform",
"name": "carecommerce",
"short_desc": "We are a collaborative commerce platform that is using data intelligence to turn simple payment transactions into powerful purchase tools that urge consumers to buy more products and better products from you.",
"symbol": ""
},
"bpp/fulfillments": [
{
"id": "1",
"type": "Delivery"
},
{
"id": "2",
"type": "Pickup"
},
{
"id": "3",
"type": "Delivery and Pickup"
}
],
"bpp/providers": [
{
"@ondc/org/fssai_license_no": "123456789",
"descriptor": {
"images": [""],
"long_desc": "We are a collaborative commerce platform",
"name": "carecommerce",
"short_desc": "We are a collaborative commerce platform that is using data intelligence to turn simple payment transactions into powerful purchase tools that urge consumers to buy more products and better products from you.",
"symbol": ""
},
"id": "111863",
"items": [
{
"@ondc/org/available_on_cod": false,
"@ondc/org/cancellable": false,
"@ondc/org/contact_details_consumer_care": "growth@plotch.ai, 9920175041",
"@ondc/org/return_window": "P7D",
"@ondc/org/returnable": false,
"@ondc/org/s": {
"net_quantity": ""
},
"@ondc/org/seller_pickup_return": false,
"@ondc/org/statutory_reqs_packaged_commodities": {
"common_or_generic_name_of_commodity": "",
"imported_product_country_of_origin": "India",
"manufacturer_or_packer_address": "",
"manufacturer_or_packer_name": "",
"month_year_of_manufacture_packing_import": "",
"net_quantity_or_measure_of_commodity_in_pkg": ""
},
"@ondc/org/statutory_reqs_prepackaged_food": {
"additives_info": "",
"nutritional_info": ""
},
"@ondc/org/time_to_ship": "P7D",
"category_id": "Packaged Foods",
"descriptor": {
"images": [
"https://cdn.plotch.io/image/upload/w_301,h_301/C/V/PLO1667275457_da39a3ee5e6b4b0d3255bfef95601890afd80709.jpg",
"https://cdn.plotch.io/image/upload/w_301,h_301/C/V/PLO1667275472_da39a3ee5e6b4b0d3255bfef95601890afd80709.jpg"
],
"long_desc": "delicious butter",
"name": "delicious butter",
"short_desc": "delicious butter",
"symbol": ""
},
"fulfillment_id": "1",
"id": "42621582",
"location_id": 148273,
"price": {
"currency": "INR",
"maximum_value": "50.0",
"value": "50.0"
},
"tags": {
"non-veg": "no",
"veg": "no"
}
}
],
"locations": [
{
"address": {
"area_code": "560016",
"city": "Bengaluru",
"state": "KARNATAKA",
"street": "Kalkere Road Horamavu Village, Hobli, Krishnarajapura,"
},
"circle": {
"gps": "13.0306162,77.667275",
"radius": {
"unit": "km",
"value": "15"
}
},
"gps": "13.0306162,77.667275",
"id": 148273,
"time": {
"days": "1,2,3,4,5,6,7",
"range": {
"end": "2200",
"start": "0800"
},
"schedule": {
"frequency": "PT4H",
"times": ["0800", "1300"]
}
}
}
],
"ttl": "P1D"
}
]
}
}
}