# Integration with CIrcleCI using REST API

**URL:** <https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025>\
**Category:** Integrations and Accounts\
**Tags:** api\
**Created:** [March 15, 2019, 2:56pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025 "2019-03-15T14:56:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolai-ivanov](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nikolai-ivanov](https://discuss.circleci.com/u/nikolai-ivanov)\
**Post date:** [March 15, 2019, 2:56pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/1 "2019-03-15T14:56:16Z")

</div>

Hi Guys,

I have the following question: I am trying to download the latest artifacts using API method  
curl -X GET [https://circleci.com/api/v1.1/project/github/](https://circleci.com/api/v1.1/project/github/)\< username \>/\< project \>/latest/artifacts?circle-token=\< token \>&branch=master&filter=completed

But the response is empty [], and I see that it was split into two different responses.

I’ve started the command but response was getting when the command finished.  
autotest-MacBook-Pro: autotest$ curl -X GET [https://circleci.com/api/v1.1/project/github/](https://circleci.com/api/v1.1/project/github/)\< username \>/\< project \>/latest/artifacts?circle-token=\< token \>&branch=master&filter=completed  
[1] 23873  
[2] 23874  
[2]+ Done branch=master  
autotest-MacBook-Pro: autotest$ [{ correct response here }]

I used the CircleCI API earlier and hadn’t faced with this issue.  
Probably something was changed in API and I should add something here to get the result in the first response?

Thanks

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [March 15, 2019, 3:06pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/2 "2019-03-15T15:06:07Z")

</div>

Hmm. Per [https://circleci.com/docs/api/#artifacts-of-the-latest-build](https://circleci.com/docs/api/#artifacts-of-the-latest-build) that’s correct. Let me run some tests to see if I can reproduce.

Are you using a project token, or a user token?

Edit: I can’t reproduce this: [https://circleci.com/api/v1.1/project/github/drazisil/mco-server/latest/artifacts?branch=master&filter=completed](https://circleci.com/api/v1.1/project/github/drazisil/mco-server/latest/artifacts?branch=master&filter=completed) (token not needed since it’s a public project)

Confirmed that accessing a private project with the wrong token return `Project not found`, not empty.

---

<div class="post-metadata">

**Author:** ![nikolai-ivanov](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nikolai-ivanov](https://discuss.circleci.com/u/nikolai-ivanov)\
**Post date:** [March 15, 2019, 3:13pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/3 "2019-03-15T15:13:27Z")

</div>

I use the user token for it.

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [March 15, 2019, 3:15pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/4 "2019-03-15T15:15:35Z")

</div>

Silly question then, are you sure the master branch’s latest job has artifacts? If you are using a workflow it may be that one of the jobs in the workflow has the artifacts, but not the latest one.

---

<div class="post-metadata">

**Author:** ![nikolai-ivanov](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nikolai-ivanov](https://discuss.circleci.com/u/nikolai-ivanov)\
**Post date:** [March 15, 2019, 3:22pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/5 "2019-03-15T15:22:36Z")

</div>

I see the not empty response in the second part of the output but when I run it in terminal I see that the curl command finished with output  
[1] 23873  
[2] 23874  
[2]+ Done branch=master

and over time I get the valid response in the terminal  
It seems as the request was performed in another thread or it was redirected

I see the same issue with Postman and HttpClient java. It returns the code=200 and response=[]

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [March 15, 2019, 3:27pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/6 "2019-03-15T15:27:14Z")

</div>

Very strange. Sent you a DM.

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [March 15, 2019, 5:58pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/7 "2019-03-15T17:58:58Z")

</div>

Regenerating the API token resolved this.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [March 25, 2019, 6:02pm UTC](https://discuss.circleci.com/t/integration-with-circleci-using-rest-api/29025/8 "2019-03-25T18:02:30Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
