Charms

Endpoints related to charms and bundles.

charm_info

Introduced in version 22

Summary: GET /v2/charms/info/<name>

Given a name, return the details of the corresponding charm or bundle, and its released revisions.

Supports the following optional query params:

  • fields: A comma separated list of field names to include in the response. Optional. The following are always returned: type, id, name. Possible field names are in the successful response description below.

Responses are a JSON encoded dict. A successful response represents a single charm or bundle, and contains:

{
    "type": "charm" or "bundle".
    "id": str # 32 character identifier
    "name": str # The unique name of the charm or bundle.
    "result": {...} # Charm or bundle fields. Optional.
    "channel-map": [ # Array of all channels & revisions on them. Optional.
        {
            "channel": {...} # Optional.
            "revision": {...} # Optional.
        },
        ...
    ],
    "default-release": { # Optional.
        "channel": {...} # Most stable risk on default track. Optional.
        "revision": {...} # Last revision on that channel. Optional.
    }
}

Optional fields are only included if requested using the 'fields' param. See 'description' fields in the schema for details of each field.

Alternatively, an unsuccessful (non 2xx) response contains:

{
    "error-list": [
        {
            "code": str # String slug to identify the error type.
            "message": str # Human readable error message.
        },
        ...
    ]
}

charm_info changelog

  • Version 50: Added 'links' field to result.
  • Version 49: Added 'unlisted' field to result.
  • Version 47: Added 'default-release.revision.subordinate' response field.
  • Version 44: Added 'relations' to revision response field
  • Version 43: Added resource field 'created-at'.
  • Version 42: Remove unsupported fields from channel-map.
  • Version 40: Added 'attributes' to revision response field.
  • Version 36: Added 'deployable-on' field to result.
  • Version 35: Return 'bases' in info responses.
  • Version 34: Added 'title' field to result.
  • Version 30: Added resource fields 'filename' and 'description'
  • Version 29: Added 'bundle-yaml' field to revision.
  • Version 28: Added 'resources' field to channelmap.
  • Version 27: Added 'actions-yaml' to revision fields.
  • Version 22: Endpoint created.

Response JSON Schema

{
    "additionalProperties": false,
    "description": "The id and name of the requested charm or bundle, along with optional components: Its fields, all its releases in the form of a channel-map, and its most stable channel, along with the most recent revision on that channel.",
    "properties": {
        "channel-map": {
            "description": "All of this entity's releases, in the form of an array of channels and the revisions released on them. The channel-map does not contain all fields present in the default-release object. Notably, various yaml files (metadata, bundle, actions) and resource details are excluded.",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "channel": {
                        "additionalProperties": false,
                        "description": "A channel used for releases, along with a revision released on that channel.",
                        "properties": {
                            "base": {
                                "additionalProperties": false,
                                "description": "This channel's supported base.",
                                "introduced_at": 35,
                                "properties": {
                                    "architecture": {
                                        "introduced_at": 35,
                                        "type": "string"
                                    },
                                    "channel": {
                                        "introduced_at": 35,
                                        "type": "string"
                                    },
                                    "name": {
                                        "introduced_at": 35,
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "name",
                                    "channel",
                                    "architecture"
                                ],
                                "type": "object"
                            },
                            "name": {
                                "description": "This channel's full name, as track/risk. eg \"latest/stable\".",
                                "type": "string"
                            },
                            "released-at": {
                                "description": "The timestamp of the last release to this channel",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "risk": {
                                "description": "This channel's risk, eg \"stable\", \"candidate\", \"beta\", \"edge\".",
                                "type": "string"
                            },
                            "track": {
                                "description": "This channel's track. eg. \"latest\".",
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "revision": {
                        "additionalProperties": false,
                        "description": "",
                        "properties": {
                            "attributes": {
                                "additionalProperties": true,
                                "introduced_at": 40,
                                "type": "object"
                            },
                            "bases": {
                                "description": "The revision's supported bases.",
                                "introduced_at": 35,
                                "items": {
                                    "additionalProperties": false,
                                    "introduced_at": 35,
                                    "properties": {
                                        "architecture": {
                                            "introduced_at": 35,
                                            "type": "string"
                                        },
                                        "channel": {
                                            "introduced_at": 35,
                                            "type": "string"
                                        },
                                        "name": {
                                            "introduced_at": 35,
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "name",
                                        "channel",
                                        "architecture"
                                    ],
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "created-at": {
                                "description": "The timestamp of this revision's creation.",
                                "type": "string"
                            },
                            "download": {
                                "additionalProperties": false,
                                "description": "The revision's download information.",
                                "properties": {
                                    "hash-sha-256": {
                                        "description": "The download's hash.",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "size": {
                                        "description": "The download's size in bytes.",
                                        "type": "number"
                                    },
                                    "url": {
                                        "description": "The download's url.",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "revision": {
                                "description": "The integer revision number.",
                                "type": "number"
                            },
                            "version": {
                                "description": "This revision's version string.",
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "default-release": {
            "additionalProperties": false,
            "description": "A single channel-map entry representing the default channel & the last revision released on it. Default channel is defined as the most stable risk (eg. \"stable\") on the default track (falling back to \"latest\"). This is the channel used for deploys if clients express no overriding preferences. This allows clients to request representative info, such as when the last release was made, or how big the download will be, without having to request all the numerous entries in the full channel-map, or duplicate the server's logic for choosing the default channel.",
            "properties": {
                "channel": {
                    "additionalProperties": false,
                    "description": "A channel used for releases, along with a revision released on that channel.",
                    "properties": {
                        "base": {
                            "additionalProperties": false,
                            "description": "This channel's supported base.",
                            "introduced_at": 35,
                            "properties": {
                                "architecture": {
                                    "introduced_at": 35,
                                    "type": "string"
                                },
                                "channel": {
                                    "introduced_at": 35,
                                    "type": "string"
                                },
                                "name": {
                                    "introduced_at": 35,
                                    "type": "string"
                                }
                            },
                            "required": [
                                "name",
                                "channel",
                                "architecture"
                            ],
                            "type": "object"
                        },
                        "name": {
                            "description": "This channel's full name, as track/risk. eg \"latest/stable\".",
                            "type": "string"
                        },
                        "released-at": {
                            "description": "The timestamp of the last release to this channel",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "risk": {
                            "description": "This channel's risk, eg \"stable\", \"candidate\", \"beta\", \"edge\".",
                            "type": "string"
                        },
                        "track": {
                            "description": "This channel's track. eg. \"latest\".",
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "resources": {
                    "introduced_at": 28,
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "created-at": {
                                "introduced_at": 43,
                                "type": "string"
                            },
                            "description": {
                                "introduced_at": 30,
                                "type": "string"
                            },
                            "download": {
                                "additionalProperties": false,
                                "properties": {
                                    "hash-sha-256": {
                                        "type": "string"
                                    },
                                    "hash-sha-384": {
                                        "type": "string"
                                    },
                                    "hash-sha-512": {
                                        "type": "string"
                                    },
                                    "hash-sha3-384": {
                                        "type": "string"
                                    },
                                    "size": {
                                        "type": "number"
                                    },
                                    "url": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "filename": {
                                "introduced_at": 30,
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            },
                            "revision": {
                                "type": "number"
                            },
                            "type": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                },
                "revision": {
                    "additionalProperties": false,
                    "description": "",
                    "properties": {
                        "actions-yaml": {
                            "description": "The content of this revision's actions.yaml file.",
                            "introduced_at": 27,
                            "type": "string"
                        },
                        "attributes": {
                            "additionalProperties": true,
                            "introduced_at": 40,
                            "type": "object"
                        },
                        "bases": {
                            "description": "The revision's supported bases.",
                            "introduced_at": 35,
                            "items": {
                                "additionalProperties": false,
                                "introduced_at": 35,
                                "properties": {
                                    "architecture": {
                                        "introduced_at": 35,
                                        "type": "string"
                                    },
                                    "channel": {
                                        "introduced_at": 35,
                                        "type": "string"
                                    },
                                    "name": {
                                        "introduced_at": 35,
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "name",
                                    "channel",
                                    "architecture"
                                ],
                                "type": "object"
                            },
                            "type": "array"
                        },
                        "bundle-yaml": {
                            "description": "The content of this revision's bundle.yaml file.",
                            "introduced_at": 29,
                            "type": "string"
                        },
                        "config-yaml": {
                            "description": "The content of this revision's config.yaml file.",
                            "type": "string"
                        },
                        "created-at": {
                            "description": "The timestamp of this revision's creation.",
                            "type": "string"
                        },
                        "download": {
                            "additionalProperties": false,
                            "description": "The revision's download information.",
                            "properties": {
                                "hash-sha-256": {
                                    "description": "The download's hash.",
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "size": {
                                    "description": "The download's size in bytes.",
                                    "type": "number"
                                },
                                "url": {
                                    "description": "The download's url.",
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "metadata-yaml": {
                            "description": "This revision's metadata.yaml file contents.",
                            "type": "string"
                        },
                        "readme-md": {
                            "description": "The content of this revision's README.md file.",
                            "type": "string"
                        },
                        "relations": {
                            "additionalProperties": false,
                            "description": "The revision's relations (provides, requires).",
                            "introduced_at": 44,
                            "properties": {
                                "provides": {
                                    "additionalProperties": false,
                                    "introduced_at": 44,
                                    "patternProperties": {
                                        "^.*$": {
                                            "additionalProperties": false,
                                            "properties": {
                                                "interface": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                },
                                "requires": {
                                    "additionalProperties": false,
                                    "introduced_at": 44,
                                    "patternProperties": {
                                        "^.*$": {
                                            "additionalProperties": false,
                                            "properties": {
                                                "interface": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        },
                        "revision": {
                            "description": "The integer revision number.",
                            "type": "number"
                        },
                        "subordinate": {
                            "description": "Indicates whether the charm is a subordinate (boolean).",
                            "introduced_at": 47,
                            "type": "boolean"
                        },
                        "version": {
                            "description": "This revision's version string.",
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        },
        "id": {
            "description": "This charm or bundle's ID within the store.",
            "pattern": "[0-9a-zA-Z]{32}",
            "type": "string"
        },
        "name": {
            "description": "Names of charms and bundles share a single flat namespace, so can usually be used as the unique identifier of a charm or bundle.",
            "type": "string"
        },
        "result": {
            "additionalProperties": false,
            "description": "The fields of the bundle or charm.",
            "properties": {
                "bugs-url": {
                    "description": "For reporting problems with this charm. May be a web page or a mailto: URL.",
                    "type": "string"
                },
                "categories": {
                    "description": "Categories to which the charm belongs.",
                    "items": {
                        "additionalProperties": false,
                        "description": "A category to which the charm belongs",
                        "properties": {
                            "featured": {
                                "description": "Has the charm been selected by the store for high visibility to users within this category?",
                                "type": "boolean"
                            },
                            "name": {
                                "description": "The category name",
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                },
                "contains-charms": {
                    "description": "Charms in this bundle (bundles only)",
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "name": {
                                "description": "The charm's name",
                                "type": "string"
                            },
                            "package-id": {
                                "description": "The charm's unique identifier",
                                "type": "string"
                            },
                            "store-url": {
                                "description": "The store URL of this revision",
                                "type": "string"
                            }
                        },
                        "required": [
                            "package-id",
                            "name",
                            "store-url"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                },
                "deployable-on": {
                    "description": "List of platforms where this can be deployed",
                    "introduced_at": 36,
                    "items": {
                        "introduced_at": 36,
                        "type": "string"
                    },
                    "type": "array"
                },
                "description": {
                    "description": "The charm's human-readable description, which may be very long.",
                    "type": "string"
                },
                "license": {
                    "description": "The charm license.",
                    "type": "string"
                },
                "links": {
                    "additionalProperties": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "introduced_at": 50,
                    "type": [
                        "object",
                        "null"
                    ]
                },
                "media": {
                    "description": "An array of images, screenshots, icons, videos.",
                    "items": {
                        "additionalProperties": false,
                        "description": "A single image or video",
                        "properties": {
                            "height": {
                                "description": "Height of raster images. Omitted for SVG.",
                                "type": [
                                    "null",
                                    "integer"
                                ]
                            },
                            "type": {
                                "description": "Media type",
                                "type": "string"
                            },
                            "url": {
                                "description": "URL of the media",
                                "type": "string"
                            },
                            "width": {
                                "description": "Width of raster images. Omitted for SVG.",
                                "type": [
                                    "null",
                                    "integer"
                                ]
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                },
                "publisher": {
                    "additionalProperties": false,
                    "description": "Only .display-name will be populated initially. Other fields will be added later, to match snap publishers, as the PublisherGW comes online and populates those fields.",
                    "properties": {
                        "display-name": {
                            "description": "The publisher's name as a human-readable string.",
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "store-url": {
                    "description": "This charm's page in the charmhub store.",
                    "type": "string"
                },
                "store-url-old": {
                    "description": "This charm's page in the old, deprecated store.",
                    "type": "string"
                },
                "summary": {
                    "description": "One-line description of the charm.",
                    "type": "string"
                },
                "title": {
                    "description": "Human-readable name of the charm.",
                    "introduced_at": 34,
                    "type": "string"
                },
                "unlisted": {
                    "description": "Indicates whether the charm is visible.",
                    "introduced_at": 49,
                    "type": "boolean"
                },
                "used-by": {
                    "description": "Bundles that use this (charms only).",
                    "items": {
                        "description": "A bundle name",
                        "type": "string"
                    },
                    "type": "array"
                },
                "website": {
                    "description": "External website for the charm.",
                    "type": [
                        "string",
                        "null"
                    ]
                }
            },
            "type": "object"
        },
        "type": {
            "description": "\"charm\" or \"bundle\".",
            "enum": [
                "bundle",
                "charm"
            ],
            "type": "string"
        }
    },
    "required": [
        "type",
        "id",
        "name"
    ],
    "type": "object"
}

list_resource_revisions

Introduced in version 1

Summary: GET /v2/charms/resources/<package_name>/<resource_name>/revisions

List given resource available revisions.

list_resource_revisions changelog

  • Version 43: Added resource field 'created-at'.

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "revisions": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "created-at": {
                        "introduced_at": 43,
                        "type": "string"
                    },
                    "download": {
                        "additionalProperties": false,
                        "properties": {
                            "hash-sha-256": {
                                "type": "string"
                            },
                            "hash-sha-384": {
                                "type": "string"
                            },
                            "hash-sha-512": {
                                "type": "string"
                            },
                            "hash-sha3-384": {
                                "type": "string"
                            },
                            "size": {
                                "type": "number"
                            },
                            "url": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "name": {
                        "type": "string"
                    },
                    "revision": {
                        "type": "number"
                    },
                    "type": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        }
    },
    "required": [
        "revisions"
    ],
    "type": "object"
}

charm_refresh

Introduced in version 23

Summary: POST /v2/charms/refresh

Get the best revisions to install/refresh for the given charms.

charm_refresh changelog

  • Version 50: Added optional 'links' field to response.
  • Version 45: Added optional 'config-yaml' field to response.
  • Version 43: Added resource field 'created-at'.
  • Version 41: Accept pinned resource-revisions in actions.
  • Version 40: Stricter validation of 'base' objects in requests and responses.
  • Version 39: Added optional top-level and per-context 'metrics' to requests.
  • Version 38: Added optional 'metadata-yaml' to response.
  • Version 35: Start accepting and returning 'bases' in refresh requests.
  • Version 32: Add 'type' field
  • Version 31: Remove unused metadata-yaml field
  • Version 30: Added resource fields 'filename' and 'description'
  • Version 29: Added 'resources' field.
  • Version 23: Endpoint created.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "actions": {
            "description": "A list of the intended actions from the client, one action per charm.",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "action": {
                        "description": "The action to perform. Install and download actions behave in the same manner, but signify different intents. If there is a `refresh-all` action, it must be the only action in the request. For `refresh-all`, no other fields are required, since all expected information should be present in the context.",
                        "enum": [
                            "download",
                            "install",
                            "refresh",
                            "refresh-all"
                        ],
                        "type": "string"
                    },
                    "base": {
                        "additionalProperties": false,
                        "description": "For install actions, this field is required. It should be null for bundles, and when requesting a charm by revision (since base is irrelevant when requesting a specific revision). For refresh actions, this field is optional. It defaults to the base sent in the context. If sent, the base in 'action' has priority over the base in 'context'.",
                        "introduced_at": 35,
                        "properties": {
                            "architecture": {
                                "introduced_at": 35,
                                "type": "string"
                            },
                            "channel": {
                                "introduced_at": 35,
                                "type": "string"
                            },
                            "name": {
                                "introduced_at": 35,
                                "type": "string"
                            }
                        },
                        "required": [
                            "name",
                            "channel",
                            "architecture"
                        ],
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "channel": {
                        "description": "Optional. Mutually exclusive with 'revision'. For install actions, defaults to 'stable'. For refresh actions, defaults to the tracking-channel in the context.",
                        "type": "string"
                    },
                    "id": {
                        "description": "The id of the charm to install or refresh.",
                        "type": "string"
                    },
                    "instance-key": {
                        "description": "A unique identifier for the action. For refresh actions, this must map directly to an instance-key in context.",
                        "type": "string"
                    },
                    "name": {
                        "description": "The name of the charm to install. Unused for refresh.",
                        "type": "string"
                    },
                    "resource-revisions": {
                        "description": "An object representing pinned resource revision requests. Should only be sent when requesting a specific charm revision. It is an error to send these when installing or refreshing from a channel. Must be valid resources declared on the charm, and the requested revision should exist in the store.",
                        "introduced_at": 41,
                        "items": {
                            "additionalProperties": false,
                            "introduced_at": 41,
                            "properties": {
                                "name": {
                                    "introduced_at": 41,
                                    "type": "string"
                                },
                                "revision": {
                                    "introduced_at": 41,
                                    "type": "integer"
                                }
                            },
                            "required": [
                                "name",
                                "revision"
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "revision": {
                        "description": "An optional integer to indicate the explicitly requested revision; must not be sent if channel is given.",
                        "type": "number"
                    }
                },
                "required": [
                    "action"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "context": {
            "description": "Information about the currently installed charms (necessary for 'refresh' actions).",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "base": {
                        "additionalProperties": false,
                        "description": "The base of the installed charm.",
                        "introduced_at": 35,
                        "properties": {
                            "architecture": {
                                "introduced_at": 35,
                                "type": "string"
                            },
                            "channel": {
                                "introduced_at": 35,
                                "type": "string"
                            },
                            "name": {
                                "introduced_at": 35,
                                "type": "string"
                            }
                        },
                        "required": [
                            "name",
                            "channel",
                            "architecture"
                        ],
                        "type": "object"
                    },
                    "id": {
                        "description": "The id of the installed charm.",
                        "type": "string"
                    },
                    "instance-key": {
                        "description": "A unique identifier in the request that relates this context information with what is being refreshed (it's a free form string, no constraints)",
                        "type": "string"
                    },
                    "metrics": {
                        "introduced_at": 39,
                        "type": "object"
                    },
                    "refreshed-date": {
                        "description": "The date on which this charm revision was installed in the caller's system, in ISO 8601 format",
                        "type": "string"
                    },
                    "revision": {
                        "description": "Currently installed charm revision",
                        "type": "number"
                    },
                    "tracking-channel": {
                        "description": "The channel that the charm is currently tracking, for instance 'stable', 'candidate' etc.",
                        "type": "string"
                    }
                },
                "required": [
                    "base",
                    "id",
                    "instance-key",
                    "revision",
                    "tracking-channel"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "fields": {
            "default": "`created-at`, `download`, `id`, `license`, `name`, `publisher`, `resources`, `revision`, `summary`, `type`, `version`.",
            "description": "An optional list of field names needed in the response payload.",
            "items": {
                "type": "string"
            },
            "type": "array"
        },
        "metrics": {
            "introduced_at": 39,
            "properties": {
                "controller": {
                    "introduced_at": 39,
                    "properties": {
                        "uuid": {
                            "introduced_at": 39,
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "model": {
                    "introduced_at": 39,
                    "properties": {
                        "uuid": {
                            "introduced_at": 39,
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        }
    },
    "required": [
        "context",
        "actions"
    ],
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "error-list": {
            "description": "This list is used to indicate global, request-level errors. For instance, an unknown action, or a `refresh-all` action combined with other actions. This will produce a 400 BAD REQUEST.",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "required": [
                    "code",
                    "message"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "results": {
            "description": "A list of results; one object per charm in the requested actions.",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "charm": {
                        "additionalProperties": false,
                        "description": "A dictionary with the requested fields (see top level `fields` in the request schema) for the given charm. If requested `fields` is empty, this field will be empty.",
                        "properties": {
                            "bases": {
                                "introduced_at": 35,
                                "items": {
                                    "additionalProperties": false,
                                    "introduced_at": 35,
                                    "properties": {
                                        "architecture": {
                                            "introduced_at": 35,
                                            "type": "string"
                                        },
                                        "channel": {
                                            "introduced_at": 35,
                                            "type": "string"
                                        },
                                        "name": {
                                            "introduced_at": 35,
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "name",
                                        "channel",
                                        "architecture"
                                    ],
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "config-yaml": {
                                "description": "YAML encoding of the revision's config.yaml file.",
                                "introduced_at": 45,
                                "type": "string"
                            },
                            "contact": {
                                "type": "string"
                            },
                            "created-at": {
                                "type": "string"
                            },
                            "description": {
                                "type": "string"
                            },
                            "download": {
                                "additionalProperties": false,
                                "description": "The revision's download information.",
                                "properties": {
                                    "hash-sha-256": {
                                        "description": "The download's hash.",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "size": {
                                        "description": "The download's size in bytes.",
                                        "type": "number"
                                    },
                                    "url": {
                                        "description": "The download's url.",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "id": {
                                "type": "string"
                            },
                            "license": {
                                "type": "string"
                            },
                            "links": {
                                "additionalProperties": {
                                    "items": {
                                        "type": "string"
                                    },
                                    "type": "array"
                                },
                                "introduced_at": 50,
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "media": {
                                "items": {
                                    "additionalProperties": false,
                                    "properties": {
                                        "height": {
                                            "type": [
                                                "null",
                                                "integer"
                                            ]
                                        },
                                        "type": {
                                            "type": "string"
                                        },
                                        "url": {
                                            "type": "string"
                                        },
                                        "width": {
                                            "type": [
                                                "null",
                                                "integer"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "type",
                                        "url",
                                        "width",
                                        "height"
                                    ],
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "metadata-yaml": {
                                "description": "YAML encoding of the revision's metadata.yaml file.",
                                "introduced_at": 38,
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            },
                            "private": {
                                "type": "boolean"
                            },
                            "publisher": {
                                "additionalProperties": false,
                                "properties": {
                                    "display-name": {
                                        "type": "string"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "username": {
                                        "type": "string"
                                    },
                                    "validation": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "id",
                                    "username",
                                    "display-name"
                                ],
                                "type": "object"
                            },
                            "resources": {
                                "introduced_at": 29,
                                "items": {
                                    "additionalProperties": false,
                                    "properties": {
                                        "created-at": {
                                            "introduced_at": 43,
                                            "type": "string"
                                        },
                                        "description": {
                                            "introduced_at": 30,
                                            "type": "string"
                                        },
                                        "download": {
                                            "additionalProperties": false,
                                            "properties": {
                                                "hash-sha-256": {
                                                    "type": "string"
                                                },
                                                "hash-sha-384": {
                                                    "type": "string"
                                                },
                                                "hash-sha-512": {
                                                    "type": "string"
                                                },
                                                "hash-sha3-384": {
                                                    "type": "string"
                                                },
                                                "size": {
                                                    "type": "number"
                                                },
                                                "url": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "filename": {
                                            "introduced_at": 30,
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "revision": {
                                            "type": "number"
                                        },
                                        "type": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "revision": {
                                "type": "number"
                            },
                            "summary": {
                                "type": "string"
                            },
                            "type": {
                                "enum": [
                                    "bundle",
                                    "charm"
                                ],
                                "introduced_at": 32,
                                "type": "string"
                            },
                            "version": {
                                "type": "string"
                            },
                            "website": {
                                "type": "string"
                            }
                        },
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "effective-channel": {
                        "description": "Channel where the corresponding charm revision is effectively released to (may differ from the requested channel); this field will be present only when the request was by a channel, and missing if was done by revision.",
                        "type": "string"
                    },
                    "error": {
                        "additionalProperties": false,
                        "description": "Extra details about the error if the result of the action was `error`.",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "extra": {
                                "type": "object"
                            },
                            "message": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ],
                        "type": "object"
                    },
                    "id": {
                        "description": "The id of the charm (may not be present, e.g. if the original request was to install and the name provided was not found).",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "instance-key": {
                        "description": "A unique identifier that relates each item in the response with the original request.",
                        "type": "string"
                    },
                    "name": {
                        "description": "The name of the charm (may not be present, e.g. if the original request was to refresh but the charm is no longer available).",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "redirect-channel": {
                        "description": "The channel that shall be used for future refreshes instead of the current one; this field will be present only when there was a redirection set for the charm.",
                        "type": "string"
                    },
                    "released-at": {
                        "description": "When charm revision was released into its channel. The value will be encoded in ISO 8601 and will be null if there is no candidate revision.",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "result": {
                        "description": "One of `install`, `refresh`, `download` or `error`. In the first three cases this item has all the needed info for the client to go ahead with its intention, otherwise there was an error with the requested charm and some information may be missing.",
                        "type": "string"
                    }
                },
                "required": [
                    "instance-key",
                    "id",
                    "name",
                    "result"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "required": [
        "results",
        "error-list"
    ],
    "type": "object"
}

charm_find

Introduced in version 22

Summary: GET /v2/charms/find

"Find charms" handler.

Given a search term, return an array of matching search results. Each result will either be a charm or a bundle.

Supports the following optional query params:

  • q: The search term.
  • fields: A comma separated list of field names to include in the response. Optional. The following are always returned: type, id, name. Possible field names are in the successful response description below.
  • category: Category to filter on.
  • publisher: Filter by publisher short name (exact match).
  • channel: Filter by channel.
  • type: Filter by package type ("charm" or "bundle").
  • requires: Filter by "requires" relations (comma separated list).
  • provides: Filter by "provides" relations (comma separated list).

Responses are a JSON encoded dict. A successful response contains:

{
    "results": [
        RESULT,
        RESULT,
        ...
    ]
}

Where each RESULT object represents a single charm or bundle, and contains:

{
    "type": "charm" or "bundle".
    "id": str # 32 character identifier
    "name": str # The unique name of the charm or bundle.
    "result": {...} # Charm or bundle fields. Optional.
    "default-release": { # Optional.
        "channel": {...} # Most stable risk on default track. Optional.
        "revision": {...} # Last revision on that channel. Optional.
    }
}

Optional fields are only included if requested using the 'fields' param. See 'description' fields in the schema for each field and their sub-fields.

Alternatively, an unsuccessful (non 2xx) response contains:

{
    "error-list": [
        {
            "code": str # String slug to identify the error type.
            "message": str # Human readable error message.
        },
        ...
    ]
}

charm_find changelog

  • Version 52: Allow filtering charms on 'requires/provides' using query params.
  • Version 50: Added 'links' field to result.
  • Version 49: Added 'unlisted' field to result.
  • Version 47: Added 'default-release.revision.subordinate' response field.
  • Version 40: Added 'default-release.revision.attributes' response field.
  • Version 36: Added 'deployable-on' field to result.
  • Version 35: Return 'bases' in find responses.
  • Version 34: Added 'title' field to result.
  • Version 33: Allow filtering charms on 'category' using query param
  • Version 30: Added resource fields 'filename' and 'description'
  • Version 29: Added 'bundle-yaml' field to revision.
  • Version 28: Added 'resources' field to channelmap.
  • Version 22: Endpoint created.

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "results": {
            "items": {
                "additionalProperties": false,
                "description": "The id and name of the requested charm or bundle, along with optional components: Its fields, all its releases in the form of a channel-map, and its most stable channel, along with the most recent revision on that channel.",
                "properties": {
                    "default-release": {
                        "additionalProperties": false,
                        "description": "A single channel-map entry representing the default channel & the last revision released on it. Default channel is defined as the most stable risk (eg. \"stable\") on the default track (falling back to \"latest\"). This is the channel used for deploys if clients express no overriding preferences. This allows clients to request representative info, such as when the last release was made, or how big the download will be, without having to request all the numerous entries in the full channel-map, or duplicate the server's logic for choosing the default channel.",
                        "properties": {
                            "channel": {
                                "additionalProperties": false,
                                "description": "A channel used for releases, along with a revision released on that channel.",
                                "properties": {
                                    "base": {
                                        "additionalProperties": false,
                                        "description": "This channel's supported base.",
                                        "introduced_at": 35,
                                        "properties": {
                                            "architecture": {
                                                "introduced_at": 35,
                                                "type": "string"
                                            },
                                            "channel": {
                                                "introduced_at": 35,
                                                "type": "string"
                                            },
                                            "name": {
                                                "introduced_at": 35,
                                                "type": "string"
                                            }
                                        },
                                        "required": [
                                            "name",
                                            "channel",
                                            "architecture"
                                        ],
                                        "type": "object"
                                    },
                                    "name": {
                                        "description": "This channel's full name, as track/risk. eg \"latest/stable\".",
                                        "type": "string"
                                    },
                                    "released-at": {
                                        "description": "The timestamp of the last release to this channel",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "risk": {
                                        "description": "This channel's risk, eg \"stable\", \"candidate\", \"beta\", \"edge\".",
                                        "type": "string"
                                    },
                                    "track": {
                                        "description": "This channel's track. eg. \"latest\".",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "revision": {
                                "additionalProperties": false,
                                "description": "",
                                "properties": {
                                    "attributes": {
                                        "additionalProperties": true,
                                        "introduced_at": 40,
                                        "type": "object"
                                    },
                                    "bases": {
                                        "description": "The revision's supported bases.",
                                        "introduced_at": 35,
                                        "items": {
                                            "additionalProperties": false,
                                            "introduced_at": 35,
                                            "properties": {
                                                "architecture": {
                                                    "introduced_at": 35,
                                                    "type": "string"
                                                },
                                                "channel": {
                                                    "introduced_at": 35,
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "introduced_at": 35,
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "channel",
                                                "architecture"
                                            ],
                                            "type": "object"
                                        },
                                        "type": "array"
                                    },
                                    "created-at": {
                                        "description": "The timestamp of this revision's creation.",
                                        "type": "string"
                                    },
                                    "download": {
                                        "additionalProperties": false,
                                        "description": "The revision's download information.",
                                        "properties": {
                                            "hash-sha-256": {
                                                "description": "The download's hash.",
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "size": {
                                                "description": "The download's size in bytes.",
                                                "type": "number"
                                            },
                                            "url": {
                                                "description": "The download's url.",
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    },
                                    "revision": {
                                        "description": "The integer revision number.",
                                        "type": "number"
                                    },
                                    "subordinate": {
                                        "description": "Indicates whether the charm is a subordinate (boolean).",
                                        "introduced_at": 47,
                                        "type": "boolean"
                                    },
                                    "version": {
                                        "description": "This revision's version string.",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "id": {
                        "description": "This charm or bundle's ID within the store.",
                        "pattern": "[0-9a-zA-Z]{32}",
                        "type": "string"
                    },
                    "name": {
                        "description": "Names of charms and bundles share a single flat namespace, so can usually be used as the unique identifier of a charm or bundle.",
                        "type": "string"
                    },
                    "result": {
                        "additionalProperties": false,
                        "description": "The fields of the bundle or charm.",
                        "properties": {
                            "bugs-url": {
                                "description": "For reporting problems with this charm. May be a web page or a mailto: URL.",
                                "type": "string"
                            },
                            "categories": {
                                "description": "Categories to which the charm belongs.",
                                "items": {
                                    "additionalProperties": false,
                                    "description": "A category to which the charm belongs",
                                    "properties": {
                                        "featured": {
                                            "description": "Has the charm been selected by the store for high visibility to users within this category?",
                                            "type": "boolean"
                                        },
                                        "name": {
                                            "description": "The category name",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "contains-charms": {
                                "description": "Charms in this bundle (bundles only)",
                                "items": {
                                    "additionalProperties": false,
                                    "properties": {
                                        "name": {
                                            "description": "The charm's name",
                                            "type": "string"
                                        },
                                        "package-id": {
                                            "description": "The charm's unique identifier",
                                            "type": "string"
                                        },
                                        "store-url": {
                                            "description": "The store URL of this revision",
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "package-id",
                                        "name",
                                        "store-url"
                                    ],
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "deployable-on": {
                                "description": "List of platforms where this can be deployed",
                                "introduced_at": 36,
                                "items": {
                                    "introduced_at": 36,
                                    "type": "string"
                                },
                                "type": "array"
                            },
                            "description": {
                                "description": "The charm's human-readable description, which may be very long.",
                                "type": "string"
                            },
                            "license": {
                                "description": "The charm license.",
                                "type": "string"
                            },
                            "links": {
                                "additionalProperties": {
                                    "items": {
                                        "type": "string"
                                    },
                                    "type": "array"
                                },
                                "introduced_at": 50,
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "media": {
                                "description": "An array of images, screenshots, icons, videos.",
                                "items": {
                                    "additionalProperties": false,
                                    "description": "A single image or video",
                                    "properties": {
                                        "height": {
                                            "description": "Height of raster images. Omitted for SVG.",
                                            "type": [
                                                "null",
                                                "integer"
                                            ]
                                        },
                                        "type": {
                                            "description": "Media type",
                                            "type": "string"
                                        },
                                        "url": {
                                            "description": "URL of the media",
                                            "type": "string"
                                        },
                                        "width": {
                                            "description": "Width of raster images. Omitted for SVG.",
                                            "type": [
                                                "null",
                                                "integer"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            "publisher": {
                                "additionalProperties": false,
                                "description": "Only .display-name will be populated initially. Other fields will be added later, to match snap publishers, as the PublisherGW comes online and populates those fields.",
                                "properties": {
                                    "display-name": {
                                        "description": "The publisher's name as a human-readable string.",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "store-url": {
                                "description": "This charm's page in the charmhub store.",
                                "type": "string"
                            },
                            "store-url-old": {
                                "description": "This charm's page in the old, deprecated store.",
                                "type": "string"
                            },
                            "summary": {
                                "description": "One-line description of the charm.",
                                "type": "string"
                            },
                            "title": {
                                "description": "Human-readable name of the charm.",
                                "introduced_at": 34,
                                "type": "string"
                            },
                            "unlisted": {
                                "description": "Indicates whether the charm is visible.",
                                "introduced_at": 49,
                                "type": "boolean"
                            },
                            "used-by": {
                                "description": "Bundles that use this (charms only).",
                                "items": {
                                    "description": "A bundle name",
                                    "type": "string"
                                },
                                "type": "array"
                            },
                            "website": {
                                "description": "External website for the charm.",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        },
                        "type": "object"
                    },
                    "type": {
                        "description": "\"charm\" or \"bundle\".",
                        "enum": [
                            "bundle",
                            "charm"
                        ],
                        "type": "string"
                    }
                },
                "required": [
                    "type",
                    "id",
                    "name"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "required": [
        "results"
    ],
    "type": "object"
}

© 2019 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.