Add another author's script to your library, with the scripts it needs
/library/{author}/{slug}- Base URL
https://api.chartnaut.com/v1- Auth
- Bearer key
- Operation ID
addToLibrary
Another author's indicator or definition runs only once it is in your library, as in the app. Adding it also adds the scripts it reads that you have not added, all or nothing. Adding never copies anything: each script stays its author's, tracks their edits, and can be removed at any time.
The agreement step: call getLibraryRequirements, show the person what will be added, and
only if they agree send confirm listing every ref in its confirm. A confirm that leaves
any out adds nothing and answers 409 confirmation_required with details.needs,
details.confirm and details.missing.
Already usable (your own, a built-in, or already added): 200 with added: false and
reason; nothing changes. A dependency not shared with you: 409 not_shared with
details.cannot_add. A study: 409 not_installable. @N in the path is refused (400): a
library entry is the live script.
Path parameters#
authorstringRequiredThe author's username (or me / chartnaut where allowed), in any letter case.
slugstringRequiredThe script's slug. No @N; a library entry is the live script.
Query parameters#
kindstringWhen the author has an indicator and a definition with that slug.
Request bodyapplication/json, optional#
confirmarray of stringThe refs the person agreed to add. Must include every ref in the requirements' confirm. @N is dropped.
Responses#
200OKapplication/json
Already usable. Nothing changed; added is false and reason says why.
addedbooleanRequiredTrue when this call added it.
Show fields
refstringRequirednamestringRequiredauthorstringLowercase username, or chartnaut. Omitted on a requirements root.
installable: adding the root adds it. installed: already in your library. owned: yours.
builtin: Chartnaut's. unavailable: not shared with you. not_installable: a study root.
added_witharray of stringRequiredRefs added along with it.
skippedarray of objectRequiredconfirm entries not added, with not_a_dependency or the status that made them unnecessary.
Show item fields
refstringreasonstringreasonstringOnly when added is false: why nothing changed.
201Createdapplication/json
Added, with everything in added_with.
addedbooleanRequiredTrue when this call added it.
Show fields
refstringRequirednamestringRequiredauthorstringLowercase username, or chartnaut. Omitted on a requirements root.
installable: adding the root adds it. installed: already in your library. owned: yours.
builtin: Chartnaut's. unavailable: not shared with you. not_installable: a study root.
added_witharray of stringRequiredRefs added along with it.
skippedarray of objectRequiredconfirm entries not added, with not_a_dependency or the status that made them unnecessary.
Show item fields
refstringreasonstringreasonstringOnly when added is false: why nothing changed.
400Bad requestapplication/json
invalid_request: the body is not JSON, the path has @N, or kind is not valid.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring404Not foundapplication/json
not_found: no script by that author and slug the caller can see.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring409Conflictapplication/json
confirmation_required: confirm does not list every script that would be added
(details: needs, confirm, missing). not_shared: something it needs is not shared
with you (details: cannot_add). not_installable: studies cannot be added. conflict:
pass kind.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstringErrorAny other statusapplication/json
Error.
errorobjectRequiredShow fields
codestringRequiredStable. Branch on this, never on message.
messagestringRequireddetailsobjectdocs_urlstring (uri)request_idstring