I’m adding support for Circle CI to a program I develop, and naturally I feel I should be using the v2 API. However, I cannot figure out a way to download build logs using the v2 API. I can do it using the v1.1 API, but that’s slated for removal soon. Is there a way to download — or even locate — logs using the new API? Are there plans to add this feature soon?
Currently there are no v2 equivalents for fetching build logs, and the only option would be to use the following v1.1 endpoint:
This is the same endpoint that is used in the UI.
My understanding is that new endpoints will be added before the v1.1 ones are removed, but I have no information to provide what they would look like. I would also like to mention that while the v1.1 endpoints are deprecated, we will make an announcement before they are removed.
Let me know if you would like further clarification on anything!
thanks aaron, can you provide a link to the API docs to specifically get the logs’ download URL.
I don’t see it here:
I’m also unclear about the relationship between a job and a build? The terms seem to be used interchangeably in the docs above. However, none of the id/key strings returned from
https://circleci.com/docs/api/v2/index.html#operation/listWorkflowJobs in v2 seem to work in
https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/:build_num in v1.
Also, for your team… there a banner at the top of the API docs.
“v1 APIs will be deprecated within the next year. We recommend switching to the v2 APIs.”
“next year” conveys no meaning unless there’s some form of timestamp on the message :). And recommending switching without feature parity might not make sense?
In case this helps others, answering my own question here:
Jobs are builds seem to be used interchangeably. So
build_numshould be the
To get logs:
- i. get pipelines:
- ii. get workflows for pipeline:
- iii. get jobs for workflow:
- iv. get the actual job (using the
- v. download the file from S3 using the
output_urlfrom any action from any step in the job.