# Trigger Build in API with node

**URL:** <https://discuss.circleci.com/t/trigger-build-in-api-with-node/22499>\
**Category:** Programming Languages\
**Tags:** nodejs\
**Created:** [May 22, 2018, 9:01pm UTC](https://discuss.circleci.com/t/trigger-build-in-api-with-node/22499 "2018-05-22T21:01:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![claytron5000](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/claytron5000/32/18403_2.png) [@claytron5000](https://discuss.circleci.com/u/claytron5000)\
**Post date:** [May 22, 2018, 9:01pm UTC](https://discuss.circleci.com/t/trigger-build-in-api-with-node/22499/1 "2018-05-22T21:01:43Z")

</div>

I’m trying to trigger an additional build through the API using node. This is probably a node issue, but maybe someone here has experience with something similar.  
Here’s the most basic example, which I can’t get to work:

```auto
const = 'asdfasdfasdfasdfasdf` // a token generated against my account
const options = {
  headers: {'Authorization': 'Basic ' + circleToken },
  method: 'GET'
}
fetch(`https://circleci.com/api/v1.1/me`, options)
  .then(res => res.json())
  .then(json => console.log(json))

```

The token works against the API in Bash like this:

```auto
curl -X POST -u ${CIRCLE_API_TOKEN} --header "Content-Type: application/json" -d '{
  "build_parameters": {
    "CIRCLE_JOB": "visual_regression_test",
    "TEST_SITES": "zilch"
  }
}' https://circleci.com/api/v1.1/me

```

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [May 22, 2018, 9:22pm UTC](https://discuss.circleci.com/t/trigger-build-in-api-with-node/22499/2 "2018-05-22T21:22:57Z")

</div>

> [@claytron5000](#):
>
> which I can’t get to work

Can you expand on that? Do you get an error? What HTTP response code do you get? etc.

---

<div class="post-metadata">

**Author:** ![claytron5000](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/claytron5000/32/18403_2.png) [@claytron5000](https://discuss.circleci.com/u/claytron5000)\
**Post date:** [May 22, 2018, 10:14pm UTC](https://discuss.circleci.com/t/trigger-build-in-api-with-node/22499/3 "2018-05-22T22:14:10Z")

</div>

```auto
{ message: 'Project not found' }

```

---

<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:** [August 20, 2018, 10:14pm UTC](https://discuss.circleci.com/t/trigger-build-in-api-with-node/22499/4 "2018-08-20T22:14:11Z")

</div>

Closed on August 20, 2018, 10:14pm UTC

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