Workflow ID returned with GET applications can not be used to trigger a build #1252
-
I am using the API to trigger a build. Before triggering I do a GET call to get applications which contains a list of the workflowIds and workflowNames. The workflow id that is returned is named "Default workflow". But I don't have anything called that, right now I only have the sample workflow ("Codemagic Sample Workflow") that is added to the yaml configuration when you go through the wizard. When I trigger the build using the workflow that is returned (which, remember is for "Default Workflow") the build fails because the workflow doesn't exist. I'm not sure where to go from here, has anyone seen this behaviour before? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Hi @abbeyjackson, I am not sure what it is like in your case without seeing it but workflowID is not inside
In this sample, workflowID is
and I can get that workflowID correctly among other workflows. |
Beta Was this translation helpful? Give feedback.
-
Sorry I should have included a sample of the response. This is what I am getting back:
I am not getting back the actual workflow I have in the project which is the codemagic sample workflow that is added when you go through the set up wizard |
Beta Was this translation helpful? Give feedback.
-
This discussion is being closed due to no activity in the last 14 days. You can reopen the discussion at any time if needed. |
Beta Was this translation helpful? Give feedback.
-
@abbeyjackson To trigger your workflow, CM config yaml should be in master/main/default branch and you have to use yaml-field-key as ID of the workflow. echo '{ "appId": "< APPID >", "workflowId": "< fileWorkflowId >", "branch": "< any branch >" }' | \
curl -H "Content-Type: application/json" \
-H "x-auth-token: < API_TOKEN >" \
-vX POST https://api.codemagic.io/builds \
-d @- |
Beta Was this translation helpful? Give feedback.
@abbeyjackson
I have an answer! Finally!
To trigger your workflow, CM config yaml should be in master/main/default branch and you have to use yaml-field-key as ID of the workflow.
You can get it from API's response in the
fileWorkflowId
field! 🎉 (see my screenshot above in my prev. comment)