Page tree

REST - Ask Question

The EWQuestion operation returns an answer to the question posited in the question Key of the call Body.

  • Returns: a numeric or text answer depending on the nature of the proposed question.
  • Supported Content-Type: application/x-www-form-urlencoded
  • Accepts a URL with URL-encoded parameters and KB data, not record data. For more information about general URL conventions, see REST Interface.
  • This operation supports both GET and POST requests.
  • To use EWQuestion, you must first log in using REST - Login or similar.
This operation is only available in KBs with ConvoAI, with Genius™ powered by Cognizer deployed, and it only returns answers after data has been ingested.

Example

Assume an instance of Agiloft is available on localhost, port 8080, and "Demo" is the KB name.

The following is an example URL for the call:

https://localhost:880/ewws/EWQuestion/.json?$KB=Demo&$lang=en

Required keys include:

question: This is where you enter the actual question, something like "How many contracts include Agiloft?"

requestType: Enter one of the following constants: REGULAR_REQUEST, or NEXT_PAGE_REQUEST or FOLLOW_ON_REQUEST for follow-up questions.

paginationOffset: 0

paginationCount: 3

previousQuestionId: in case of FOLLOW_ON_REQUEST type, you need to specify the previous questionID that was returned in the response body.

paginationQuestionId: in case of NEXT_PAGE_REQUEST type, you need to specify the previous questionID that was returned in the response body. 

The answer to the asked question is found under answer in the return, along with additional information from AI system:

{
    "success": true,
    "message": "",
    "result": [
        {
            "questionId": "a3b314f2-a5da-4cfd-a234-b95bdc30fb57",
            "userId": "666",
            "orgId": "xxxxxxxxx",
            "question": "How many contracts include Agiloft?",
            "data": [
                {
                    "answerDetail": [
                        {
                            "contractMeta": {
                                "names": [],
                                "contractType": "SERVICE AGREEMENT",
                                "parties": [
                                    "Agiloft Inc",
                                    "Maecenas porttitor congue massa",
                                    "Apple Inc"
                                ],
                                "governingLaw": "California",
                                "startDate": 1514764800000
                            },
                            "agiloftData": {
                                "attachmentOriginalTitle": "Generated Draft Contract",
                                "attachmentOriginalDocumentViewerDeepLink": "https://demo.agiloft.com/ui/login.jsp?genhotlink=ISnJhc7Pi6jeRH%2FDMJr%2BTIsyC0JI%3D&genproject=CAITest2",
                                "attachmentOriginalId": 118,
                                "attachmentDownloadHotLink": "https://demo.agiloft.com/ewws/EWRetrieve?$genhotlink=XeH2smoQDixxRM4bZzyTqYMKoPWsFSgeejv4u3jPp7c=&$genproject=CAITest2",
                                "userHasAccess": true,
                                "attachmentOriginalRecordDeepLink": "https://demo.agiloft.com/ui/login.jsp?genhotlink=hzoNbdVXE84MiToBm1wnJarPhVelGe0%3D&genproject=CAITest2"
                            },
                            "contractId": "attachment.attached_file:118"
                        },
.....
    		}
                    ],
                    "answer": "I found 32 contracts that match your criteria.",
                    "confidence": 99
                }
            ],
            "answerType": "ANSWER",
            "viewAllDocumentsDeepLink": "https://demo.agiloft.com/ui/login.jsp?genhotlink=AHfr2Yvd1%2BM4cT6oRbB43PaBC09WIg%2FD9AIVM4DaFk1w9rWdg%3D&genproject=CAITest2",
            "totalCount": 32
        }
    ]
}

CONTENTS