You can run this example in Swift Playground using MacOS.
Replace _YOUR_ENDPOINT with the url of your REST Endpoint.
// Foundation is required for URLSession
import Foundation
// PlaygroundSupport: https://developer.apple.com/documentation/playgroundsupport
import PlaygroundSupport
let url = URL(string: "[YOUR_ENDPOINT]")!
// needsIndefiniteExecution is required for async code