Webflow API HTTP request with errors

Hello, I’m quiet new to JSON programming. I was looking for some samples how Webflow API works, but I couldn’t find any useful.

So, I created a Access token in my project.

When I do following HTTP request in the browser:

https://api.webflow.com/info?access_token=947cfffbd-----------------

I get following error message:

{“msg”:“No API version specified on request”,“code”:400,“name”:“InvalidAPIVersion”,“path”:“/info”,“err”:“InvalidAPIVersion: No API version specified on request”}

So, what should be the right HHTP request to access a project or site?

I appreciate useful support from anybody…

I struggled through this just recently. There’s two step:

  1. Get your site id
  2. Use that ID to do whatever you want with the api

Step 1

GET https://api.webflow.com/sites

Headers (2 of them)

Key: Authorization
Value: Bearer [api key]

Key: accept-version
Value: 1.0.0

Step 2

GET https://api.webflow.com/sites/[site id]

Same headers. Then you will add any resource you want after the site id (but with a “?” don’t forget)

Best,
John

1 Like

Thank You for reply. Do you habe a sample available which I can use directly in Javascript?

My idea is to pull data from webflow and show text on a website.

I appreciate your help,
Richard

1 Like

Have you ever programmed api calls before? If not, I would recommend codeacademy has a section on this as well as Brad Traversy has some good YouTube tutorials. Just for some orientation, there are three ways to do it:

  1. Old Way - XHRHttp Request
  2. jquery
  3. New Way - fetch (Fetch API Introduction - YouTube)

You really want to know them all but if you’re just trying to get it done and you already have jquery loading I would go that route. Hope that helps.

Also, feel free to ask any other questions here, no matter how dumb. I remember when I was first learning api programming I had so many questions and I didn’t even know the right terminology. I felt like every resource I looked at assumed all this crap I didn’t know.

Hey rich_flame

The API cannot be directly used in client-side javascript as we do not support CORS headers which would be required to read the response. In order to use the API in client-side javascript, you would have to publicly expose your API key, which would let anyone modify your site!

As for the original error you were seeing, make sure you include the api version parameter in the URL and then it should work: https://api.webflow.com/info?access_token=947cfffbd-----------------&api_version=1.0.0 (making sure to update the access_token to the correct value)

1 Like

@jhiggins I’m trying to work through the steps you specify here. Is step 2 another api call? New to the api world. Can you also please explain what step 2 can do?

Thank you.

Oh no, those aren’t three steps, they’re three different ways.

I made a tutorial that walks through it here: Webflow API + Zapier (Simple Introduction) - YouTube

Sorry, I thought you were referring to my later response. Let me know if the tutorial doesn’t answer your question