v57

latestOpenAPI 3.1.0LGPLraw.githubusercontent.com2026-08-07158456446.9 KB
search

Returns all infra objects of some type according to a hierarchical query.

Payload

{
    "object": string,
    "query": query,
    "dry": boolean, # default: false
}

Where:

  • object can be any search object declared in search.yml
  • query is a JSON document which can be deserialized into a [search::SearchAst]. Check out examples below.

Response

The response structure depends on the object.

Query language

The query itself is defined using a language made up of nested JSON arrays. It will be parsed and transformed into a PostgreSQL WHERE statement. The language consist of a single boolean expression of comparison statements in prefix notation. For example, the query ["like", ["name"], "%ari%"] will generate a WHERE statement like WHERE "name" LIKE '%ari%'. For more information on the query language itself, check out examples below.

Available functions

See [search::create_processing_context()].

A few query examples

  • The railway station PNO: ["=", ["trigram"], "pno"]
  • The railway stations with either "Paris" or "Lyon" (or both) in their name: ["or", ["search", ["name"], "Paris"], ["search", ["name"], "Lyon"]]
  • All railway stations with "Paris" in their name but not PNO : ["and", ["search", ["name"], "Paris"], ["not", ["=", ["trigram"], "pno"]]]

See [search::SearchAst] for a more detailed view of the query language.

post/search

Query parameters

pageinteger
page_sizeinteger

Request body

dryboolean

Whether to return the SQL query instead of executing it

Only available in debug builds.

object'track' | 'signal' | 'project' | 'study' | 'scenario' | 'trainschedule' | 'operationalpoint' | 'user' required

Object type for query search

Example request

{
  "object": "operationalpoint",
  "query": [
    "and",
    [
      "like",
      [
        "to_string",
        [
          "infra_id"
        ]
      ],
      2
    ],
    [
      "search",
      [
        "name"
      ],
      "plop"
    ]
  ]
}

Response

The search results

Example response

[
  {
    "margins": {
      "values": [
        "5%",
        "2min/100km"
      ]
    },
    "schedule": [
      {
        "arrival": "PT2H",
        "reference_base_arrival": "PT2H",
        "stop_for": "PT2H"
      }
    ]
  }
]