Skip to content

GetScripts

Info

GET https://{some_domain}/scripts

Returns the list of user scripts for a given account (login).

Authorization

All requests must include a JWT token:

Authorization: <JWT_TOKEN>

Allowed roles: USER, MANAGER, ADMIN, DEALER.

Request

Content-Type: application/json

Note: Some HTTP clients (e.g., browser fetch) do not send a body with GET requests.
If your client cannot send a JSON body, pass login as a query parameter:
GET /scripts?login=1001

Body Parameters

Field Type Required Description
login int Yes Account login to fetch scripts

Response

Success (200)

{
  "rows": [
    {
      "id": 42,
      "login": 1001,
      "name": "MorningScalper",
      "script": "print('hi')",
      "type": "private",
      "autostart": 1
    }
  ]
}

Error Responses

Code Error Description
400 INVALID_DATA Validation failed (missing/incorrect login)

Example

Request

GET https://{some_domain}/scripts
Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
  "login": 1001
}

Examples

curl -X GET "https://{some_domain}/scripts"       -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."       -H "Content-Type: application/json"       --data-raw '{
    "login": 1001
  }'
const url = "https://{some_domain}/scripts?login=1001";
const jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";

async function getScripts() {
  const resp = await fetch(url, {
    method: "GET",
    headers: {
      "Authorization": jwt
    }
  });

  console.log("Status:", resp.status);
  const data = await resp.json().catch(() => ({}));
  console.log("Body:", data);
}

getScripts().catch(console.error);
<?php
$url = "https://{some_domain}/scripts";
$jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";

$payload = [ "login" => 1001 ];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: " . $jwt,
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($response === false) {
    $error = curl_error($ch);
    curl_close($ch);
    throw new RuntimeException("cURL error: " . $error);
}
curl_close($ch);

header("Content-Type: application/json");
echo json_encode([
    "status" => $httpCode,
    "body" => json_decode($response, true)
], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);