# Rest api like tctl workflow start

**URL:** <https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [April 8, 2022, 10:12pm UTC](https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402 "2022-04-08T22:12:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carrotcap3](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@carrotcap3](https://community.temporal.io/u/carrotcap3)\
**Post date:** [April 8, 2022, 10:12pm UTC](https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402/1 "2022-04-08T22:12:27Z")

</div>

I am creating a rest endpoint that will do work like **tctl workflow start** [tctl workflow start | Temporal Documentation](https://docs.temporal.io/docs/tctl/workflow/start)

Rest endpoint accepts json payload and the workflow name and it should invoke the workflow.

I am not sure how to pass the json input as parameter to the stub. I want this endpoint to be generic so you can invoke different workflows with different input payloads, hence I do not want to instantiate any particular class from the json payload.

```auto
WorkflowStub workflowStubById = client.newUntypedWorkflowStub(workflowname, workflowOptions);

workflowStubById.start(what goes in here??);

```

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [April 9, 2022, 10:27pm UTC](https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402/2 "2022-04-09T22:27:08Z")

</div>

You could pass the Json as String input, or JsonNode would work as well.  
Other options could be to write a custom “wrapper” class that holds your rest endpoint input that is common to all workflows, see for example [WorkflowData](https://github.com/temporalio/samples-java/blob/main/src/main/java/io/temporal/samples/dsl/model/WorkflowData.java) in java DSL sample, or you could use something like [CloudEvents](https://cloudevents.io/) as a standard event format and write a custom payload converter like it is done in [this](https://github.com/temporalio/samples-java/tree/main/src/main/java/io/temporal/samples/payloadconverter/cloudevents) sample.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [April 10, 2022, 5:22pm UTC](https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402/3 "2022-04-10T17:22:55Z")

</div>

I would recommend creating the Payloads structure directly and then writing your custom DataConverter to pass it as it is. I filed an [issue](https://github.com/temporalio/sdk-java/issues/1126) to get this added to the default DataConverter.

---

<div class="post-metadata">

**Author:** ![carrotcap3](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@carrotcap3](https://community.temporal.io/u/carrotcap3)\
**Post date:** [April 11, 2022, 8:26pm UTC](https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402/4 "2022-04-11T20:26:03Z")

</div>

Passing raw json string indeed does not work.

@maxim I am not sure what you mean. Are you saying I need to instantiate the particular class file/object and pass it as parameter instead of some generic string until linked issue is resolved?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [April 11, 2022, 9:26pm UTC](https://community.temporal.io/t/rest-api-like-tctl-workflow-start/4402/5 "2022-04-11T21:26:44Z")

</div>

Temporal internally passes data as [Payloads](https://github.com/temporalio/api/blob/1cd0ac0bbd8e71c7bfc9fe1900c678b432e66e5b/temporal/api/common/v1/message.proto#L46) protobuf. [DataConverter](https://github.com/temporalio/sdk-java/blob/b52e7fb8d2cafd00e76d7a857f4d5446ca6eacd8/temporal-sdk/src/main/java/io/temporal/common/converter/DataConverter.java#L35:18) implementations are responsible for converting arguments to Payloads. So a _pass through_ DataConverter implementation would allow directly creating Payloads instance that matches a destination activity/child workflow signature.
