How can I pass inputs to the rest/grpc interface i...
# ask-the-community
c
How can I pass inputs to the rest/grpc interface in order to kick off a workflow execution?
Copy code
{
  "project": "flytesnacks",
  "domain": "development",
  "name": "my-unique-name",
  "spec": {
    "launch_plan": {
      "resource_type": "LAUNCH_PLAN",
      "project": "flytesnacks",
      "domain": "development",
      "name": "workflow_file.workflow",
      "version": "sdkjeIIJQLKJDd=="
    }
  },
  "inputs": {
    "control_column_prefix": "nnn",
    "experimental_column_prefix": "eee",
    "num_control_columns": 3,
    "num_experimental_columns": 3,
    "csv_url": "<s3://my-bucket/path-to.csv>"
  }
}
POST to
{{baseUrl}}/api/v1/executions
results in
Copy code
{
  "error": "expected_inputs csv_url missing",
  "code": 3,
  "message": "expected_inputs csv_url missing"
}
Was able to generate a valid payload by creating a workflow manually and fetching that workflow.
Copy code
{
    "project": "flytesnacks",
    "domain": "development",
    "name": "my-unique-name",
    "spec": {
        "launch_plan": {
            "resource_type": "LAUNCH_PLAN",
            "project": "flytesnacks",
            "domain": "development",
            "name": "workflow_file.workflow",
            "version": "sdkjeIIJQLKJDd=="
        },
        "inputs": {
            "literals": {
                "control_column_prefix": {
                    "scalar": {
                        "primitive": {
                            "string_value": "isotype"
                        }
                    }
                },
            }
        }
    }
k
Use flytekit.remote
c
Thanks Ketan, I'm instantiating the executions from a service and did not want to add the flytekit dependency.
y
because it’s too big?
we’re hoping to split out the components soon
or because there’s no python in your environment?
c
Mostly to avoid dependency conflicts while the api's mature. For example, I had a pyarrow conflict the last time I checked on adding flytekit to this particular service. It may not be insurmountable but the rest interface let's me decouple a bit more quickly.
k
Cc @Haytham Abuelfutuh another reason to have the client separated out
k
I just ran into this problem and the solution posted above was very helpful, thanks! In my case I am using the rest interface instead of flytekit since I am running in an AWS lambda and only using modules available in the default runtime means I don't need to worry about building additional layers during CI/CD (and it's trivial to move to a different runtime in the future). I think my use-case would be covered by just having more examples of how to use the API somewhere in the documentation.