External Collection API Setup Error & Repeating Values

Objective: I would like to create an external collection using this API: Free API - Inspirational quotes JSON with code examples - #9 by SergeyWebPro - JavaScript - The freeCodeCamp Forum

By using this URL: https://type.fit/api/quotes

Problem: I’m getting an error (screenshot below) when trying to test the connection. From looking at other posts, I suspect this is valid JSON but not a RESTful response. Does Adalo have a way to access / process these types of responses, where there is no named object / array to include as the results key?

What I’ve tried:

  1. Adding different Content-Types to the header
  2. Trying different entries in the results key to access the levels of JSON including full stop / period and square brackets

Screenshot

Data Extract Example
[
{
“text”: “Genius is one percent inspiration and ninety-nine percent perspiration.”,
“author”: “Thomas Edison”
},
{
“text”: “You can observe a lot just by watching.”,
“author”: “Yogi Berra”
},
{
“text”: “A house divided against itself cannot stand.”,
“author”: “Abraham Lincoln”
},
{
“text”: “Difficulties increase the nearer we get to the goal.”,
“author”: “Johann Wolfgang von Goethe”
},
{
“text”: “Fate is in your hands and no one elses”,
“author”: “Byron Pulsifer”
},
{
“text”: “Be the chief but never the lord.”,
“author”: “Lao Tzu”
},
{
“text”: “Nothing happens unless first we dream.”,
“author”: “Carl Sandburg”
},
{
“text”: “Well begun is half done.”,
“author”: “Aristotle”
}
]

Solutions
This other API works in terms of being able to setup an External Collection: http://universities.hipolabs.com/search?country=United+States

And it appears to follow the same structure as before, using an anonymous array containing multiple objects with no named results key but it uses a json content type. The original API at the top used a plain text content type. Unless you can control the third party API, you might need to manipulate this outside of Adalo (using Integromat or similar)

BUT I then noticed that setting up a list to point to this collection (Without any filters, etc) just sets all items in the list to be the same value, which is the last entry returned by the API

Resolution to Repeating Values
More info here: API Result Display on Repeat - #12 by joeyology

Name is unique but it wasn’t at the top by default so you need to drag it to the top manually. This could be an ID or similar in your case
image

Hi @ChrisAndo88,

As an alternative - why not to import the quotes’ data into the database once and then use it?
You’ll need to do this operation just once, and I guess there are plenty of tools to convert this JSON array to a CSV.

Best regards, Victor.

1 Like

Thanks @Victor yes that’s what I’ll probably end up doing in this scenario but I was more interested in testing the API abilities really but at least there are options / solutions available. Am I correct in my assumption that it’s the content type of “plain text” which is the problem and third party API’s need to send a response as content-type: json?

Hi @ChrisAndo88,

As for me, in this case the problem is with content-type.

But in some other case (as I remember, I might be wrong) Adalo wasn’t able to form an external collection from the JSON array like this. Please see this thread: Adalo and external database

Best regards, Victor.

1 Like

i have the same problem!
I’ve written post about this:Problem with external collection in list
And still don’t have answer:(

Hey @Kostya,

Have you tried this:

Resolution to Repeating Values
More info here: API Result Display on Repeat - #12 by joeyology

In your Collections drag the field you’re displaying to the top of the fields in the External Collection (there is a screenshot in my initial post). In my case I was using “Name”. Now see above: “Name is unique but it wasn’t at the top by default so you need to drag it to the top manually. This could be an ID or similar in your case”

This fixed it for me. I hope that helps

1 Like

Chris, thanks a lot! It’s work!
But solution is totally not obvious!

2 Likes

@ChrisAndo88 fantastic! Thanks for sharing this!

2 Likes