Add to your library
/library/{author}/{slug}Adds another author's indicator or definition to your library, together with the scripts it reads, as Add to library does in the app. Their script runs for you only once it is in your library, so call this before you run it.
Scope | Heavy call | Long poll | CLI |
|---|---|---|---|
| No | No |
|
Guidance
Adding is a two-step agreement. Call Check what a script needs, show the person what will be added, and only if they agree send this request with
confirmlisting every ref in itsconfirm. A request whoseconfirmleaves any of them out adds nothing and answers409 confirmation_requiredwith the list, so you can show it and ask.Everything it needs is added together, or nothing is. You cannot add the script without the scripts it reads.
Adding never copies anything. Each script stays its author's, picks up their edits, and you can take it out again with Remove from your library.
When something it needs is not shared with you, nothing is added:
409 not_shared, withdetails.cannot_addnaming it.Your own scripts, Chartnaut's built-ins and scripts you already added are usable as they are. Adding one answers
200withadded: falseand thereason, and changes nothing, so a retry is safe.Studies cannot be added:
409 not_installable. Only your own studies run.A ref in
confirmthat the script does not need is ignored and reported inskippedwith the reasonnot_a_dependency.@Non aconfirmentry is dropped;@Nin the path is refused with400.
Path parameters
Name | Type | Description |
|---|---|---|
| string | The author's username, in any letter case |
| string | The script's slug, without |
Query parameters
Name | Type | Required | Default | Description |
|---|---|---|---|---|
| string | No | None |
|
Request body
Optional. With no body, or an empty confirm, only a script that needs nothing else is added.
Field | Type | Required | Description |
|---|---|---|---|
| array of string | When it needs other scripts | The refs the person agreed to add: every ref in |
Response
201 when it was added, 200 when it was usable already. Both carry these fields.
Field | Type | Description |
|---|---|---|
| boolean |
|
| object | The script: |
| array of string | The refs added along with it. |
| array of object |
|
| string | Only when |
Status codes
Status | Code | Meaning |
|---|---|---|
| - | Added, with everything in |
| - | Already usable: yours, a built-in, or already in your library. Nothing changed |
|
| The body is not JSON, the path has |
|
| No script by that author and slug that you can see |
|
| It needs scripts that |
|
| Something it needs is not shared with you, so it cannot be added. |
|
| It is a study. Studies cannot be added to a library |
|
| The author has more than one script with that slug. Add |
