cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3467
Views
6
Helpful
5
Replies

Looking for a UCCX "Make REST Call" POST method example

schm196
Level 1
Level 1

First-time attempt at this... I'd really appreciate some help getting a (seemingly simple) "Make REST Call" step working... I've spent a lot of time looking for examples online but nothing really helped.  I feel like I have two left thumbs - I can never even get the step properties correctly configured so that the editor would accept the step.

Basically, a call to our helpdesk hotline is supposed to automatically open a helpdesk ticket via that application's REST API.  I know that the API is working great, as I have been able to successfully test it using cURL:

curl -F "<paramter1name>=<parameter1value>" -F "<parameter2name>=<parameter2value>" -u <username>:<password> http://<helpdeskAPIfullURL>

The API then returns a basic XML response (which we don't even need to use any further in the UCCX script - just listing it for completeness):

<?xml version="1.0" encoding="UTF-8"?>
<request>
    <xRequest>some expected response here</xRequest>
</request>

Would anybody be so kind and show me an example how to correctly set the properties of the Make REST Call step so it works like the cURL command line above?

Thanks a lot for your help!

1 Accepted Solution

Accepted Solutions

Hello @schm196 

Please find in attachment a sample demo script that shows the usage of the Make REST Call configuration that should give you the same results as CURL command. I have put some additional comments into this script so it should be clear for you to understand how you need to put your config.

Marek
Web: https://gaman-gt.com

View solution in original post

5 Replies 5

schm196
Level 1
Level 1

I think I can be more specific about my challenges now:

How do I put several parameter names and their values into the "Body" field of the Make REST Call step?  I have no clue about the gritty details of the expression needed... curlies, brackets, quotations, slashes, etc.  Again, it simply needs to get across what is shown above in the successful cURL command line.

Thanks again for looking into this!

Hello @schm196 

Please find in attachment a sample demo script that shows the usage of the Make REST Call configuration that should give you the same results as CURL command. I have put some additional comments into this script so it should be clear for you to understand how you need to put your config.

Marek
Web: https://gaman-gt.com

Thanks a lot, Marek.  It is working now!!!

Looks like I violated the KISS principle (I didn't keep it simple, stupid).  I had everything just like in your example, with the exception of the simple body string connecting the various keys using ampersands.

If I may, a bonus question:  The web POST method returns an XML response.  I can see it fine in the flat "String" variable but would rather have it returned into an "XML Document" for further parsing if ever required.  What's the easiest way to get this done?

Thanks again, much appreciated!

Matthias

Make REST Call allows you only to pass responses as strings. You can not use Document type objects. If you want to parse the response - you will need to parse it. This can be done by Set element.

  • Create a document type variable in the session
  • Assign string value to newly created document variables. It might be necessary to use some constructors like TEXT[string_variable] or casting (Document)string_variable

 

Marek
Web: https://gaman-gt.com

Thanks a lot! Really appreciate your help.
Matthias