Dakwak API: Search

search

Dakwak Search API allows you to search in all versions of your website. It returns the phrases that match your query in the translated and the original versions of your website, along with the pages where these phrases were found. To use it, simply send a Request with a search query, then a Response will be returned -in JSON or XML format- with the search results that match your query.

Request

Send a POST request to the following:

dakwak.com/api/search.json?apikey=API_KEY&lang=LANG&q=PHRASE

Then, replace the bold capitalized words with their corresponding values:

The request should look something like this:
dakwak.com/api/search.json?apikey=12356789abcde&lang=ar&q=مرحبا
or, if you’re searching in Spanish:
dakwak.com/api/search.json?apikey=12356789abcde&lang=es&q=hola

Response

When you send the request, and if all fields are valid, you will get a response that looks like this:

{"apikey": "12356789abcde",
"lang": "es",
"q":"hola",
"results":[
{
"source_text": "hello world",
"translated_text": "hola mundo",
"page_urls": ["/page1", "/page2"]
}
{
"source_text": "hi",
"translated_text": "hola",
"page_urls": ["/page3", "/page4"]
}
]}

  • apikey, lang and q fields contain the same values of the request
  • results is an array that contains the search results, each element contains:
    • source_text: the original un-translated phrase
    • translated_text: the translated phrase that matches the query
    • page_urls: an array of page URLs where the searched query was found

Error codes

If you get an error instead of search results, it means your request contains invalid information or misses some required information. Please check the correct request format.

  • 1100: ‘apikey’ is a required field
    You left the apikey field empty, didn’t include it in your request, or misspelled ‘apikey’
  • 1101: ‘lang’ is a required field
    You left the lang field empty, didn’t include it in your request, or misspelled ‘lang’
  • 1102: ‘q’ is a required field
    You left the q field empty or didn’t include it in your request
  • 1301: language is not valid or supported
    The language you requested is not supported by dakwak.com or does not exist. Make sure to choose the correct language shortcut from the table above
  • 1500: language is not included in your plan
    The language you chose is not included in your plan, please choose another language