ChartnautDocs

Get a script

GET/scripts/{slug}

Returns one of your scripts at its latest version, or at the version in slug@N, with what Chartnaut read from its code and, on request, its source.

Scope

Heavy call

Long poll

CLI

scripts:read

No

No

chartnaut pull

Guidance

  • Add include=source to get files. Without it the response has the Interface and dependencies but no code.

  • Before you edit and save, read the script and keep its latest_version: that is the base_version Save a script version needs.

  • slug@N returns version N exactly as it was saved. A version never changes, so my-ema@3 is safe to cache.

  • Indicators and definitions share one set of slugs across Chartnaut, but one of your studies can have the same slug as one of your indicators or definitions. Then this call answers 409 conflict until you add kind.

  • A path slug is 1 to 128 characters: lowercase letters, digits, hyphens and underscores, starting with a letter or digit. It is matched in any letter case.

  • Only your own scripts can be read here. Someone else's script answers 404: Get a library script describes it, without its source.

Path parameters

Name

Type

Description

slug

string

Your script's slug, or slug@N for version N

Query parameters

Name

Type

Required

Default

Description

include

string

No

None

source adds files

kind

string

No

None

indicator, definition or study, when a study shares the slug

Response

200 with a Script.

Status codes

Status

Code

Meaning

200

-

The script at the version asked for

400

invalid_request

The slug or version in the path is not valid

404

not_found

You have no script with that slug, or it has no version N

409

conflict

A study shares the slug. Add kind