CircleCI-Public / config-preview-sdk

Preview SDK for orb authors
85 stars 29 forks source link

Permission Denied from API #122

Open cmontgomerymt opened 5 years ago

cmontgomerymt commented 5 years ago

I am trying to use the endpoint specified here: https://circleci.com/docs/api/v1-reference/#new-project-build

https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/build?circle-token=:token

But get
"message" : "Permission denied"

error. Not sure why it's denied as I have an API token in CircleCI to use. I also send data

{"branch": "staging"}

ndintenfass commented 5 years ago

Is it possible you’re using a “project token” rather than a “user token”?

cmontgomerymt commented 5 years ago

Thank you! That seemed to be it. Will the user token expire after a while?

ndintenfass commented 5 years ago

No, but it seems we should probably at least make this error message better.

mryellow commented 5 years ago

As it stands the documented approach simply does not function.

Some talk over here about using different syntax which includes -d 'build_parameters[CIRCLE_JOB]=build' header. Although similarly does not work as expected and yields errors which make no sense as the settings it says are wrong are set exactly as it describes they should be.

https://discuss.circleci.com/t/api-to-trigger-a-new-build-by-project-preview-fails/24610

Seems nowhere is it documented that a circle-token has changed from being a "project" key to a "user" key.

maximedupre commented 5 years ago

Indeed this should be better documented! I'm so glad I found this thread though :D

mryellow commented 5 years ago

You're kidding me, it had been reported 2 years ago when I first encounted it. Must be no coders working at CircleCI.