Reputation: 19
I have 2 shared templates in my DocuSign account. I want to retrieve a list of shared templates. I'm making the below ajax call.
I'm receiving a 200 status call so the call is successful but DocuSign is returning HTML not JSON.
var DSTemplateURL = localStorage.getItem("ls_DSurl") + "/v2/accounts/" + localStorage.getItem("ls_DS_accountid") + "/templates?";
var DSData = 'folder=Shared Templates';
request = $.ajax({
headers: { 'Authorization': 'Bearer ' + localStorage.getItem('ls_DSaccess_token') },
type: 'GET',
url: DSTemplateURL,
data: DSData,
//dataType: 'json',
contentType: "application/json",
cache: false
});
Upvotes: 0
Views: 105
Reputation: 7383
Pass the user_filter query string parameter.
GET /v2/accounts/{accountId}/templates?user_filter=shared_with_me
Here are the possible values for the user_filter parameter.
Change your code as follows
var DSTemplateURL = localStorage.getItem("ls_DSurl") + "/v2/accounts/" + localStorage.getItem("ls_DS_accountid") + "/templates?user_filter=shared_with_me";
request = $.ajax({
headers: { 'Authorization': 'Bearer ' + localStorage.getItem('ls_DSaccess_token') },
type: 'GET',
url: DSTemplateURL,
//dataType: 'json',
contentType: "application/json",
cache: false
});
Upvotes: 2