Get contents

Once you have integrated Dialogue Wise, you can easily retrieve the contents of a Dialogue and display it on your app. To do that you need to first prepare the payload.

var request = new GetDialogueRequest();
request.slug = '[Your Slug]';
request.apiKey = '[Your API Key]';
request.emailHash='[The hash of your email]';

//In case you need to pass variables. This is optional parameter.
request.variables = new Map<String, dynamic>(); 
request.variables ={
//Your variables and corresponding values.

//In order to get paginated data. These are optional parameters.

//To get Piloted version. This is optional parameter.

Now that you have the payload ready, all you need to do is to call the service with the payload.

var dialogueWiseService = new DialogueWiseService(); 
Map response = await dialogueWiseService.getDialogue(request);

If the contents are retrieved successfully, it will return you a response of type DialogueWiseResponse which will contain a status code, reason phrase and response. The status code indicates the standard HTTP response status codes and the reason phrase will contain the corresponding reason for the status code. The response will have the content which can be displayed on your app.

A sample response would look like the one below.

            "dish-name":"Chicken Hot Dog",
            "long-description":"Chicken Hot Dog with mayonnaise.",
            "short-description":"Chicken Hot Dog with mayonnaise.",

Every record will contain an id and isSourceAPI field. The id field is a unique identifier that can be used to update or delete the record. The isSourceAPI field indicates if the record was added through the API or manually through the portal.