dehaze

Querying Remote Service

Once you have added a remote service, you can access it via the GraphQL and REST APIs of Space Cloud.

This is how you can access a remote endpoint named adder of a service named arithmetic from your frontend:

query {
  adder(
    num1: 10,
    num2: 20
  ) @arithmetic {
    sum
  }
}
const { status, data } = await api.call("arithmetic", "adder", { num1: 10, num2: 20 })

That’s it! The arguments (num1 and num2) are available to the remote service in the request body. You can pass any number of arguments to the remote endpoint.

Have a technical question?

Improve the docs!