PureConnect

 View Only

Discussion Thread View
  • 1.  Forcing REST tool to return XML instead of JSON

    Posted 05-05-2019 09:09
    Hi

    I'm getting a correct response using the handler's REST tool .
    The problem is that the response is in JSON format all the time ..no matter what

    I would like the response to be XML

    Trying to add "Accept: application/xml" to headers doesn't work-REST tool fails completely with error 417 ..meaning -mismatch header!

    Any ideas?

    TNX

    #Handlers

    ------------------------------
    Avi Rozen
    Harel
    ------------------------------


  • 2.  RE: Forcing REST tool to return XML instead of JSON
    Best Answer

    Posted 05-06-2019 02:51
    Hi Avi,


    I found this in the Interaction Designer REST API tools dokumentation, CIC REST Implementation:

    Provide JSON and array-parsing tools. The tools do not support other formats.

    So I think the tools work with JSON format only and don't accept other formats.


    ------------------------------
    ---------------------------------------------
    Hans-Gerd Sandhagen
    Software Developer
    Fiebig GmbH
    ---------------------------------------------
    ------------------------------



  • 3.  RE: Forcing REST tool to return XML instead of JSON

    Posted 05-06-2019 03:40
    Edited by Avraham (Avi) Rozen 05-06-2019 03:41
    Thank you Hans for making it clear :-)

    Missed this document important note..(not understanding how "Accept" header which is standard header creates error using REST tool)

    I hope Genesys will make REST- XML response available next comming versions. 

    XML advantages -X-Path +language encodings are hard to compete with


    ------------------------------
    Avi Rozen
    Harel
    ------------------------------



  • 4.  RE: Forcing REST tool to return XML instead of JSON

    GENESYS
    Posted 05-06-2019 12:33
    Avi,

    Regarding the Accept header causing a problem...  many application servers will route requests to an appropriate handled based on the configure response required.  I don't have access to the code, but my guess is that there is no handler registered for "application/xml" and therefore you are getting your error.

    As for desiring an XML response...  a quick google search of "json to xml library <insert language here>" will produce a number of great libraries in your language of choice that you can use to translate the JSON results into XML and vice versa.  However, a little further searching shows that there are even libraries that implement "JSONPath" in most common languages, so there may not be a reason to convert the JSON to XML at all.

    ------------------------------
    Jim Crespino
    Senior Director, Developer Evangelism
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 5.  RE: Forcing REST tool to return XML instead of JSON

    Posted 05-07-2019 04:29
    Thank you for your response Jim.

    • json to xml library or JSONPath can NOT be accessed by interaction designer (2017 R4 patch 11)
    I guess your idea was to activate WS which converts the JSON response into XML but hey- if i'm doing so...i could have made the REST call from that WS directely skipping launching it directely from designer

    • XPATH and XML encodings are interaction designer out of the box -easy to use-working tools . Working with "JSON parser" ,"Array parser" (designer tools) makes hard to "read" REST response especialy when its a long and not flat-level. "JSON parser" tool for example seems to NOT knowing how to handle/show hebrew strings which are showing correctely at REST tool response (tested by debugger)

    • one last thing which is not less important-it would be great if you mention in the REST-tool designer embeded-help (*.chm) the responce is just JSON. It's  mentioned just inside REST API developer document -where Hans was able to get info from

          Regards,






    ------------------------------
    Avraham (Avi) Rozen
    Harel
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources