Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api action #505

Closed
masoudMZB opened this issue Jan 14, 2022 · 2 comments
Closed

Api action #505

masoudMZB opened this issue Jan 14, 2022 · 2 comments

Comments

@masoudMZB
Copy link

Hello all
how can I create an API action? I don't see any doc or any example for it

I get this error :

The fields "{'headers'}" do not exist on the document "HttpActionConfig"

I have this simple get request https://61e13d1463f8fc0017618ac5.mockapi.io/test/akbar
and the response will be :

{
"key_test": "value_test"
}

I have one Rule which I want to use this api action. So which fields Should I fill.
in api action there are : Action name | request_type | Headers | Body | Response
How should I fill these parts

@udit-pandey
Copy link
Contributor

udit-pandey commented Jan 14, 2022

Hi @masoudMZB,
Apologies that you had to face this issue. It would be great if you can share steps to recreate this issue.
From your requirements, I am sharing a screenshot of an API action i created.
image

The bot response in this case will be the API output.
We expect a placeholder in the response field to fit your api response into. Users can either get complete response with ${RESPONSE} placeholder or a custom placeholder based on the api response.

image
The bot response in above case will be: Response from api is value_test.

There maybe cases where our api output has list elements. For this, we can have list indices along with keys as our placeholder.
Eg: If my api output is:

{
    'temperature': [
        {
            'date': '14-Jan',
            'temp': 23,
            'unit': 'Celcius'
        },
        {
            'date': '13-Jan',
            'temp': 25,
            'unit': 'Celcius'
        },
        {
            'date': '12-Jan',
            'temp': 24,
            'unit': 'Celcius'
        }
    ]
}

and I want my bot to respond with: Temperature on 14-Jan is 23 degree celcius.
I will create my API action as shown below:
image

Hope, this will be helpful. Please reach out in case you need further help.

@masoudMZB
Copy link
Author

thanks for your answer this was the exact answer. I'll close this issue

@udit-pandey udit-pandey pinned this issue Apr 5, 2022
@sfahad1414 sfahad1414 unpinned this issue Apr 26, 2022
@udit-pandey udit-pandey pinned this issue May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants