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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12021,6 +12021,23 @@ paths:
$ref: '#/components/schemas/Tag'
default:
$ref: '#/components/responses/ErrorResponse'
x-code-samples:
- lang: Shell
source: >
curl -H "Content-Type: application/json" \
-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.

"volumes": [9082,10003]
}' \
https://api.linode.com/v4/tags
- lang: CLI
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.

--volumes (9082 10003)
/tags/{label}:
x-linode-cli-command: tags
parameters:
Expand Down