API Documentation for the Physics Derivation Graph

navigation / documentation overview / API documentation

This document provides information on how to use the Physics Derivation Graph API using curl. All API endpoints are prefixed with /api.

API Endpoints: GET

GET /api/v1/

Entry point for the API using Hypermedia as the Engine of Application State (HATEOAS)

Uses HAL format.

curl --silent --insecure http://localhost/api/v1/
    

GET /api/v1/resources/derivations

This endpoint retrieves a list of all derivations.

Example usage:

curl -s http://localhost/api/v1/resources/derivations | python3 -m json.tool

Response:

[
    {
        "abstract_latex": "my summary",
        "author_name_latex": "ben",
        "created_datetime": "2024-05-19_21-16-29-085813",
        "id": "3445848",
        "name_latex": "this is a new derivation"
    }
]
    

GET /api/v1/resources/inference_rules

This endpoint retrieves a list of all inference rules.

Example usage:

curl -s http://localhost/api/v1/resources/inference_rules | python3 -m json.tool

Response:

[
    {
        "author_name_latex": "ben",
        "id": "7681529",
        "latex": "ADD _ to BOTH sides",
        "name_latex": "add x to both sides",
        "number_of_feeds": 1,
        "number_of_inputs": 1,
        "number_of_outputs": 1
    }
]
    

GET /api/v1/resources/symbol/operations

This endpoint retrieves a list of all operation symbols.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/operations | python3 -m json.tool

Response:

[
    {
        "argument_count": 2,
        "author_name_latex": "ben",
        "description_latex": "",
        "id": "7052411",
        "latex": "=",
        "name_latex": "equals",
        "requires_arguments": true
    }
]
    

GET /api/v1/resources/symbol/relations

This endpoint retrieves a list of all relation symbols.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/relations | python3 -m json.tool

Response:

    [
        {
            "author_name_latex": "ben",
            "description_latex": "...",
            "id": "7052411",
            "latex": "=",
            "name_latex": "equals",
        }
    ]
    

GET /api/v1/resources/symbol/scalars

This endpoint retrieves a list of all scalar symbols.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/scalars | python3 -m json.tool

Response:

    [
        {
            "argument_count": 2,
            "author_name_latex": "ben",
            "description_latex": "",
            "id": "7052411",
            "latex": "=",
            "name_latex": "equals",
            "requires_arguments": true
        }
    ]
    

GET /api/v1/resources/symbol/vectors

This endpoint retrieves a list of all vector symbols.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/vectors | python3 -m json.tool

Response:

    [
        {
            "argument_count": 2,
            "author_name_latex": "ben",
            "description_latex": "",
            "id": "7052411",
            "latex": "=",
            "name_latex": "equals",
            "requires_arguments": true
        }
    ]
    

GET /api/v1/resources/symbol/matrices

This endpoint retrieves a list of all matrix symbols.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/matrices | python3 -m json.tool

Response:

    [
        {
            "argument_count": 2,
            "author_name_latex": "ben",
            "description_latex": "",
            "id": "7052411",
            "latex": "=",
            "name_latex": "equals",
            "requires_arguments": true
        }
    ]
    

GET /api/v1/resources/expressions

This endpoint retrieves a list of all expressions.

Example usage:

curl -s http://localhost/api/v1/resources/expressions | python3 -m json.tool

Response:

    [
        {
            "author_name_latex": "ben",
            "description_latex": "",
            "id": "1852486",
            "latex": "a+b=2",
            "name_latex": ""
        },
    ]
    

GET /api/v1/resources/derivation/3445848/metadata

This endpoint retrieves the metadata of a specified derivation.

Required parameter:

Example usage:

curl -s http://localhost/api/v1/resources/derivation/3445848/metadata | python3 -m json.tool

Response:

    {
        "abstract_latex": "my summary",
        "author_name_latex": "ben",
        "created_datetime": "2024-05-19_21-16-29-085813",
        "id": "3445848",
        "name_latex": "this is a new derivation"
    }
    

GET /api/v1/resources/derivation/3445848/steps

This endpoint retrieves a list of steps in a specified derivation.

Required parameter:

Example usage:

curl -s http://localhost/api/v1/resources/derivation/3445848/steps | python3 -m json.tool

Response:

    [
        {
            "author_name_latex": "benno",
            "created_datetime": "2024-05-19_23-23-11-337900",
            "id": "1800596",
            "note_after_step_latex": "",
            "note_before_step_latex": ""
        }
    ]
    

GET /api/v1/resources/cypher/

This endpoint allows users to send arbitrary Cypher queries. Use this endpoint with caution.

Required parameter:

Example usage:

curl -s http://localhost/api/v1/resources/cypher/ | python3 -m json.tool

POST http://localhost/api/v1/resources/derivation/create

This endpoint creates a new derivation.

Required parameters:

Optional parameters:

Example usage (x-www-form-urlencoded):

    curl --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --show-error --silent \
     http://localhost/api/v1/resources/derivation/create?derivation_name_latex=hello%20again\&derivation_reference_latex=this%20is\&derivation_abstract_latex=mine%20yours
    

Example usage (application/json):

    curl --request POST \
    --header "Content-Type: application/json" \
    --show-error --silent \
    --data '{"derivation_name_latex":"hello again", "derivation_reference_latex":"this was", "derivation_abstract_latex": "yes no"}' \
     http://localhost/api/v1/resources/derivation/create
    

Response:

    {
        "STATUS": "derivation 'derivation_name' added successfully"
    }
    

POST http://localhost/api/v1/resources/expression/create

This endpoint creates a new expression.

Required parameters:

Optional parameters:

Example usage (x-www-form-urlencoded):

    curl --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --show-error --silent \
    http://localhost/api/v1/resources/expression/create?expression_latex_lhs=4*2\&expression_relation_latex==\&expression_latex_rhs=9
    

Example usage (application/json):

      curl --request POST \
    --header "Content-Type: application/json" \
    --show-error --silent \
    --data '{"expression_latex_lhs": "4^3", "expression_relation_latex": "=", "expression_latex_rhs": "k"}' \
     http://localhost/api/v1/resources/expression | python3 -m json.tool
    

Response:

    {
        "STATUS": "expression added successfully",
        "query times": {
            "to_add_expression: list_nodes_of_type": 0.011,
            "pdg_app/to_add_expression: add_expression": 0.002
        }
    }
    

POST http://localhost/api/v1/resources/symbol/scalar/create

This endpoint creates a new scalar symbol.

Required parameters:

Optional parameters:

Example usage (x-www-form-urlencoded):

    curl --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --show-error --silent \
    http://localhost/api/v1/resources/symbol/scalar/create?scalar_latex=a&scalar_scope=arbitrary&dimension_length=1&dimension_time=-2
    

Example usage (application/json):

curl --request POST \
    --header "Content-Type: application/json" \
    --show-error --silent \
    --data '{"scalar_latex": "b", "scalar_scope":"local", "dimension_mass":1}' \
     http://localhost/api/v1/resources/symbol/scalar | python3 -m json.tool
    

Response:

     {
        "STATUS": "scalar symbol added successfully",
        "query times": {}
    }
     

POST http://localhost/api/v1/resources/symbol/vector/create

This endpoint creates a new vector symbol. Not implemented.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/vector/create

Response:

{
    "STATUS": "TODO"
}
    

POST http://localhost/api/v1/resources/symbol/matrix/create

This endpoint creates a new matrix symbol. Not implemented.

Example usage:

curl -s http://localhost/api/v1/resources/symbol/matrix/create

Response:

{
    "STATUS": "TODO"
}
    

POST http://localhost/api/v1/resources/symbol/operation/create

This endpoint creates a new operation symbol.

Required parameters:

Optional parameters:

Example usage:

curl --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --show-error --silent \
     http://localhost/api/v1/resources/symbol/operation/create?operation_name_latex=equals&operation_latex==&operation_description_latex=equality&operation_argument_count=2
    
curl --request POST \
    --header "Content-Type: application/json" \
    --show-error --silent \
    --data '{"operation_name_latex":"equals", "operation_latex":"=", "operation_description_latex": "equality", "operation_argument_count": 2}' \
     http://localhost/api/v1/resources/symbol/operation | python3 -m json.tool
    

Response:

{
    "STATUS": "operation symbol added successfully",
    "query times": {}
}
    

POST http://localhost/api/v1/resources/symbol/relation/create

This endpoint creates a new relation symbol.

Required parameters:

Optional parameters:

Example usage:

curl --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --show-error --silent \
     http://localhost/api/v1/resources/symbol/relation/create?relation_name_latex=equal&relation_latex==&relation_description_latex=equality
    
curl --request POST \
    --header "Content-Type: application/json" \
    --show-error --silent \
    --data '{"relation_name_latex":"equal", "relation_latex":"=", "relation_description_latex": "equality"}' \
     http://localhost/api/v1/resources/symbol/relation | python3 -m json.tool
    

Response:

{
"STATUS": "relation symbol added successfully",
"query times": {}
}
    

POST http://localhost/api/v1/resources/inference_rule/create

This endpoint creates a new inference rule. Not implemented.

Example usage:

curl -s http://localhost/api/v1/resources/inference_rule/create

Response:

{
    "STATUS": "inference rule added successfully",
    "query times": {}
}
    

DELETE http://localhost/api/v1/resources/derivation/delete

This endpoint deletes a specified derivation and all its steps.

Required parameters:

Example usage:

curl --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --show-error --silent \
    http://localhost/api/v1/resources/derivation/delete?derivation_id=3445848
    
curl --request POST \
    --header "Content-Type: application/json" \
    --show-error --silent \
    --data '{"derivation_id":"3445848"}' \
    http://localhost/api/v1/resources/derivation/delete
    

Response:

{
    "STATUS": "successfully deleted"
}
    

DELETE http://localhost/api/v1/resources/expression/delete

This endpoint deletes an expression. Not implemented.

Response:

{
    "STATUS": "TODO"
}