Model Service Admin

read_brand

Introduced in version 21

Summary: GET /v1/brand/<brand_account_id>

Read a brand entity in snapmodels.

URL Parameters

{
    "properties": {
        "fields": {
            "description": "A comma-separated list of fields to retrieve. Available fields: account-id, created-at, created-by, modified-at, modified-by, name.",
            "type": "string"
        }
    },
    "type": "object"
}
  • fields
    • description: A comma-separated list of fields to retrieve. Available fields: account-id, created-at, created-by, modified-at, modified-by, name.

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "account-id": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "modified-at": {
            "type": [
                "string",
                "null"
            ]
        },
        "modified-by": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "display-name": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "email": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "username": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "validation": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "display-name",
                        "id",
                        "username"
                    ],
                    "type": "object"
                },
                {
                    "type": "null"
                }
            ]
        },
        "name": {
            "type": "string"
        }
    },
    "type": "object"
}

update_brand

Introduced in version 21

Summary: PATCH /v1/brand/<brand_account_id>

Update a brand entity in snapmodels.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "name": {
            "type": "string"
        }
    },
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "account-id": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "modified-at": {
            "type": [
                "string",
                "null"
            ]
        },
        "modified-by": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "display-name": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "email": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "username": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "validation": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "display-name",
                        "id",
                        "username"
                    ],
                    "type": "object"
                },
                {
                    "type": "null"
                }
            ]
        },
        "name": {
            "type": "string"
        }
    },
    "required": [
        "account-id",
        "name",
        "created-by",
        "created-at",
        "modified-by",
        "modified-at"
    ],
    "type": "object"
}

delete_brand

Introduced in version 21

Summary: DELETE /v1/brand/<brand_account_id>

Delete a brand entity in snapmodels.

create_model

Introduced in version 22

Summary: POST /v1/brand/<brand_account_id>/model

Create a model under a brand in snapmodels.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "api-key": {
            "type": "string"
        },
        "name": {
            "type": "string"
        },
        "series": {
            "type": "string"
        }
    },
    "required": [
        "name",
        "series"
    ],
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "api-key": {
            "type": [
                "string",
                "null"
            ]
        },
        "brand-account-id": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "modified-at": {
            "type": [
                "string",
                "null"
            ]
        },
        "modified-by": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "display-name": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "email": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "username": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "validation": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "display-name",
                        "id",
                        "username"
                    ],
                    "type": "object"
                },
                {
                    "type": "null"
                }
            ]
        },
        "name": {
            "type": "string"
        },
        "series": {
            "type": "string"
        }
    },
    "required": [
        "brand-account-id",
        "name",
        "series",
        "api-key",
        "created-by",
        "created-at",
        "modified-by",
        "modified-at"
    ],
    "type": "object"
}

read_models

Introduced in version 22

Summary: GET /v1/brand/<brand_account_id>/model

Read the list of models owned by a brand in snapmodels.

The fields query parameter can be used to specify attributes to fetch. If empty, then all attributes are fetched.

URL Parameters

{
    "properties": {
        "fields": {
            "description": "A comma-separated list of fields to retrieve. Available fields: api-key, brand-account-id, created-at, created-by, modified-at, modified-by, name, series.",
            "type": "string"
        }
    },
    "type": "object"
}
  • fields
    • description: A comma-separated list of fields to retrieve. Available fields: api-key, brand-account-id, created-at, created-by, modified-at, modified-by, name, series.

Response JSON Schema

{
    "items": {
        "additionalProperties": false,
        "properties": {
            "api-key": {
                "type": [
                    "string",
                    "null"
                ]
            },
            "brand-account-id": {
                "type": "string"
            },
            "created-at": {
                "type": "string"
            },
            "created-by": {
                "additionalProperties": false,
                "properties": {
                    "display-name": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "email": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "username": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "validation": {
                        "type": "string"
                    }
                },
                "required": [
                    "display-name",
                    "id",
                    "username"
                ],
                "type": "object"
            },
            "modified-at": {
                "type": [
                    "string",
                    "null"
                ]
            },
            "modified-by": {
                "oneOf": [
                    {
                        "additionalProperties": false,
                        "properties": {
                            "display-name": {
                                "oneOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "email": {
                                "type": "string"
                            },
                            "id": {
                                "type": "string"
                            },
                            "username": {
                                "oneOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "validation": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "display-name",
                            "id",
                            "username"
                        ],
                        "type": "object"
                    },
                    {
                        "type": "null"
                    }
                ]
            },
            "name": {
                "type": "string"
            },
            "series": {
                "type": "string"
            }
        },
        "type": "object"
    },
    "type": "array"
}

update_model

Introduced in version 22

Summary: PATCH /v1/brand/<brand_account_id>/model/<model_name>

Update a model in snapmodels. Only series and api_key can be updated.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "api-key": {
            "type": "string"
        },
        "series": {
            "type": "string"
        }
    },
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "api-key": {
            "type": [
                "string",
                "null"
            ]
        },
        "brand-account-id": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "modified-at": {
            "type": [
                "string",
                "null"
            ]
        },
        "modified-by": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "display-name": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "email": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "username": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "validation": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "display-name",
                        "id",
                        "username"
                    ],
                    "type": "object"
                },
                {
                    "type": "null"
                }
            ]
        },
        "name": {
            "type": "string"
        },
        "series": {
            "type": "string"
        }
    },
    "required": [
        "brand-account-id",
        "name",
        "series",
        "api-key",
        "created-by",
        "created-at",
        "modified-by",
        "modified-at"
    ],
    "type": "object"
}

delete_model

Introduced in version 22

Summary: DELETE /v1/brand/<brand_account_id>/model/<model_name>

Delete a model in snapmodels.

create_signing_key

Introduced in version 23

Summary: POST /v1/brand/<brand_account_id>/signing_key

Create a signing key for a brand in snapmodels.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "name": {
            "type": "string"
        }
    },
    "required": [
        "name"
    ],
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "brand-account-id": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "fingerprint": {
            "type": "string"
        },
        "modified-at": {
            "type": [
                "string",
                "null"
            ]
        },
        "modified-by": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "display-name": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "email": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "username": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "validation": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "display-name",
                        "id",
                        "username"
                    ],
                    "type": "object"
                },
                {
                    "type": "null"
                }
            ]
        },
        "name": {
            "type": "string"
        },
        "sha3-384": {
            "type": "string"
        }
    },
    "required": [
        "brand-account-id",
        "name",
        "fingerprint",
        "sha3-384",
        "created-by",
        "created-at",
        "modified-by",
        "modified-at"
    ],
    "type": "object"
}

read_signing_keys

Introduced in version 23

Summary: GET /v1/brand/<brand_account_id>/signing_key

Read the list of signing keys that can be used for a brand in snapmodels.

The fields query parameter can be used to specify attributes to fetch. If empty, then all attributes are fetched.

URL Parameters

{
    "properties": {
        "fields": {
            "description": "A comma-separated list of fields to retrieve. Available fields: brand-account-id, created-at, created-by, fingerprint, modified-at, modified-by, name, sha3-384.",
            "type": "string"
        }
    },
    "type": "object"
}
  • fields
    • description: A comma-separated list of fields to retrieve. Available fields: brand-account-id, created-at, created-by, fingerprint, modified-at, modified-by, name, sha3-384.

Response JSON Schema

{
    "items": {
        "additionalProperties": false,
        "properties": {
            "brand-account-id": {
                "type": "string"
            },
            "created-at": {
                "type": "string"
            },
            "created-by": {
                "additionalProperties": false,
                "properties": {
                    "display-name": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "email": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "username": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "validation": {
                        "type": "string"
                    }
                },
                "required": [
                    "display-name",
                    "id",
                    "username"
                ],
                "type": "object"
            },
            "fingerprint": {
                "type": "string"
            },
            "modified-at": {
                "type": [
                    "string",
                    "null"
                ]
            },
            "modified-by": {
                "oneOf": [
                    {
                        "additionalProperties": false,
                        "properties": {
                            "display-name": {
                                "oneOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "email": {
                                "type": "string"
                            },
                            "id": {
                                "type": "string"
                            },
                            "username": {
                                "oneOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "validation": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "display-name",
                            "id",
                            "username"
                        ],
                        "type": "object"
                    },
                    {
                        "type": "null"
                    }
                ]
            },
            "name": {
                "type": "string"
            },
            "sha3-384": {
                "type": "string"
            }
        },
        "type": "object"
    },
    "type": "array"
}

read_signing_key_account_key_request

Introduced in version 26

Summary: POST /v1/brand/<brand_account_id>/signing_key/<signing_key_sha3_384>/account-key-request

Get an account-key-request for the given signing key.

In on-prem/offline scenarios, we are unable to create an account-key with SAS using the Canonical root key. So we allow an admin to get an account-key-request assertion that can be registered in an online environment. The new account-key assertion can then be pushed to SAS on the proxy host, allowing things like serial signing to work as expected. This approach is preferred as it allows for remote administration of the proxy, without needing access to the HSM on the proxy host.

update_signing_key

Introduced in version 23

Summary: PATCH /v1/brand/<brand_account_id>/signing_key/<signing_key_sha3_384>

Update a signing key in snapmodels. Only its descriptive name can be updated.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "name": {
            "type": "string"
        }
    },
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "brand-account-id": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "fingerprint": {
            "type": "string"
        },
        "modified-at": {
            "type": [
                "string",
                "null"
            ]
        },
        "modified-by": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "properties": {
                        "display-name": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "email": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "username": {
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "validation": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "display-name",
                        "id",
                        "username"
                    ],
                    "type": "object"
                },
                {
                    "type": "null"
                }
            ]
        },
        "name": {
            "type": "string"
        },
        "sha3-384": {
            "type": "string"
        }
    },
    "required": [
        "brand-account-id",
        "name",
        "fingerprint",
        "sha3-384",
        "created-by",
        "created-at",
        "modified-by",
        "modified-at"
    ],
    "type": "object"
}

delete_signing_key

Introduced in version 23

Summary: DELETE /v1/brand/<brand_account_id>/signing_key/<signing_key_sha3_384>

Delete a signing_key in snapmodels. Key revocation in snapassert handled by snapmodels.

create_serial_policy

Introduced in version 24

Summary: POST /v1/brand/<brand_account_id>/model/<model_name>/serial_policy

Create a serial policy for a model in snapmodels.

Request JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "signing-key-sha3-384": {
            "type": "string"
        }
    },
    "required": [
        "signing-key-sha3-384"
    ],
    "type": "object"
}

Response JSON Schema

{
    "additionalProperties": false,
    "properties": {
        "authority": {
            "type": "string"
        },
        "created-at": {
            "type": "string"
        },
        "created-by": {
            "additionalProperties": false,
            "properties": {
                "display-name": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "username": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "validation": {
                    "type": "string"
                }
            },
            "required": [
                "display-name",
                "id",
                "username"
            ],
            "type": "object"
        },
        "model-name": {
            "type": "string"
        },
        "revision": {
            "type": "integer"
        },
        "signing-key-sha3-384": {
            "type": "string"
        }
    },
    "required": [
        "model-name",
        "revision",
        "signing-key-sha3-384",
        "authority",
        "created-by",
        "created-at"
    ],
    "type": "object"
}

read_serial_policies

Introduced in version 24

Summary: GET /v1/brand/<brand_account_id>/model/<model_name>/serial_policy

Read the list of serial policies associated with a model in snapmodels.

The fields query parameter can be used to specify attributes to fetch. If empty, then all attributes are fetched.

URL Parameters

{
    "properties": {
        "fields": {
            "description": "A comma-separated list of fields to retrieve. Available fields: authority, created-at, created-by, model-name, revision, signing-key-sha3-384.",
            "type": "string"
        }
    },
    "type": "object"
}
  • fields
    • description: A comma-separated list of fields to retrieve. Available fields: authority, created-at, created-by, model-name, revision, signing-key-sha3-384.

Response JSON Schema

{
    "items": {
        "additionalProperties": false,
        "properties": {
            "authority": {
                "type": "string"
            },
            "created-at": {
                "type": "string"
            },
            "created-by": {
                "additionalProperties": false,
                "properties": {
                    "display-name": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "email": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "username": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "validation": {
                        "type": "string"
                    }
                },
                "required": [
                    "display-name",
                    "id",
                    "username"
                ],
                "type": "object"
            },
            "model-name": {
                "type": "string"
            },
            "revision": {
                "type": "integer"
            },
            "signing-key-sha3-384": {
                "type": "string"
            }
        },
        "type": "object"
    },
    "type": "array"
}

delete_serial_policy

Introduced in version 24

Summary: DELETE /v1/brand/<brand_account_id>/model/<model_name>/serial_policy/<serial_policy_rev>

Delete a model's serial policy in snapmodels.

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