All,
I’m a trained-as-a-chemist now-a-Fortran-programmer/Github-admin (aka “my programs never touch the internet”) trying to learn how to do CircleCI. And that has now extended into the realm of using the API. Which apparently am not that smart at.
To wit, eventually I’d like to use the API for doing things like monitoring the credits used, etc. Now, I have stared at the API and I eventually hit on:
https://circleci.com/api/v2/insights/{project-slug}/workflows
from the docs. And if I go to that webpage in Chrome (filling in the project-slug
), I can see things! Huzzah. But, my current lack of knowledge is preventing me from figuring out how to do so in, say, cURL or Python.
My first attempt is was to use cURL and so I tried to follow the API docs:
curl -X GET https://circleci.com/api/v2/insights/{project-slug}/workflows \
-H 'Accept: application/json'
and got:
{"message":"Project not found"}
So I’m obviously missing something. After Googling a bit, I saw some example somewhere with an extra header:
curl -X GET https://circleci.com/api/v2/insights/{project-slug}/workflows \
-H 'Accept: application/json' --header "Circle-Token: TOKEN"
where TOKEN
is Project API token I think(?) I created on CircleCI. I tried both an “All” token and a “Status” token and no matter what I use, I get:
{"message":"Project not found"}
So, I’m obviously missing something, but the docs for cURL only show the first thing I tried. The thing with --header
was a possibility but not enough.
Now in the end, I’d probably prefer to use Python so I can do things like graphing with matplotlib, etc. But if I can’t figure out how to do something this basic…
Any help for a wayward Fortran programmer?