Tracks
/
Ballerina
Ballerina
/
Exercises
/
Service Invocation
Service Invocation

Service Invocation

Work In Progress
Easy

Instructions

Calling APIs is an important part of writing code on the internet. In this exercise, you will need to fetch data from an endpoint and ensure it was retrieved successfully.

Objectives

  • Modify the provided code.
  • Invoke the HTTP client and try to retrieve a quote. This result should be a union type consisting string and error.
  • If the quote is received, print it to the console (using io:println()).
  • If an error has occurred, print the error message to the console.
Edit via GitHub The link opens in a new window or tab
Ballerina Exercism

Ready to start Service Invocation?

Sign up to Exercism to learn and master Ballerina with 50 exercises, and real human mentoring, all for free.