Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 6 days ago
    In Web Services Data Actions, a minimal GET action with no configured headers and no requestTemplate still sends Content-Type: application/json.
     
    Is there any supported way to suppress or remove this runtime-generated Content-Type header for GET requests?
     
    Minimal request config used:
    {
      "requestType": "GET",
      "requestUrlTemplate": "https://postman-echo.com/get?source=genesys-no-template-no-headers"
    }
     
    Observed echo response includes:
    {
      "headers.user-agent": "PureCloud-Data-Actions",
      "headers.content-type": "application/json"
    }

    #DataActions

    ------------------------------
    David Sand
    Lead Developer
    ------------------------------


  • 2.  RE: Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 6 days ago

    Hello,

    As far as I know, you can only update/override the value but not get the header removed.

    Regards,



    ------------------------------
    Jerome Saint-Marc
    Senior Development Support Engineer
    ------------------------------



  • 3.  RE: Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 5 days ago
    Edited by Jason Mathison 5 days ago

    One thing you can try directly via the API is to set the value of the content-type header to "" (An empty string). It is possible that your endpoint will accept that. My approach to doing this is:

    In chrome open up the developer console

    Update your action to have a content-type header with a value like "foo" and save it.

    In the developer console "network" tab look for the operation with a name "draft" that is a PATCH operation. Right click on it -> Copy -> Copy as Curl

    Make a couple of modifications to the Curl:

    Increment the version by 1

    Delete the "foo" but leave the quotes

    Run the curl command and test it out.

    Note: The UI does not like this configuration and won't let you save or publish any updates with the header set to "". If you make any changes in the UI you would have to go through the same process to get the header set back to "". And it looks like you would have publish the action via the API as well.

    I verified that the postman endpoint returns

    "headers.content-type": "",
    Which might be acceptable by the real endpoint you are trying to use. Trying to set the value to null (the JSON null, no quotes) will cause your data action to fail.

    Let us know if this works for you. If it does, you could open up a support case or an idea on https://purecloud.ideas.aha.io/ideas/ to get the UI to support giving a header an empty value.



    ------------------------------
    --Jason
    ------------------------------



  • 4.  RE: Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 4 days ago
    Edited by Timo Valimaki 4 days ago

    Hi,

    We've hit the issues with Oracle OCI API and managed to get OCI to accept the request by supplying empty space as Content-Type. The problem is that Genesys UI validation considers empty space as non existing value and refuses to publish the action. Anyone who's found a workaround for that?



    ------------------------------
    Timo
    Solution architect
    ------------------------------



  • 5.  RE: Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 4 days ago
    Edited by Timo Valimaki 4 days ago

    Figured out a way. I added dummy input contract and will supply empty space through that. A bit ugly, but does the trick

    "Content-type": "${input.empty_space}"



    ------------------------------
    Timo
    Solution architect
    ------------------------------



  • 6.  RE: Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 4 days ago

    Smart!

    That made me want to try something in the same direction - but with velocity macros (that headers support according to the doc).

    You can use the following - so that UI does not complain, but empty string is still sent as Content-Type header value.

    Using a single line comment - "Content-type""## something**"

    Or setting a value in a dummy variable - "Content-type": "#set($something = 1)"

    Regards,



    ------------------------------
    Jerome
    Senior Development Support Engineer
    ------------------------------



  • 7.  RE: Can Content-Type be suppressed for GET Web Services Data Actions?

    Posted 4 days ago
    Edited by Timo Valimaki 4 days ago

    This is cool, will steal this. In our case the following will send out empty space in content-type:

      "headers": {
        "Authorization": "Bearer ${authResponse.access_token}",
        "Content-type": "$esc.jsonEncode(\" \")"
      }



    ------------------------------
    Timo
    Solution architect
    ------------------------------