Remote Web Service and Headers

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
  • 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

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)