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 http://localhost:5000/api/v1/resources/do_nothing

This endpoint does nothing. It can be used to test if the API is running.

Example usage to use session cookies:


        curl --head -c cookies.txt http://localhost:5000/api/v1/resources/do_nothing
        curl -b cookies.txt http://localhost:5000/api/v1/resources/derivation/create
    

GET http://localhost:5000/api/v1/resources/register_csrf

This endpoint generates a CSRF token. However, CSRF is disabled for the API endpoints. This endpoint should not be necessary for API use, see here for API authentication.

Example usage:

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

Response:


    {
        "csrf token": "some token"
    }
    

GET http://localhost:5000/api/v1/resources/derivation/list

This endpoint retrieves a list of all derivations.

Example usage:

curl -s http://localhost:5000/api/v1/resources/derivation/list | 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 http://localhost:5000/api/v1/resources/inference_rule/list

This endpoint retrieves a list of all inference rules.

Example usage:

curl -s http://localhost:5000/api/v1/resources/inference_rule/list | 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 http://localhost:5000/api/v1/resources/symbol/operation/list

This endpoint retrieves a list of all operation symbols.

Example usage:

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

Response:


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

GET http://localhost:5000/api/v1/resources/symbol/relation/list

This endpoint retrieves a list of all relation symbols.

Example usage:

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

Response:


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

GET http://localhost:5000/api/v1/resources/symbol/scalar/list

This endpoint retrieves a list of all scalar symbols.

Example usage:

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

Response:


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

GET http://localhost:5000/api/v1/resources/symbol/vector/list

This endpoint retrieves a list of all vector symbols.

Example usage:

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

Response:


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

GET http://localhost:5000/api/v1/resources/symbol/matrix/list

This endpoint retrieves a list of all matrix symbols.

Example usage:

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

Response:


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

GET http://localhost:5000/api/v1/resources/expression/list

This endpoint retrieves a list of all expressions.

Example usage:

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

Response:


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

GET http://localhost:5000/api/v1/resources/derivation/metadata

This endpoint retrieves the metadata of a specified derivation.

Required parameter:

Example usage:

curl -s http://localhost:5000/api/v1/resources/derivation/metadata?derivation_id=3445848 | 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 http://localhost:5000/api/v1/resources/derivation/step/list

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

Required parameter:

Example usage:

curl -s http://localhost:5000/api/v1/resources/derivation/step/list?derivation_id=3445848 | 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 http://localhost:5000/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:5000/api/v1/resources/cypher/?query=MATCH\(n\)%20RETURN%20DISTINCT%20labels\(n\) | python3 -m json.tool

POST http://localhost:5000/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:5000/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:5000/api/v1/resources/derivation/create
    

Response:


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

POST http://localhost:5000/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:5000/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:5000/api/v1/resources/expression/create | 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:5000/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:5000/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:5000/api/v1/resources/symbol/scalar/create | python3 -m json.tool
    

Response:


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

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

This endpoint creates a new vector symbol. Not implemented.

Example usage:

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

Response:


        {
            "STATUS": "TODO"
        }
    

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

This endpoint creates a new matrix symbol. Not implemented.

Example usage:

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

Response:


        {
            "STATUS": "TODO"
        }
    

POST http://localhost:5000/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:5000/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:5000/api/v1/resources/symbol/operation/create | python3 -m json.tool
    

Response:


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

POST http://localhost:5000/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:5000/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:5000/api/v1/resources/symbol/relation/create | python3 -m json.tool
    

Response:


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

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

This endpoint creates a new inference rule. Not implemented.

Example usage:

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

Response:


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

POST http://localhost:5000/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:5000/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:5000/api/v1/resources/derivation/delete
    

Response:


        {
            "STATUS": "successfully deleted"
        }
    

POST http://localhost:5000/api/v1/resources/expression/delete

This endpoint deletes an expression. Not implemented.

Response:


        {
            "STATUS": "TODO"
        }