campaigns

home

Reference for the API Answer

Description

This api provides access to the Wikifriend Semantic Engine. In order to access to this api, you must provide in the header the wikiclone code that identifies the agent you want to query.

Request

curl  "https://www.wikifriend.net/api/v1/answer" \
-X POST \
-H 'Content-Type: application/json' \
-H 'charset: UTF-8' \
-H 'wikiclone_code: [wikifriend agent secret code]' \
-d
'{
  "wikiagent": "AGENT_ID",
  "username": "USERNAME",
  "guest": "[0-1]",
  "question": {
    "text": "Hello Agent!",
    "ask_for_metadata": "[0-1]",
    "using_repeating_answers": "[0-1]",
    "extra_data": "[custom extradata]"
  },
  "force_subscription": "[0-1]",
  "output":"[json/html/xml/text]",
  "language": "[ISO 639-1 code]"
}'
		

Payload

fieldpossible valuesis required
wikiagentThe agent-id provided by wikifriend.net.yes
usernameThe username of the sender of the message.yes if guest is not valued.
guestAllow access to guest usersyes if username is not valued.
questionThe question to send to the Semantic Engine.yes
force_subscription0 do not force username subscription
1 force username subscription.
yes
outputjson, xml, html, text.yes
languagethe ISO 639-1 code of the language.yes

Question Payload

fieldpossible valuesis required
textThe text of the question.yes
ask_for_metadata0 or 1.no
using_repeating_answers0 or 1.no
extra_dataan xml string defining extra data.no

Response

{
 "post_processed_answer": "ehi! didn't I already answered to you on this question?!",
 "answers": [
    {
      "answer": "Hello to you, Human!",
      "theme": "Default",
      "context": "default",
      "snippet": "EMPATHY",
      "sequence_number": "42",
      "answer_score": "10",
      "tags": "hello|human",
      "label": "greetings",
      "category": "greetings"
      "sub_category": "to human"
      "answer_language": "en",
      "is_agent_answer": "false",
      "is_dummy_answer": "true",
      "is_dummy_floor_answer": "false",
      "is_suggestion_answer": "false",
      "is_international_question": "false",
      "is_dialog_in_progress": "false",
      "is_dialogue_answer": "false",
      "delay": "-1"
    },
    {
      "answer": "Hi.",
      "theme": "Default",
      "context": "default",
      "sequence_number": "11",
      "answer_score": "0",
      "answer_language": "en",
      "is_agent_answer": "false",
      "is_dummy_answer": "true",
      "is_dummy_floor_answer": "true",
      "is_suggestion_answer": "false",
      "is_international_question": "false",
      "is_dialog_in_progress": "false",
      "is_dialogue_answer": "false",
      "delay": "-1"	  
    }
  ]  
}
		


The Response is an array of answers, ordered by the answer_score and an optional post processed answer

Post Processed Answer details

fielddescriptionis optional
post_processed_answerA message describing specific events composed during post processing.yes


Answer item details

fielddescriptionis optional
answerThe text of the answer.no
themeThe theme of the answer.yes
contextThe context of the answer.yes
snippetThe snippet used by this answer.yes
sequence_numberThe sequence id of the given answer.no
answer_scoreThe score of the given answer. Higher is the score, more accurate is the answer.no
tagsTags linked to this answer.yes
labelA label describing this answer topic.yes
categoryThe category of this answer.yes
sub_categoryThe sub category of this answer.yes
answer_languageThe language of the returned answer.yes
is_agent_answerSpecifies if the returned answer was given by the agent.no
is_dummy_answerSpecifies if the returned answer is not part of the specific knowledge.no
is_dummy_floor_answerSpecifies if the returned answer is a floor.no
is_suggestion_answerSpecifies if the returned answer is a suggestion.no
is_international_questionSpecifies if the question was expressed with an International slang.no
is_dialog_in_progressSpecifies if there is a dialogue in progress.no
is_dialogue_answerSpecifies if the returned answer is part of a dialogue.no
delaySpecifies if there must be a delay before answering to the next question.no

Response codes

codereason
200OK.
404The service is not authorized.


© 2019 Wikifriend UG