Troubleshooting The APIs

Best Practices - Troubleshooting The APIs

 

One of the best tools that we have found for helping troubleshoot connecting to the LivePerson APIs is the RESTClient plugin for Firefox. The plugin allows for you to make HTTP requests with custom headers without having to write any code, which is a great way to test an API before you get started. Once you make a request, the plugin will format the response body without you having to use another tool.

 

2016-02-10_1509.png

 

You can read more about the plugin here: Firefox RESTClient Plugin

 

Using The Plugin

 

Once you have the plugin installed, you can start making API calls right away.

 

Issue A GET request:

To issue a GET request you just need to add the URL that you are requesting to the URL field on the RESTClient.

 

Example Request: Put this URL in the URL field on the RESTClient, make sure to replace {accountID} with your account ID.

https://api.liveperson.net/api/account/{accountID}/service/engHistDomain/baseURI.json?version=1.0

 

Example response:

2016-02-10_1514.png

 

Issue A POST request:

To issue a POST request you just need to add the URL that you are requesting to the URL field on the RESTClient. You may need to add additional Headers and Body Parameters to the request for the request to work.

 

Example Request for the Engagement History API: Put this URL in the URL field on the RESTClient, make sure to replace {accountID} with your account ID, and {Base URI} with your Base URI.

https://{Base URI}/interaction_history/api/account/{accountID}/interactions/search?offset=0&limit=10

 

For this request, you will also need to include a body, an Oauth header, and a custom header.

 

Example Body:

{

"interactive":true,

"ended":true,

"start":{

"from":1433140200000,"to":1435645800000

}

}

 

Example response:

 

2016-03-23_1012.png

 

Add An OAuth Header:

To add an OAuth Header, at the top of the RESTClient click on Authentication, and choose OAuth from the drop down menu.

 

2016-02-10_1524.png

 

A new pop up menu will then display with the options to enter the following information:

  • Consumer key

  • Consumer secret

  • Access token

  • Access token secret

  • Signature Methods

  • oAuth Version

  • Realm

  • oAuth Nonce

  • oAuth Timestamp

 

For these settings, we recommend that use use the ‘Remember the setting’ checkbox that way you can use this header in future requests without having to recreate it. It is also recommended that for the oAuth Nonce and the oAuth Timestamp settings, that you use the ‘Auto ‘checkbox so you don’t have to enter this information manually.

 

Add A Custom Header:

To add a custom header, such as Content-Type: application/json, at the top of the RESTClient click on Headers, and from the drop down menu choose Custom Header.

 

2016-02-10_1530.png

 

A new pop up menu will then display with the options to enter the following information:

  • Name

  • Value

 

For these settings, we recommend that you use the ‘Save to favorite’ checkbox that way you can use this header in future requests without having to re-create it.

 

Saving A Request:

To save a request for future use, navigate to the top of the RESTClient and click on Favorite Requests, and from the drop down menu choose Save Current Request.

 

2016-02-10_1546.png

 

A new pop up menu will appear with an option to name the current request. Once you enter the name, just click save.

 

To use the request later, just navigate to the top of the RESTClient and click on Favorite Requests, and then from the drop down menu choose the request that you just saved.

 

This post, based on feedback from LiveEngage users, is meant to offer you guidance and to help drive value for your brand.

 

More Resources

 

You can read more about the Engagement History API here:Engagement History API PDF

Best Practices - Engagement History API: Engagement History API Best Practices