Package an existing service specification
POST/service_specification/:id/package
Create a package from a service specification that doesn't belong to a package yet. The server assembles the bill of materials for you, in a single database transaction:
- Pins the specification, each of its action specifications, each of its link specifications and each link's action specifications to a snapshot. An entity whose current content matches its latest snapshot reuses that snapshot; otherwise, including an entity with no snapshot yet, a new snapshot is minted.
- Resolves
sources. An inline source (typeandmeta) registers the artifact, or a new revision of it, undernrn. A referenced source (artifact_id) pins an existing artifact atrevision_id, or at its newest revision when you omit it. - Creates the package and its first revision with these components:
spec: the service specification.- One component per source, named after the source (
sourcewhen there's a single unnamed source). - One component per action specification, named after its slug.
- One component per link specification, named after its slug.
- One component per link action specification, named
<link slug>:<action slug>.
The package's name and slug default to the specification's, and visible_to defaults to [nrn]. The response is the same package POST /packages returns.
ℹ️ Note:
nrnmust be concrete (no wildcards). The request fails with409when the specification already belongs to a package; to publish a new revision of that package, usePATCH /packages/{id}.
Request
Responses
- 200
- 409
- 4XX
- 5XX
The created package.
The service specification already belongs to a package.
Client error responses due to invalid input, missing parameters or insufficient permissions.
Server error responses.