Skip to content

apisspec

galyfray edited this page Oct 14, 2021 · 21 revisions

Javascript API specifications

General rules

  • In any cases, all functions return a JSON with a field named status which value is set as true in case of success. The rest of the messages is specific to each service.
  • In case of failure returned messages are like {status:false, error: {}}. The error content is specified in the JsonAdqlBuilder's page.
  • Table names can be given as qualified names (schema.table) or not (table)
  • Table names are never returned as qualified names (schema.table) but always as simple table names
  • The column descriptors (namely Attribute_Handler) always have the same structure {name, db_name, type, ucd, utype, description, range}
    • Field description:
      • name: Orginal name of the field
      • db_name: Field name as known by the DB. Must be used to set constraints
      • type: data abse type of the attribute (string, int...)
      • ucd: Unified Content Descriptor
      • utype: Model binding
      • descriptor: Text descriptor
      • range: Range of supported values: {min, max} or [val1, val2...]
    • Only db_name and type have always to be set.
    • If no name is given name takes the dn_name value.
    • All fields must be in the response, even the not set ones.
    • Attribute_Handler are managed by a specific JS class.

Connect a TAP service

  • Async Method:
    • connect
  • Action:
    • Connect the TAP service
    • Get all meta data requested to build the JSON map
    • Build the JSON map
  • Params: Dict with the following keys {tapservice, schema, table}
    • tapservice (string): URL of the TAP service
    • schema (string): Schema containing the complex object
    • table (string): Root table of the complex object
  • Return: A dictionary with the action status.
    • Succes: {status: true}
    • Failure: {status:false, error: {}}

Disconnect a TAP service

  • Method:
    • disconnect
  • Action:
    • Disconnect the TAP service
    • Reset all stored data
  • Params: None
  • Return: A dictionary with the action status.
    • Succes: {status: true}
    • Failure: {status:false, error: {}}

TAP service getter

  • Method:
    • getConnector
  • Action:
    • Returns the connection parameters
  • Params: None
  • Return: A dictionary with the action status.
    • Succes: Dict with the following keys {status: true , service: {tapservice, schema, table}} The table does not include the schema name.
    • Failure: {status:false, error: {}}

JSON object map getter

  • Async Method:
    • getObjectMap
  • Action:
    • Returns the JSON map of the current connection
  • Params: None
  • Return: A dictionary with the action status.
    • Succes: {status: true , object_map: {object map}}
    • Failure: {status:false, error: {}}

JSON joined table getter

  • Method:
    • getJoinedTables
  • Params:
    • baseTable (string): Table from which joint table are searched
  • Action:
    • Returns the list of the tables joined with table If table is undefined, the root table is taken as base table.
  • Return: A dictionary with the searched tables. All table names are returned as simple name (without the schema name)
    • Succes: {status: true , base_table: baseTable joined_tables: [table1, .....]}
    • Failure: {status:false, error: {}}

ADQL query getter

DEPRECATED use getTableQuery instead

  • Method:
    • getRootQuery
  • Params:
    • None
  • Action:
    • Returns the ADQL query returning all the ids of the root table filtered by all constraints put on joined tables at any levels
  • Return: A dictionary with the searched tables. All table names are returned as simple names (without the schema name)
    • Succes: {status: true, query: query}
    • Failure: {status:false, error: {}}

ADQL query ids getter

DEPRECATED use getTableSelectedField instead

  • Async Method:
    • getRootQueryIds
  • Params:
    • None
  • Action:
    • Returns the ids returned by the ADQL query on the root table filtered by all constraints put on joined tables at any levels.
  • Return: A status with the id list.
    • Succes: {status: true, root_ids: [id1, id2...]}
    • Failure: {status:false, error: {}}

Root field getter

DEPRECATED use getTableFields instead

  • Async Method:
    • getRootFields
  • Params:
    • None
  • Action:
    • Returns all fields of root table rows returned by the ADQL query on the root table filtered by all constraints put on joined tables at any levels.
  • Return: A status with a list of field value arrays.
    • Succes: {status: true, field_values: [[field1, field2...],[field1, field2...]..]}
    • Failure: {status:false, error: {}}

Selected table's fields query getter

  • Async Method:
    • getTableQuery
  • Params:
    • table: string
    • join_key: any: join key value
  • Action:
    • Returns the ADQL query returning all the selected fiedls of the table filtered by all constraints put on joined tables at any levels
    • if no fields are selected then all know fields used in joins and a list of default fields build by the KT is used
  • Return:
    • Succes: {status: true, query: query}
    • Failure: {status:false, error: {}}

Selected table's fields getter

  • Async Method:
    • getTableSelectedField
  • Params:
    • table: string
    • join_key: any: join key value
  • Action:
    • Returns the selected fields values returned by the ADQL query on table filtered by all constraints put on joint tables at any levels.
    • if no fields are selected then all know fields used in joins and a list of default fields build by the KT is used
  • Return: A status with an id list.
    • Succes: {status: true, field_values: [[field1, field2...],[field1, field2...]..]}
    • Failure: {status:failed, error: {}}

Selected table's fields query getter

  • Async Method:
    • getTableFieldsQuery
  • Params:
    • table: string
    • join_key: any: join key value
  • Action:
    • Returns the ADQL query returning all the fiedls of the table filtered by all constraints put on joined tables at any levels
  • Return:
    • Succes: {status: true, query: query}
    • Failure: {status:false, error: {}}

Table field getter

  • Async Method:
    • getTableFields
  • Params:
    • table: string
    • join_key: any: join key value
  • Action:
    • Returns all fields of the table rows returned by the ADQL query on table filtered by all constraints put on joint tables at any levels.
  • Return: A status with a list of field value arrays.
    • Succes: {status: true, field_values: [[field1, field2...],[field1, field2...]..]}
    • Failure: {status:false, error: {}}

Attribute handler getter

  • Async Method:
    • getTableAttributeHandlers
  • Params:
    • table: string
  • Action:
    • Returns the table attribute handlers.
  • Return: A status with a list of AttributeHandlers.
    • Succes: {status: true, attribute_handlers: [{AH1, {AH2}...]}
    • Failure: {status:false, error: {}}

Constraint setter

  • Method:
    • setTableConstraint
  • Params:
    • table: string : table on which the constraint is set (root table if undefined)
    • constraint: string : ADQ constraint (to be put after a WHERE: no aggregation)
  • Action:
    • Writes the constraint at he right place in the object map.
  • Return: the operation status.
    • Succes: {status: true}
    • Failure: {status:false, error: {}}

Constraint reset

  • Method:
    • resetTableConstraint
  • Params:
    • table: string : table on which the constraint is reset (root table if undefined)
  • Action:
    • Removes the table constraints from the object map.
  • Return: the operation status.
    • Succes: {status: true}
    • Failure: {status:false, error: {}}

All constraint reset

  • Method:
    • resetAllTableConstraint
  • Params: None
  • Action:
    • Removes all constraints on the object map.
  • Return: the operation status.
    • Succes: {status: true}
    • Failure: {status:false, error: {}}