Skip to content

Who publishes a library: its repository, or its page

PUT
/orgs/{org}/libraries/{namespace}/management
curl --request PUT \
--url https://api.sloose.com/orgs/org_9f3c/libraries/acme/management \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "managedBy": "sdk", "libraryId": "example" }'

Takes a library its configuration repository publishes over in the browser (managedBy: null), or lets the repository manage one again (managedBy: "sdk"). Nothing is published either way: the current version stays current. Taken over, the library is published on its page, and a push leaves it alone, saying so in its warnings. Handed back, its page is read only and the next push publishes whatever the repository holds.

Each change is recorded on Formulas & helpers’ recent changes in the same transaction as the change itself, so a request that changes nothing — the library is already managed that way — records nothing and answers changed: false. An administrator’s decision, made in a browser: an API token cannot make it. It moves no configuration version, since who publishes a library is not in the resolved configuration.

org
required

The organisation id the session was issued for. A token for one organisation can never read another.

string
Example
org_9f3c

The organisation id the session was issued for. A token for one organisation can never read another.

namespace
required

The library namespace, as it appears in expressions.

string
Example
acme

The library namespace, as it appears in expressions.

Media typeapplication/json
object
managedBy
required

Who publishes it from now on: sdk, the organisation’s configuration repository — its page is read only, and its next push publishes it — or null, its page, where a push leaves it alone and says so.

string | null
Allowed values: sdk
libraryId

The library the page read (libraryId on the library), which the move then lands on and nothing else: one removed and published again under the name since is another library, and the move is refused 409 LIBRARY_REPLACED rather than made on a library the person never saw. The app always sends it.

string

The library as it now stands.

Media typeapplication/json
object
library
required
object
namespace
required
string
libraryId
required

The library’s own id. A name removed and published again is another library under a new id (#1040), so a page that changes who publishes it names this (PUT …/management), and an import’s kept version names it too (LibraryPin.library).

string
version
required

The manifest’s own semver: the author’s label, not which publish this is.

string
versionNumber
required

Which publish is current: 3 for v3 (…/versions). 0 for a library stored before versions were kept.

number
scope
required
string
Allowed values: global org
manifest
required
object
key
additional properties
source

The module as written, when the route answers it (?source=true on the list).

string
managedBy
required

sdk when the organisation’s configuration repository publishes it: its page is read only, and a person publishing, restoring or removing it is refused (409 LIBRARY_MANAGED) until it is taken over (PUT …/management), while an API token, which publishes as the repository, may. Null when people publish it on its page, where a push leaves it alone and says so and an API token is refused. A library a push or a token makes is the repository’s.

string | null
Allowed values: sdk
updatedAt
required
string
changed
required

Whether it moved. False when it was already managed that way.

boolean
Example
{
"library": {
"scope": "global",
"managedBy": "sdk"
}
}

The request — its body or its query — did not match the schema. issues carries the Zod issue list.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

No bearer, or one that no longer resolves: a session that is unknown or expired (code: AUTH_REQUIRED), or an API token that was revoked or expired (TOKEN_REVOKED, TOKEN_EXPIRED), whose organisation is gone (ORG_NOT_FOUND) or whose member or user row is (MEMBERSHIP_GONE).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

An API token was used, the role is too low, the bearer was issued for another organisation, or the session is a staff member’s view of the organisation: a read-only one as on any write (IMPERSONATION_READ_ONLY), and a write-capable one handing the library to the repository (IMPERSONATION_REFUSED), since every API token of the organisation could then publish, restore and remove it after the view had ended. Like every route behind a session: a session signed in but in no organisation is refused code: NO_ORG, a banned person code: BANNED, and a closed organisation code: ORG_CLOSED.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

No such library, or it is not visible to this session.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

The library libraryId names is not the one under this name any more: it was removed and published again since it was read. Nothing was moved.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed values: LIBRARY_REPLACED
key
additional properties
Example
{
"code": "LIBRARY_REPLACED"
}

The restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed value: MAINTENANCE
Example
{
"code": "MAINTENANCE"
}
Retry-After
integer

Seconds until asking again is worth it (300 while the switch is on).

Report a problem with this page

sloose.com