Skip to content

Add cURL and CLI examples to POST /tags #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 9, 2020

Conversation

nmelehan
Copy link
Contributor

@nmelehan nmelehan commented Mar 4, 2020

Tagging with do-not-merge: this has some issues I couldn't figure out, and am asking for some second opinions

-H "Authorization: Bearer $TOKEN" \
-X POST -d '{
"label": "example tag",
"linodes": [123,456],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leslitagordita @yoshizzle I did some testing for this but ran into some problems:

When running the example command as it is here (with the IDs updated for resources that are actually on my account), the tag was created, but the Linodes and Volumes didn't get the tag applied to them. No error was returned by the API, and my API token had full permissions to write to my account.

Can I ask you to try this out too? I'm not sure if this is a problem with the example I've added, or if it might be a bug in the API.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran this with Linode and Volume IDs that exist on my account, and it worked as I expected.

openapi.yaml Outdated
source: >
linode-cli tags create \
--label 'example tag' \
--linodes (123 456) \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dorthu I realized when trying to write this example that I don't know how to represent lists as arguments for the Linode CLI. Using the Bash array syntax here didn't work; I got the following error:

linode-cli tags create \
  --label 'example tag' \
  --linodes (123 456) \
  --volumes (9082 10003)
zsh: unknown file attribute: 1

Any tips for where I might be going wrong?

Copy link
Collaborator

@Dorthu Dorthu Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to specify --linodes multiple times; in this case you want:

linode-cli tags create \
  --label 'example tag' \
  --linodes 123 \
  --linodes 456 \
  --volumes 9082 \
  --volumes 10003

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed up a commit to add an example in the format you suggested @Dorthu.

openapi.yaml Outdated
- lang: Shell
source: >
curl -H "Authorization: Bearer $TOKEN" \
https://api.linode.com/v4/tags/example%20tag
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also put the entire URL in quotes to avoid having to escape the space:

Suggested change
https://api.linode.com/v4/tags/example%20tag
"https://api.linode.com/v4/tags/example tag"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. Updated!

@leslitagordita leslitagordita removed the request for review from yoshizzle March 9, 2020 19:03
@leslitagordita leslitagordita merged commit fc301ff into linode:development Mar 9, 2020
LBGarber pushed a commit to LBGarber/linode-api-docs that referenced this pull request Jun 15, 2022
[Birthday] Footer Change - remove Nanode update Standard to Shared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants