Skip to Content

How to use memory variables in GET method when calling external API?

Hi everyone,

I'm developing a simple chatbot that gives infos about Sales Orders available on our S4 on-premise system.

Connection beetwen convAI and the OData service published on our local system is working pretty well, and i was trying to extract infos of a specific SO starting from the SO number inputed from the user in the chat.

To do so, I thought I had to pass the memory.salesorder-number in the GET method when calling the external API.

What I'm still unable to understand is how can I put a variable in the service url to specify the key of my entityset.

I was expecting to write something like this https://my-machine/odata/SAP/ZINN_SALESBOT_DEMO_SRV/SalesOrderSet('{{memory.salesorder-number}}') but i found out that putting the symbol "{" in the textfield make the entire web-page to freeze forever!

Am i missing something? What's the correct way to specify a key via memory variable for a get_entity to external API?

Thx a lot for your support,

Valerio

cattura.png (37.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 24, 2019 at 07:15 AM

    Hello Valerio,

    we are also call S/4 back end system and our API URL is enhanced by memory variables. The result looks like this:

    https://OUR_HOST/{{memory.business_object.metadata.serviceURLBase}}{{memory.business_object.metadata.entitySet}}?$filter=({{memory.filter.name}}%20eq%20%27{{memory.filter.value}}%27){{memory.select}}&$format=json&$top=1


    I hope it will help you.

    Regards,

    Michal

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Michal,

      thx a lot for your answer.

      So that means i correctly understood how to compose the URL.

      But the problem still remain, when i input from my keyboard(or copy-paste) the graph parenthesis "{" in any position of the URL field of the API Service configuration the entire CAI web page freezes forever, making me unable to click in any point of the page until i refresh the page on my browser.

      Is this maybe a bug of the web-page?

      I tried on Chrome, Firefox and IE and the behavior it's always the same.

      I created this gif to let you see what happens:

      https://imgur.com/a/Rvd3qiI

      I first try to add a "(" bracket and it works, than i input "{" and all freezes.

      Hope this helps to understand the issue.

      Thanks,

      Valerio

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.