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:
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:
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