03-27-2023 07:40 AM
I have a CVP 12.5 application that is performing an API POST. While I am able to retrieve the contents via element data I now have a need to utilize one of the headers that is also returned. I do not see a way to pull in any header information. Any help would be appreciated.
03-27-2023 11:46 AM - edited 03-28-2023 01:30 PM
Yes, it is possible to retrieve header information from a CVP REST Element response.
When you make a REST API request to CVP, the response typically includes HTTP headers that contain metadata about the response. You can retrieve this header information by accessing the response object in your code.
In most programming languages, you can access the HTTP headers of a REST API response by looking at the response headers object. For example, in Python, you can use the headers attribute of the response object returned by the requests library.
Best,
03-27-2023 01:21 PM
While I have done this very thing in Python and the requests module I would like to do this natively within my CVP application. Also, to clarify this is the REST element within CallStudio, not the CVP APIs themselves.
03-27-2023 04:31 PM
Unfortunately, response headers are not exposed by the out-the-box HTTP client element so you'll have to resort to a custom one. You could build from scratch, try extending the element class for the out-the-box element or it might be quicker to repurpose an existing example. There's an Agent Request API example here that includes a POST request and extraction of Location header into element data. https://app.box.com/s/zl635ootbybqgmjo2m2y8v9w3h18yd9e
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide