Sep 14, 2022 04:27 AM
example URL = Sign in - Airtable
example API = keyMYCOOLKEY
This is what I have and what I am working with. The system that I have set up connects to the above URL and gets HTML back… Don’t know if that is correct, but the end goal is to retrieve JSON data for data import.
The issue is that when I use the URL, it displays the HTML page but says it needs a login. At no time does it require my API key. A PHP curl test reveals :
"Found. Redirecting to /login?continue=%2FappiKlBfTyvFfarTu%2FtbliOpnbcxQauIudo%2Fviw7uPlqwOjhTydwt%3Fblocks%3Dhide&redirectSource=liveapp"
When I use a bogus app/tbl/viw, then it returns an HTML that says the page cannot be found.
To summarize, the URL seems to be working that I have although it needs a login in order to return a HTML with the correct JSON data.
How can I approach this, so that the correct data is returned while also using the API key?
What I have done
I tried using https://api.airtable/app… with curl and passing Bearer and the API key. This only works with
https://airtable.com/appiKlBfTyvFfarTu/tbliOpnbcxQauIudo?blocks=hide
It doesn’t seem to like the view
I get back JSON, but not the data I am looking for because it’s missing the view.
Solved! Go to Solution.
Sep 14, 2022 06:04 AM
What are you a consultant for (Airtable or a different product)?
How familiar are you with Airtable? Do you have an Airtable account? Can your account access the base?
What is your level of experience working with REST APIs and writing code? What language / platform are you using?
The API documentation is quite good and explains the endpoints, authentication, and many other things. You would see that you need to query the table endpoint and pass the view as a parameter. However, you can only access the documentation if you have an Airtable account. If your Airtable account has access to the specific base, you will even see documentation specific to that base.
Sep 14, 2022 04:39 AM
Have you read the REST API documentation at REST API - Airtable? It will even give you sample code that you can copy & paste into the command line.
The URL for API requests starts with https://api.airtable.com/v0/
If you’re having difficulty writing the code in the command line, I would recommend using a more visual API request environment like Postman.
Or, if you don’t want write any code at all, I would highly recommend using Make for performing all of your Airtable functions.
Sep 14, 2022 04:49 AM
Thanks @ScottWorld.
I think I made a mistake in my original post and corrected it below.
I did use the API, which gave a response. But like I said before it does not give me the response I need, since it’s missing the view (viw…)
What I have done
I tried using https://api.airtable.com/v0/app… with curl and passing Bearer and the API key. This only works with
https://api.airtable.com/v0/appiKlBfTyvFfarTu/tbliOpnbcxQauIudo?blocks=hide
It doesn’t seem to like the view
Sep 14, 2022 05:09 AM
That is not the URL for making API requests. You are trying to copy and paste the URL from your web browser’s location bar, which is different from the URL that you need to use for API requests.
Once again, this is outlined in the REST API documentation.
Also, in the REST API documentation, Airtable will give you a personalized link to your own Airtable API URL Encoder Tool, which will write out the entire URL for you.
Go into the documentation, choose your base, then choose your table, then choose “List Records”, then go to the API URL Encoder Tool.
Sep 14, 2022 05:12 AM
Which URL are you referring to ?
I don’t have access to anything, since I am a third party consultant.
Sep 14, 2022 05:18 AM
The URL got from the client
https://airtable.com/appiKlBfTyvFfarTu/tbliOpnbcxQauIudo/viw7uPlqwOjhTydwt?blocks=hide
The URL I created by moving things around
https://api.airtable.com/v0/appiKlBfTyvFfarTu/tbliOpnbcxQauIudo?blocks=hide
Once again, the first URL doesn’t give a result. It gives a HTML response that requests login. Changing the URL gives a HTML response that says page not found
Once again, the second URL I can use to make an API call. It gives me a JSON response but it’s not the response I need since it doesn’t include the VIEW (viw)
Sep 14, 2022 05:43 AM
As a third party consultant myself, I would never take the approach of “moving things around” or skipping over the API documentation when trying to build a solution for my clients.
In your URL, you do not need the blocks parameter, but you are missing the view parameter.
Sep 14, 2022 06:04 AM
What are you a consultant for (Airtable or a different product)?
How familiar are you with Airtable? Do you have an Airtable account? Can your account access the base?
What is your level of experience working with REST APIs and writing code? What language / platform are you using?
The API documentation is quite good and explains the endpoints, authentication, and many other things. You would see that you need to query the table endpoint and pass the view as a parameter. However, you can only access the documentation if you have an Airtable account. If your Airtable account has access to the specific base, you will even see documentation specific to that base.
Sep 14, 2022 06:32 AM
As a third party consultant myself, I would never take the approach of “moving things around” or skipping over the API documentation when trying to build a solution for my clients.
That’s really a comment you could have kept for yourself. The second response is the one you should have led with on my original post and not be condescending and arrogant about it.
Sep 14, 2022 06:39 AM
a.) I work for a client that has a WordPress plugin that has a bug which I am trying to fix. Let’s call them pluginteam. The bug is from THEIR client. Let’s call them clientteam . The plugin can import data from several sources (csv,json,xml), one of which is from airtable… that’s why I am here.
b.) I am not familiar with airtable at all. I have a “free” account I guess. I don’t have any access to the clientteam data and the link and api key is all I got.
c.) First time looking into it. In this case, I work with PHP and WordPress. I have a local instance of WP running where I test the plugin and also an instance where I directly test with cURL to airtable.
Thank you for your suggestions and information.