Unable to Tigger workflow from API

Hey everyone,

I need a bit of help to understand what I am doing wrong. I want to be able to trigger a build using the Circle ci API. I have set up the following configuration

version: 2.1
jobs:
build-and-test:
macos:
xcode: “10.1.0”
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: output
FASTLANE_LANE: make_sure_code_works
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: output
- store_test_results:
path: output/scan
share-Test-build:
macos:
xcode: “10.1.0”
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: output
FASTLANE_LANE: share_Testing_build
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: output
- store_test_results:
path: output/scan
Pre-release-builds:
macos:
xcode: “10.1.0”
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: output
FASTLANE_LANE: share_Testing_build shareProd:True
FASTLANE_LANE_PROD: prod_to_testflight
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE_PROD
- store_artifacts:
path: output
- store_test_results:
path: output/scan
workflows:
version: 2
build-test-adhoc:
jobs:
- build-and-test:
filters:
branches:
only: Feature/TriigerBuildFromCircleCI
share-builds:
jobs:
- share-Test-build:
filters:
branches:
only: Feature/TriigerBuildFromCircleCI

I trigger the build using this curl :

curl -X POST “https://circleci.com/api/v1.1/project/github/dunzoit/latte/tree/“Feature/TriigerBuildFromCircleCI”?circle-token={token}

I am getting the following error

I want to take advantage of the context I have set up for my workflow hence, I am using that not the older jobs API. Which require you to add “build:” tags to jobs

I have enabled pipeline

I have no clue what exactly I am doing wrong, could someone please help?

Also given two workflows how do I choose which gets triggered when I hit the API?

You may want to tidy up the formatting of your config.yml. It’s hard to tell if you have:

  • a top-level key called 'workflows:
  • a job named 'build'

as the error states.

Good luck I’m still trying to figure out if circleCI lets you trigger a workflow by name with the api myself