stats_service

Send query to stats service

post/api/v1/services/stats/query

Query parameters

chain'mainnet' | 'testnet'

chain

Request body

project_idinteger required
namestring
querystring
gpt_messagestring
repeat_intervalinteger

cyclic execution of requests

Example request

{
  "project_id": 1647024163,
  "name": "test query",
  "query": "select id from test",
  "gpt_message": "give me random id from accounts table",
  "repeat_interval": 10
}

Response

Query result

idstring required
namestring
status'executing' | 'success' | 'error' required
type'graph' | 'base_query' | 'chat_gpt_query'
urlstring
meta_urlstring
spent_timeinteger
last_repeat_dateinteger
total_repetitionsinteger
total_usd_costnumber
usd_costnumber
errorstring
all_data_in_previewboolean
testnetboolean required
is_gptboolean
date_createinteger required

Example response

{
  "id": "03cfc582-b1c3-410a-a9a7-1f3afe326b3b",
  "name": "test query",
  "query": {
    "name": "test query",
    "sql": "select id from accounts limit 1",
    "gpt_message": "give me random id from accounts table",
    "repeat_interval": 10
  },
  "url": "https://sql.io/123.csv",
  "meta_url": "https://sql.io/123_meta.csv",
  "spent_time": 100,
  "last_repeat_date": 1690889913000,
  "total_repetitions": 5,
  "total_usd_cost": 1000000000,
  "usd_cost": 1000000000,
  "error": "invalid something",
  "date_create": 1690889913000
}

Changes

Changed in 13 of the 50 revisions of this API.3329

    • added the non-success response with the status 402

      response-non-success-status-added

  • 356252841f50123See the full diff
    • removed the required property estimate/approximate_cost from the response with the 201 status

      response-required-property-removed

    • removed the optional property cost from the response with the 201 status

      response-optional-property-removed

    • removed the optional property total_cost from the response with the 201 status

      response-optional-property-removed

    • added the optional property total_usd_cost to the response with the 201 status

      response-optional-property-added

    • added the optional property usd_cost to the response with the 201 status

      response-optional-property-added

    • added the required property estimate/approximate_usd_cost to the response with the 201 status

      response-required-property-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added the non-success response with the status 409

      response-non-success-status-added

    • added the new optional request property name

      new-optional-request-property

    • added the optional property name to the response with the 201 status

      response-optional-property-added

    • added the optional property query/name to the response with the 201 status

      response-optional-property-added

    • added the new optional query request parameter chain

      new-optional-request-parameter

    • added the required property testnet to the response with the 201 status

      response-required-property-added

    • added the new chat_gpt_query enum value to the type response property for the response status 201

      response-property-enum-value-added

    • added the optional property last_repeat_date to the response with the 201 status

      response-optional-property-added

    • added the optional property total_cost to the response with the 201 status

      response-optional-property-added

    • added the optional property total_repetitions to the response with the 201 status

      response-optional-property-added

    • added the optional property estimate/explain to the response with the 201 status

      response-optional-property-added

    • added the new optional request property gpt_message

      new-optional-request-property

    • the request property query became optional

      request-property-became-optional

    • added the optional property is_gpt to the response with the 201 status

      response-optional-property-added

    • added the optional property query/gpt_message to the response with the 201 status

      response-optional-property-added

    • added the optional property query/repeat_interval to the response with the 201 status

      response-optional-property-added