HTML data returned with login request

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.

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.

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

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.

Which URL are you referring to ?

I don’t have access to anything, since I am a third party consultant.

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)

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.

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.

1 Like

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.

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.

1 Like

You are welcome. I suspect solving the client’s issue will require a deeper dive into the nuances of the Airtable API, and the documentation will be essential to understanding those details.

I am saddened that your conversation with Scott took an unpleasant turn. I basically repeated the same advice as Scott, which was to refer you to the documentation. Without your conversation with Scott, it would not have been revealed that you were new to Airtable and APIs and had such limited access. It is very rare for people to post of these forums about bases to which they do not have access, so we normally assume that you do have access. Most of the people on these forums also have limited experience with the REST API and do not interact with threads about it.

2 Likes

I always chuckle a little when I see back-to-back deleted posts from @ScottWorld and hope that some day he publishes these through a Patreon feed. I’d pay. It’s like watching Wile E. Coyote paint a tunnel on a rock.

I’m going to mess up the analytics by liking every one of Scott’s deleted posts.

2 Likes

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.