This guide demonstrates how to use a CUE workflow command to fetch some JSON over HTTP.

It is converted from its JSON representation into data, which is then used by the workflow command.

package example

import (

command: info: {
	fetch: http.Get & {
		url: ""
	display: cli.Print & {
		_data: #info & json.Unmarshal(fetch.response.body)
		text:  "CUE version \(_data.Version) was released with commit hash \(_data.Origin.Hash)"

// The data received is validated against this schema. This is good practice,
// but is not required before using the data.
#info: {
	Version!: string
	Origin?: {
		Hash!: string
$ cue cmd info
CUE version v0.8.2 was released with commit hash 596c99191ad1eb7c39d547e59bc7085751d7952b
  • Reference: cue commands – CUE workflow commands
  • Go API: tool/http – make HTTP requests in workflow commands
  • Go API: encoding/json – convert data to and from its JSON representation
  • Go API: tool/cli – interact with the user’s terminal in workflow commands