Skip to main content

Quickstart: Service Invocation

In this quickstart, you'll run a client and server application on Diagrid Cloud. You will learn how to:

  • Provision a Diagrid project with apps for two applications using the Diagrid CLI.
  • Invoke a remote service method from a client application using the Dapr Service Invocation API.
  • Verify successful service-to-service communication in the application logs and the Diagrid Web Console.
Client and server apps connected through Diagrid service invocationDiagridClient appApp IDclientApp IDserverServer app
Client and server apps connected through Diagrid service invocationThe client calls the server's App ID. Diagrid routes the call to the server app.

1. Prerequisites​

Before you proceed, ensure you have the following prerequisites installed.

2. Log in to Diagrid​

Authenticate to Diagrid using the following command:

diagrid login

This command opens a new browser window where you'll be shown a confirmation code that should match the code in your terminal. Confirm the code, and if you're not logged into Diagrid, you'll be redirected to login.

Confirm your user details are correct using the following command:

diagrid whoami

The expected output contains the name of the organization, your user name, and the Diagrid API endpoint.

3. Clone Quickstart Code​

Clone the quickstart code from GitHub:

git clone https://github.com/diagridio/catalyst-quickstarts

Navigate to the quickstart directory:

cd catalyst-quickstarts/invocation/python

4. Install Dependencies​

Install the dependencies for both the client and server applications.

Install Python dependencies:

uv sync --all-packages

5. Run the application with Diagrid Cloud​

The diagrid dev run command creates your Diagrid project, provisions resources (apps), configures environment variables, and launches your application connected to Diagrid Cloud.

uv run diagrid dev run -f invocation-quickstart.yaml --project invocation-quickstart --approve
tip

Wait a few seconds until you see the log Connected App ID "server" to http://localhost:5002 in the terminal before proceeding to ensure both applications are up and running.

6. Invoke the service​

With the quickstart running, test the Service Invocation API by sending a request from the client app to the server app.

6.1 Send a request​

Open a new terminal and execute the following command to invoke the server app through the client app:

curl -i -X POST http://localhost:5001/order -H "Content-Type: application/json" -d '{"orderId":1}'

The expected response is 200 OK with this body:

{"message":"Invocation successful","orderId":1,"targetApp":"server"}

In the diagrid dev run terminal, the server app logs should indicate the request was successfully received, and the client app logs should show the invocation was successful.

6.2 View in the Diagrid Web Console​

Open the Diagrid Cloud web console and navigate to the Topology section that visualizes the communication between the client and server applications.

7. Clean Up​

Press CTRL+C in the terminal that runs diagrid dev run to stop the application and disconnect from Diagrid Cloud.

To delete the entire project and all provisioned resources:

diagrid project delete invocation-quickstart

Summary​

In this quickstart you:

  • Logged in to Diagrid and provisioned a managed service invocation project with a single CLI command (diagrid dev run).
  • Invoked a remote server method from a client application using the Dapr Service Invocation API.
  • Verified service-to-service communication through application logs and the Diagrid Web Console.

Diagrid handled service discovery, routing, and secure communication automatically — no infrastructure to manage.

Next steps​

Durable Execution & Dapr University · Learn this hands-onRunning Dapr applications with DiagridRun Dapr apps on Diagrid's managed pub/sub, KV store, and workflow engine — no infrastructure to operate.Beginner30 min.NET · Python · Java · JavaScriptStart the track Durable Execution & Dapr University · New to Dapr?Dapr 101: State Management, Service Invocation, and Pub/Sub APIsLearn Dapr's core building blocks — state management, service invocation, and pub/sub — through hands-on coding.Beginner45 min.NET · Python · Java · JavaScriptStart the track