avassilev | Posts: 9

How do one get transaction details (name, description) upon package download?

0 votes
Please provide directions on how to get transaction details (specifically name and description) upon package download. Regards, Alexander

Approved Answer
Duo_Liang | Posts: 3776

Reply to: How do one get transaction details (name, description) upon package download?

1 votes
Sure thing! See the code below:
        public void Execute()
        {
            var apiKey = "xxxxx==";
            var apiUrl = "https://sandbox.esignlive.com/api";

            HttpClient myClient = new HttpClient();
            myClient.DefaultRequestHeaders.Add("Authorization", "Basic " + apiKey);
            myClient.DefaultRequestHeaders.Add("Accept", "application/json");

            var response = myClient.GetAsync(new Uri(apiUrl + "/packages/Byy5cJFK73L-ys8Qs7-vEP_zxI4=")).Result;

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(response.Content.ReadAsStringAsync().Result);
            }

            JObject packageJSON = JObject.Parse(response.Content.ReadAsStringAsync().Result);

            Debug.WriteLine("package name: "+packageJSON["name"]);
            Debug.WriteLine("package description: " + packageJSON["description"]);


        }
Duo

Duo_Liang | Posts: 3776

Reply to: How do one get transaction details (name, description) upon package download?

1 votes
Hi Alexander, Are you using callback listener to monitor "PACKAGE_COMPLETE" event to trigger the download function? If you received the package id, call this API to retrieve the package metadata: HTTP Request:
GET /api/packages/{packageId}
HTTP Headers:
Accept: application/json; esl-api-version=11.21
Authorization: Basic api_key
Example Response:
{
      "name":"sample package",
      "description":"your package description",
      ......
}
Hope this could help! Duo

avassilev | Posts: 9

Reply to: How do one get transaction details (name, description) upon package download?

0 votes
Hi Duo, Thanks for quick response. Would you be able to provide sample source code for such call, please? Regards, Alexander

avassilev | Posts: 9

Reply to: How do one get transaction details (name, description) upon package download?

0 votes
Thank You Duo! Much appreciated!

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off