# Remote Web Service and Headers

**URL:** <https://community.dreamfactory.com/t/remote-web-service-and-headers/703>\
**Category:** REST API\
**Created:** [December 28, 2014, 6:06pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703 "2014-12-28T18:06:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [December 28, 2014, 6:06pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/1 "2014-12-28T18:06:20Z")

</div>

Hello guys,  
Merry christmas and all.

Those days, I am playing now with the Remote Web Service api type.  
And I think that with DSP 1.8.2 the Headers defined in the Request parameters (with the param type as “header”) are not passed to the called web service !

That is to say,  
I need the user to give a parameter when he will be calling my api (which is a remote web service api)  
This number should be passed as a header when calling the remote web service…

```
{
       "name": "If-Unmodified-Since-Version",
       "description": "Item's current version number",
        "required": true,
        "type": "integer",
         paramType": "header"
}

```

But this does not work.  
What it does, it is that it is calling MY DSP api with this parameter in the header but I don’t think that it this header is forwarded to the remote web service…

```
Request Headers:
...
If-Unmodified-Since-Version:13
...

```

Is there a way to forward this parameter as a header to the remote web service ?

I am really looking forward to your answers because I really need this 😕

Anyway, I still love your product 😄

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [December 29, 2014, 7:53pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/2 "2014-12-29T19:53:44Z")

</div>

Thanks for the love, @stadja. 😊

All headers should be passed on through the DSP to the remote endpoint. Can you provide steps to replicate this problem and more details on your configuration? I’d like to test your same situation in my environment.

---

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [December 29, 2014, 8:38pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/3 "2014-12-29T20:38:44Z")

</div>

OK,  
it’s gonna be a bit tricky for you to test it.  
But anyway.

I created a service:

- type: Remote Web Service
- endpoint: [https://api.zotero.org](https://api.zotero.org)
- I added some parameters (if you need I’ll send them to you by PM)

In My service definition I have this api definition:

```
{
          "parameters": [
            {
              "description": "",
              "paramType": "path",
              "required": true,
              "type": "string",
              "allowMultiple": false,
              "name": "users_or_groups",
              "enum": [
                "users",
                "groups"
              ]
            },
            {
              "defaultValue": "",
              "paramType": "path",
              "required": true,
              "type": "string",
              "allowMultiple": false,
              "name": "elementId"
            },
            {
              "description": "A specific Item in the library.",
              "paramType": "path",
              "required": true,
              "type": "string",
              "allowMultiple": false,
              "name": "itemKey"
            },
            {
              "name": "If-Unmodified-Since-Version",
              "description": "Item's current version number",
              "required": true,
              "type": "integer",
              "paramType": "header"
            }
          ],
          "nickname": "deleteItem",
          "responseMessages": [
            {
              "message": "No Content: The item was successfully updated.",
              "code": 204
            },
            {
              "message": "Conflict: The target library is locked.",
              "code": 409
            },
            {
              "message": "Precondition Failed: The item has changed since retrieval (i.e., the provided item version no longer matches).",
              "code": 412
            }
          ],
          "summary": "Deleting an item - Right now, this is not working",
          "method": "Delete"
        }
      ],
      "path": "/{users_or_groups}/{elementId}/items/{itemKey}"
    }

```

So.  
When I call the Api via the swagger interface, I see that **If-Unmodified-Since-Version** is passed to the DSP call.  
But the response I receive is “no If-Unmodified-Since-Version header”

I tried to put in my service definition a **If-Unmodified-Since-Version** header. And when I do that it works! But I can’t change it with the swagger interface.

Is there a way to make a query api parameter and to transform it in a header parameter when sent to the remote endpoint ? It might be another way to do it…

Anyway, you can try it here:  
[http://stadja.net:81/swagger/zotero.html#!/zotero/deleteItem](http://stadja.net:81/swagger/zotero.html#!/zotero/deleteItem)

try with these parameters:

- elementId: 2214605
- itemKey: PMT2CUF8
- If-Unmodified-Since-Version: 44

Watch the firebug response when you call it, you’ll see that he will consider not having received the **If-Unmodified-Since-Version** … BUT the header is sent to my dsp api.

If you want all my definitions (api key and all that I can give it to you by PM)

---

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [January 4, 2015, 9:30pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/4 "2015-01-04T21:30:31Z")

</div>

Bump ?  
For me it´s à réal problem… 😕

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [January 16, 2015, 9:02pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/5 "2015-01-16T21:02:08Z")

</div>

Sorry for the delay @stadja, we are reviewing this again at the beginning of the week.

---

<div class="post-metadata">

**Author:** ![leehicks](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/leehicks/32/55_2.png) [@leehicks](https://community.dreamfactory.com/u/leehicks)\
**Post date:** [January 16, 2015, 9:48pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/6 "2015-01-16T21:48:49Z")

</div>

@stadja I confirmed the client-sent headers are getting dropped at the DSP, upon adding additional headers from the service configuration. I am working on a fix for this and will send you commit so you can mod locally until 1.9 comes out.

---

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [January 16, 2015, 10:23pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/7 "2015-01-16T22:23:02Z")

</div>

Awesome!!!  
Thank you very mutch 🙂

---

<div class="post-metadata">

**Author:** ![leehicks](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/leehicks/32/55_2.png) [@leehicks](https://community.dreamfactory.com/u/leehicks)\
**Post date:** [January 17, 2015, 2:19am UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/8 "2015-01-17T02:19:19Z")

</div>

@stadja Changed the admin app and the remote web service file in the platform library to allow a pass through option. These changes will be part of 1.9, but here are the commits.

[https://github.com/dreamfactorysoftware/dsp-core/commit/36773ad58bc0a528fe4989a396d6eb6f24ace72c](https://github.com/dreamfactorysoftware/dsp-core/commit/36773ad58bc0a528fe4989a396d6eb6f24ace72c)  
[https://github.com/dreamfactorysoftware/lib-php-common-platform/commit/1c5ad622d58b82172235e03daff71bd9661d09e3](https://github.com/dreamfactorysoftware/lib-php-common-platform/commit/1c5ad622d58b82172235e03daff71bd9661d09e3)  
(just the RemoteWebSvc.php)

Sorry for the delay - holidays, 1.9 and starting 2.0…lots to do. Let me know if this works for you.

---

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [January 27, 2015, 8:02am UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/9 "2015-01-27T08:02:39Z")

</div>

Hey!  
sorry for the delay!  
I just updated my dsp and it does works !

If i had an additional header in the service,  
i don’t put any value  
i check the “Pass From Client”

And it works!  
Super dooper… that’s a really cool thing.

Now I can make some authentification and all that stuff… I am happy with that 🙂

---

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [January 27, 2015, 8:07am UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/10 "2015-01-27T08:07:47Z")

</div>

BUT,  
what I don’t think works well (or anyway, I couldn’t make it work), is to use the

> Basic HTTP Authentication now supported per API call, using URL (i.e. [https://user:password@server](https://user:password@server)) or standard Basic Authentication header.

How is it supposed to work ?

---

<div class="post-metadata">

**Author:** ![toddappleton](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/toddappleton/32/159_2.png) [@toddappleton](https://community.dreamfactory.com/u/toddappleton)\
**Post date:** [January 27, 2015, 7:32pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/11 "2015-01-27T19:32:07Z")

</div>

[https://github.com/dreamfactorysoftware/dsp-core/wiki/REST-API-Authentication](https://github.com/dreamfactorysoftware/dsp-core/wiki/REST-API-Authentication)

Let us know if you still can’t get it to work.

---

<div class="post-metadata">

**Author:** ![stadja](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@stadja](https://community.dreamfactory.com/u/stadja)\
**Post date:** [January 28, 2015, 11:27am UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/12 "2015-01-28T11:27:42Z")

</div>

Thank You.  
Well now, it’s time for the bug reporting!

So, I use various APIs and they need different type of Headers.

- what is working:

The following header

```
If-Unmodified-Since-Version: 47

```

is working well: I can make it parametrable and passing it from the client, no problem.

- what is NOT working:

I have to do a [basic authentication](http://en.wikipedia.org/wiki/Basic_access_authentication) to another api.  
So If I send the following header:

```
Authorization: Basic Y293YWJvbzpQYXNzd29yZCA0IGNvd2Fib28=

```

it works if a put it in the “additional headers” and I give it a value, BUT if I let the value empty there and check “Pass From Client”, It acts as if I don’t pass anything from client when I do.

(maybe it is a problem with the uppercase A, or with the space in the value, I don’t know…)

Have you got any solution ?  
This would really be totally awesome !

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [August 31, 2015, 3:25pm UTC](https://community.dreamfactory.com/t/remote-web-service-and-headers/703/13 "2015-08-31T15:25:29Z")

</div>

We have resolved passthrough of client-provided HTTP headers in the latest version of lib-common-php-platform.
