Ganesan-Chandran / vscode-fetch-client

Fetch Client is Visual Studio Code extension which is used to test the Rest API.
https://marketplace.visualstudio.com/items?itemName=GanesanChandran.fetch-client
MIT License
15 stars 8 forks source link

Few questions. How to Attach Variable? Can I add collections? #2

Closed sviatcraft closed 2 years ago

sviatcraft commented 2 years ago

Hi, There is a feature "Attach Variable". It is inside Collection menu. How can I use it?

When I click on variable select I see nothing, select is empty.


Can I add more collections?


I have multiple requests. Each of them would need auth token. I assume that "Attach Variable" is a way to use token for all collection requests.

Ganesan-Chandran commented 2 years ago

Hi @sviatcraft ,

First you have to create variable from variable tab in the sidebar(next to collection tab) and then click attach variable. In the attach variable screen, you can select above created variable in the drop-down and choose it. Now all requests under the collection is attached with the variable.

sviatcraft commented 2 years ago

@Ganesan-Chandran Thanks for your response. I was able to attach variables! My problem was that I had only "Global", and it can not be attached. After creating new variables I was able to attach them.


All my requests will need the token token is provided as a response to request "api/auth" Is there a way to use this token in response for all other API requests?

I am trying to do this like this: 1) Do auth request 2) Copy token into variable 3) Use variable for token in other requests (Authorization Type: Bearer Token)

Result: getting 401 errors. Looks like variables can not be used for token. When I am adding token value directly (without variable) it works

Any advice?

image

-

image

Ganesan-Chandran commented 2 years ago

Hi @sviatcraft ,

Global variable is default variable. If you have activated global variable then, it will attached automatically for all request (except the requests which variable attached explicitly). If you want to check current attached variable for request then, click settings icon (Gear Icon) in the request section.

Ganesan-Chandran commented 2 years ago

Fetch Client v1.1.0 has released

Please update the Fetch Client and let me know if you have any queries/feedback.

Thanks :-)

sviatcraft commented 2 years ago

Looks good, nice job :)

I might have a bug, I described it here https://github.com/Ganesan-Chandran/vscode-fetch-client/issues/4

Ganesan-Chandran commented 2 years ago

Thanks @sviatcraft . I am closing this issue and continue discussion on #4.