Hi there!
Is there a way to write a JSON list returned from an external API into an Adalo table?
I need then to have a list inserted in the list (received from API) so the external collection is hardly a solution here, I assume.
Thanks!
Hi there!
Is there a way to write a JSON list returned from an external API into an Adalo table?
I need then to have a list inserted in the list (received from API) so the external collection is hardly a solution here, I assume.
Thanks!
Hi @Dmytro, have a look Accessing your Record ID - Adalo Resources. Or search the forum for Custom Action.
Note that there are some restrictions. We basically need a REST API - not all JSON is working. See: Can we use javascript in GET ALL results key? - #11 by Ben
As I mentioned on another thread, replies like this that sound “official” are really not helpful.
REST doesn’t even require JSON, try getting an image from a Google Place - the response is just an image. See also text, XML etc.
All REST APIs if they are RESTful (fulfil the principles). Most APIs that look RESTful are not.
Lists are hard.
a)
{
{“People”:[“Amy”,“Bill”]}
}
b)
[
{
"Name":"Amy", "Town":"Oxford"
},
{
"Name":"Bill", "Town":"London"
]
…because a tool has no idea what to call that field (a) or the element (b).
I think Nested Arrays might be fairly hard, as you point out. However, you could wrap the API call in an Integromat webhook and manipulate the JSON in there.
Would need to see what the list/array looked like to help further.
@NigelG I was just trying to point @Dmytro to existing resources and what has been discussed already in this context
I was just trying to reframe the previous discussions as being fairly misleading
“It has to be REST” is really “There are some constraints on the format of the JSON which are not fully documented but it does need to be JSON over HTTP”
.
Is this expected to work via Custom Action and/or External Collection?
Thank you!
External collections require the API to be able to return an array for “Get All”. So I think you would have to use a Custom Action.
Is there a (workaround) way to save an arrey received from API via Custom Action?
I haven’t played with it enough to know. Will see if I can find an API to test out.
I can give you an API to test with )
That would be handly. DM ?
That gives a 500 response?
Yes. Also returns a list.
TypeError
TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last)
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
def __call__(self, environ, start_response):
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app` which can be
wrapped to applying middleware."""
return self.wsgi_app(environ, start_response)
def __repr__(self):
return "<%s %r>" % (self.__class__.__name__, self.name)
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
# if we want to repropagate the exception, we can attempt to
# raise it with the whole traceback in case we can do that
# (the function was actually called from the except part)
# otherwise, we just raise the error again
if exc_value is e:
reraise(exc_type, exc_value, tb)
else:
raise e
self.log_exception((exc_type, exc_value, tb))
server_error = InternalServerError()
File "/app/.heroku/python/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
import collections.abc as collections_abc
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
implements_to_string = _identity
else:
iterkeys = lambda d: d.iterkeys()
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
ctx = self.request_context(environ)
error = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(self, rv, from_error_handler=False):
"""Given the return value from a view function this finalizes
the request by converting it into a response and invoking the
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
return self.handle_http_exception(e)
handler = self._find_error_handler(e)
if handler is None:
reraise(exc_type, exc_value, tb)
return handler(e)
def handle_exception(self, e):
"""Handle an exception that did not have an error handler
associated with it, or that was raised from an error handler.
File "/app/.heroku/python/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
import collections.abc as collections_abc
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
implements_to_string = _identity
else:
iterkeys = lambda d: d.iterkeys()
File "/app/.heroku/python/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
self.try_trigger_before_first_request_functions()
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(self, rv, from_error_handler=False):
File "/app/.heroku/python/l
Does it need some application content param ?
The request format is
{“text” : “query text”}
Given I can’t get it to work in Postman, I don’t think Adalo is going to have much chance.
So … Content-Type = Application/json and I still get
I figured out everything and it works fine, thank you for your attempt to help!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.