Skip to content

Search Service API

This is description of our public API. You can integrate with any programming language. See our clients for simpler integrations.

Examples assume that you are using uk01 location, but that can be different for your service.

Dictionary

  • Product: document that is indexed and later searchable
  • Category: document that is indexed and later searchable, that has less attributes than product
  • Document: currently product or category, in the future there will be some more

During this process, we are searching your documents (products), to return them to your customers.

Endpoint: GET https://uk01.apisearch.logshub.com/v1/products/search

Params (query)

Name Type Default Required Description
pub_key string Y Public key from your dashboard, used for JavaScript integration
q string Y Query phase
limit int 5 Limit search results, max 20
limit_cat int 2 Limit categories search results, max 20
callback string Javascript callback name, used for JavaScript integration. Response content type depends on this param
sort string relevance Field for sorting eg. relevance, name, price
sort_dir string Sort direction, asc or desc
category string Category name for filtering
features []string ["products"] Features to use, what response should contain, possible options: products, categories, fullresponse, aggcategories

Example request

curl -i -XGET "https://uk01.apisearch.logshub.com/v1/products/search?pub_key=dNdYJCj&q=lap"

Example response

{
    "products": {
        "total":1,
        "docs": [
            {
                "id":"2543",
                "name":"Laptop WiFi Dual Band Bluetooth 4GB RAM 1,4GHz",
                "description": "",
                "url": "",
                "url_image": "",
                "popularity": 0,
                "sku": "",
                "price": "",
                "currency": "",
                "headline": "",
                "availability": 0,
                "review_score": 0,
                "review_count": 0,
                "price_old": 0,
                "categories": ["Electronics", "Laptops"]
            }
        ],
        "agg_categories": [
            {"key": "phones", "value": 4},
            {"key": "computers", "value": 3}
        ]
    },
    "categories": {
        "docs": [
            {
                "id":"2543",
                "name":"Laptops",
                "description": "",
                "url": "",
                "url_image": "",
                "categories": ["Electronics"]
            }
        ]
    }
}

Index Products

During this process, we are indexing your documents (products), to make searchable for your frontend integrations (for customers of your store)

Endpoint: POST https://uk01.apisearch.logshub.com/v1/products

Authorization (header): Authorization: ApiHash, ApiSecret

Params (json)

Name Type Required Description
service_id string Y UUID of your service
docs [] Y Documents to index, max 10
docs[].id string Y ID of your document, alphanumeric only
docs[].name string Y Name of your document, that will be searchable
docs[].url string Url of your document, that will direct your customer to product
docs[].url_image string Url to image, that you can use for better search experience
docs[].price float
docs[].currency string Currency code eg. USD
docs[].description string
docs[].categories []string Array of categories name eg. ["Computers", "Laptops", "Accessories"]
docs[].sku string
docs[].headline string Headline, that you can use for better search experience, eg. Sale
docs[].availibility int Quantity of your products
docs[].review_score float Eg. 9.8
docs[].review_count int Eg. 46
docs[].price_old float Useful for cross through on your frontend, eg. 849.99

Example request

curl -i -XPOST "https://uk01.apisearch.logshub.com/v1/products" \
-H "Authorization: xizinISDPH, ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd" \
-d '{
"service_id":"5b5a06d2-23bc-4186-4d1b-3a17bfa7200d",
"docs": [
    {
        "id": "11142",
        "name": "Laptop WiFi Dual Band Bluetooth 4GB RAM 1,4GHz",
        "categories": ["Electronics", "Laptops"],
        "url": "/laptop-wifi-4gb-ram-11142.html"
    },
    {
        "id": "5576",
        "name": "Laptop WiFi Dual Band Bluetooth 8GB RAM 2,4GHz",
        "categories": ["Electronics", "Laptops"],
        "url": "/laptop-wifi-8gb-ram-5576.html"
    }
]}'

Example response

{"status":"OK","ack":2}

Index Categories

During this process, we are indexing your documents (product categories), to make searchable for your frontend integrations (for customers of your store). This process is similar to products indexing.

Endpoint: POST https://uk01.apisearch.logshub.com/v1/products/categories

Authorization (header): Authorization: ApiHash, ApiSecret

Params (json)

Name Type Required Description
service_id string Y UUID of your service
docs [] Y Documents to index, max 10
docs[].id string Y ID of your document, alphanumeric only
docs[].name string Y Name of your document, that will be searchable
docs[].url string Url of your document, that will direct your customer to category
docs[].url_image string Url to image, that you can use for better search experience
docs[].description string Description of your document, max 400 chars
docs[].categories []string Array of categories name (ancestors) eg. ["Computers", "Laptops"]

Example request

curl -i -XPOST "https://uk01.apisearch.logshub.com/v1/products/categories" \
-H "Authorization: xizinISDPH, ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd" \
-d '{
"service_id":"5b5a06d2-23bc-4186-4d1b-3a17bfa7200d",
"docs": [
    {
        "id": "11",
        "name": "Electronics",
        "categories": [],
        "url": "/electronics.html"
    },
    {
        "id": "12",
        "name": "Laptops",
        "categories": ["Electronics"],
        "url": "/electronics/laptops.html"
    }
]}'

Example response

{"status":"OK","ack":2}

Delete Document

With this endpoint you can delete any of your document, previously indexed.

Endpoint: DELETE https://uk01.apisearch.logshub.com/v1/document

Authorization (header): Authorization: ApiHash, ApiSecret

Params (json)

Name Type Required Description
service_id string Y UUID of your service
doc_id string Y ID of document to delete

Example request

curl -i -XDELETE "https://uk01.apisearch.logshub.com/v1/document" \
-H "Authorization: xizinISDPH, ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd" \
-d '{
    "service_id": "5b5a06d2-23bc-4186-4d1b-3a17bfa7200d",
    "doc_id": "2543"
}'

Example response

{"status":"OK"}

Set Document Priority

You can increase priority of main products of your store to help your customers.

Endpoint: PUT https://uk01.apisearch.logshub.com/v1/service/:service_id/document/priority

Authorization (header): Authorization: ApiHash, ApiSecret

Params (json)

Name Type Required Description
service_id string Y UUID of your service in url
doc_id string Y ID of document to set priority
priority number Y 1-10 number of priority of a document

Example request

curl -i -XDELETE "https://uk01.apisearch.logshub.com/v1/service/5b5a06d2-23bc-4186-4d1b-3a17bfa7200d/document/priority" \
-H "Authorization: xizinISDPH, ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd" \
-d '{
    "doc_id": "2543",
    "priority": 10
}'

Example response

{"status":"OK"}

Clear Index

With this endpoint you can delete all of your documents.

Endpoint: PUT https://uk01.apisearch.logshub.com/v1/service/:id/clear

Authorization (header): Authorization: ApiHash, ApiSecret

Params (url)

Name Type Required Description
id string Y UUID of your service

Example request

curl -i -XPUT "https://uk01.apisearch.logshub.com/v1/service/5b5a06d2-23bc-4186-4d1b-3a17bfa7200d/clear" \
-H "Authorization: xizinISDPH, ZJLnvZAujIBOTiJVyfImZYLEKdesJPKUntfFztYLiefQsCMgmd"'

Example response

{"status":"OK"}