Catch response from API


#1

How do I “catch” the response that I get back from an API? Let’s say I do a POST to an API endpoint, and I get some text back. How do I store that response, and then show it as a notification on the clientside?

I think the core actions “add response” has anything to do with it? But how can I then show this as a notification?


How to pass something to an existing PHP file
#2

API’s you call should return only JSON data. You can process that data or return it directly by checking the ‘output’ option on.

If an API returns an error response. You can define a action to handle it under the ‘Catch’ steps.
There you can indeed Add a response - like error code, that you can catch later on the client side if you want and display to the user.


#3

Nevil - from your post about API’s I begin to wonder if you are on the right way.
Are you building an API for yourself or using an existing API that you have no control of?

If you are building API for your self - you should really focus on making server actions - with the needed database queries. That is the Wappler way of making API’s

the Server API Connector - is really meant for calling external API’s that you want to get the data from but have no further influence on.


#4

I don’t want to build my own API, I just want to use external API’s.

I actually do have to submit JSON when using POST, like so:

Knipsel


#5

So why is there an option “JSON” in the “Data type” field?