cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data Services Designer - REST API passing multiple header fields

0 Likes
670

Hi,

I am trying to connect to a REST API. I created a postman collection and it works fine. I am able to send POST request and get a response. A little background regarding the API, the API has just 2 headers that needs to be passed and these 2 header are compulsory and there is no other authorization required apart from these headers.

I created a wadl and created a datastore in the designer using the wadl. Everything is fine till this point.

The issue comes in when I am trying to pass the headers at the datastore level. I tried the Basic and Authorization Header.

1. Basic - I just selected Basic and added the 2 headers in the 'Standard HTTP Header Fields' as below. I get an "HTTP error:<500 , Internal Server Error Error : >". But if give only one then it gives an error "Unauthorized - Access Denied", which makes sense to me.

2. Authorization Header - I have also tried the Authorization Header. I gave the 2 headers in the'Header based api key or token', but it failed with the same "Internal Server error".

Then I tried giving one header in the 'Header based api key or token' and one in the 'Standard HTTP Header Fields' then it gave me the "Unauthorized - Access Denied" error.

3. I have also tried giving the headers in the wadl by adding the param as headers in the request(highlighted in bold below). But still I get the same errors when I send 1 header("Unauthorized - Access Denied") and 2 headers("Internal Server error").

<resources base="https://abc.com/api/v1/">

<resource path="test">

<param style="header" name="auth-token" fixed="123456abc"/>

<param style="header" name="user-name" fixed="123abc"/>

<method name="POST" id="add">

<request>

<representation mediaType="application/json; charset=UTF-8" element="Request" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>

</request>

<response> <!-- status="200" -->

<representation mediaType="application/json; charset=UTF-8" element="Response" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>

</response>

</method>

</resource>

Can anyone please share your thoughts if you encountered this issue and how you fixed it? Or if you have any thoughts on how we can fix this issue.

Thanks in advance.

Accepted Solutions (0)

Answers (0)