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:

  • apikey: this is long unique string used to identify your website, and to allow you to access the search API. To request your website’s API Key, go to Dashboard -> My Website Content -> Settings then click on blue the button “Request API Key”. An email will be sent to the support staff at dakwak and they will contact you with your website’s API Key.
  • q: the phrase you want to search for, it can be in any language you translated your website to.
  • lang: the language of the phrase you want to search for. Use the shortcut of the language, based on this table:
    Language Shortcut Language Shortcut Language Shortcut
    Afrikaans af Greek el Romanian ro
    Albanian sq Hebrew iw Russian ru
    Arabic ar Hindi hi Serbian sr
    Belarusian be Hungarian hu Slovak sk
    Bulgarian bg Icelandic is Slovenian sl
    Catalan ca Indonesian id Spanish es
    Chinese (Simplified) zh-CN Irish ga Swahili sw
    Croatian hr Italian it Swedish sv
    Czech cs Japanese ja Thai th
    Danish da Korean ko Turkish tr
    Dutch nl Latvian lv Ukrainian uk
    English en Lithuanian lt Vietnamese vi
    Estonian et Macedonian mk Welsh cy
    Filipino tl Malay ms Yiddish yi
    Finnish fi Maltese mt Urdu ur
    French fr Persian fa Chinese (Traditional) zh-TW
    Galician gl Polish pl French (Canada) fr-CA
    German de Portuguese (Europe) pt-PT Spanish (Latin America) es-LA
    Portuguese (Brazil) pt-BR

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