|
1
|
{"slug":"/references/helper-steps/useRemoteQueryStep","title":"useRemoteQueryStep - Helper Steps API Reference","frontmatter":{"slug":"/references/helper-steps/useRemoteQueryStep","sidebar_label":"useRemoteQueryStep"},"toc":[{"title":"Example","id":"example","level":2},{"title":"Input","id":"useremotequerystep-input","level":2}],"blocks":[{"kind":"markdown","html":"This documentation provides a reference to the `useRemoteQueryStep` step. It belongs to the `@medusajs/medusa/core-flows` package."},{"kind":"heading","level":2,"text":"Example","id":"example"},{"kind":"markdown","html":"To retrieve a list of records of a data model:\n\n```ts\nconst products = useRemoteQueryStep({\n entry_point: \"product\",\n fields: [\n \"*\",\n \"variants.*\"\n ]\n})\n```\n\nTo retrieve a single item instead of a an array:\n\n```ts\nconst product = useRemoteQueryStep({\n entry_point: \"product\",\n fields: [\n \"*\",\n \"variants.*\"\n ],\n variables: {\n filters: {\n id: \"123\"\n }\n },\n list: false\n})\n```\n\nTo throw an error if a record isn't found matching the specified ID:\n\n```ts\nconst product = useRemoteQueryStep({\n entry_point: \"product\",\n fields: [\n \"*\",\n \"variants.*\"\n ],\n variables: {\n filters: {\n id: \"123\"\n }\n },\n list: false,\n throw_if_key_not_found: true\n})\n```"},{"kind":"heading","level":2,"text":"Input","id":"useremotequerystep-input"},{"kind":"typeList","sectionTitle":"useRemoteQueryStep","openedLevel":1,"types":[{"name":"EntryStepInput \\| ServiceStepInput","type":"[EntryStepInput](/references/helper_steps/interfaces/helper_steps.EntryStepInput) \\| [ServiceStepInput](/references/helper_steps/interfaces/helper_steps.ServiceStepInput)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"EntryStepInput \\| ServiceStepInput","type":"[EntryStepInput](/references/helper_steps/interfaces/helper_steps.EntryStepInput) \\| [ServiceStepInput](/references/helper_steps/interfaces/helper_steps.ServiceStepInput)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]}]} |