Andy Dyer

    Andy Dyer

    1 year ago
    Hey All, I am a graphql noob and was wondering if anyone had an example of a mutation to run a flow with given parameters?
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    Shazam!
    mutation {
        create_flow_run(
            input: {
                flow_id: "<MY_FLOW_ID>",
                parameters: "{\"<TASK_NAME>\": \"<TASK_VALUE>\"}"
            }
        ) {
            id
        }
    }
    Andy Dyer

    Andy Dyer

    1 year ago
    thanks Kyle!
    @Kyle Moon-Wright what is the url for the api I cant find it in the docs. (not using the prefect python api using a graph ql client)
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    <https://api.prefect.io>
    Andy Dyer

    Andy Dyer

    1 year ago
    thanks totally missed that and cmd-f’d now in the docs and its front and center. Thanks Kyle
    hey Kyle any reason why a token created like
    mutation {
      create_api_token(input: { name: "ARBITARY_NAME", scope: TENANT }) {
        token
      }
    }
    would be getting forbidden from the prefect api. Am i messing up scoping ?
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    Hmm, tough to say - that mutation works for me no problem. 🤔
    Andy Dyer

    Andy Dyer

    1 year ago
    It worked this morning with the same input, is it possible that API keys take a while to propagate?
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    It should be pretty instant if you create a token, are you not able to access your tenant with the token you created?
    Andy Dyer

    Andy Dyer

    1 year ago
    i was only after a few hours. I had a postman query not work EOD with a 403, ran it first thing with 0 changes and it worked 200 no problem. As an aside for that mutation, is their anyway to create_a_flow_run for the latest version. I supposed you could also query to get the latest flow versions’ id by name and take the greatest version
    Kyle Moon-Wright

    Kyle Moon-Wright

    1 year ago
    Yep, I think that’s the best way to do it. As you already know, each flow version has its own ID and must be provided to run that flow. Though, I’m sure there’s a better call/mutation to get the last flow ID for that version group.