odata - Search by keyword in Saferproducts.gov API? -
i trying search report on basis of keyword safeproducts api (http://www.saferproducts.gov/webapi/cpsc.cpsrms.web.api.svc) provide search functionality on site @ http://www.saferproducts.gov/search/default.aspx
but not find way search it. api in odata format have never used before guessing may lack of knowledge of how query odata based service or don't provide search method in web service.
can 1 plz confirm understanding correct ?
thanks, khan
yes, can use $filter
have search. if service based on odata v3, uri should be:
http://services.odata.org/northwind/northwind.svc/customers?$filter=substringof('alfreds', companyname)
you can reference odata v3 url conventions
if service based on odata v4, uri should be:
http://host/service/customers?$filter=contains(companyname,'alfreds')
you can reference odata v4 url conventions
by way, can access http://www.saferproducts.gov/webapi/cpsc.cpsrms.web.api.svc/$metadata
identify service version. if have "m:dataserviceversion="3.0" m:maxdataserviceversion="3.0"
" on top of page, service should based on odata v3. if there no such line, service should based on odata v4.
Comments
Post a Comment