Who publishes a library: its repository, or its page
const url = 'https://api.sloose.com/orgs/org_9f3c/libraries/acme/management';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"managedBy":"sdk","libraryId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The org id the session was issued for. A token for one org can never read another.
Example
org_9f3cThe org id the session was issued for. A token for one org can never read another.
The library namespace, as it appears in expressions.
Example
acmeThe library namespace, as it appears in expressions.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Who publishes it from now on: sdk, the org’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.
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.
Responses
Section titled “Responses”The library as it now stands.
object
object
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).
The manifest’s own semver: the author’s label, not which publish this is.
Which publish is current: 3 for v3 (…/versions). 0 for a library stored before versions were kept.
object
The module as written, when the route answers it (?source=true on the list).
sdk when the org’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.
Whether it moved. False when it was already managed that way.
Example
{ "library": { "scope": "global", "managedBy": "sdk" }}The request — its body or its query — did not match the schema. issues carries the Zod issue list.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}An API token was used, the role is too low, the bearer was issued for another org, or the session is a staff member’s view of the org: 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 org could then publish, restore and remove it after the view had ended.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No such library, or it is not visible to this session.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
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.
object
Example
{ "code": "LIBRARY_REPLACED"}