Shachar R
Shachar R

Reputation: 321

Unable to fetch apiary.apib using the apiary CLI fetch command (even though i am using my apiary access token)

I am trying to fetch my apiary documentation (on the apiary server) to my local drive. I am the owner of the API and have access to the Settings button (I thought maybe this is important since i get a 403 forbidden response in the end, see below).

After installing the apiary CLI i followed these steps:

Note: running on windows (using cmd/powershell to execute the commands).

  1. Getting the Access token taken from here
  2. Setting a new environment variable APIARY_API_KEY=Access token.
  3. Running the following command (i can easily find the API Name on apiary.io)

    apiary fetch --api-name="<API_NAME>"
    

I expect to get the API documentation (so far I have been working on apiary.io through the browser) fetched to my local drive - this allows me to edit it locally to run additional tools (dredd) to validate my API against the fetched document.

What happens instead is that i get this response:

    Apiary service responded with an error: 403 Forbidden

What could be the issue, i can easily see/edit my API on apiary.io so why can't i access it using the apiary CLI?

(Editted) Image added Fetch Command Fails due to 403

Upvotes: 1

Views: 522

Answers (1)

Nada
Nada

Reputation: 101

Two possible problems come to mind:

  1. the environment variable is not actually used (if I recall correctly, when you add or modify an environment variable in Windows, you need to restart the command prompt to take effect)
  2. token is not valid for fetching APIs (can you try generating a new token and using that one, if it produces the same result?)

Upvotes: 1

Related Questions