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.
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
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"
}
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"
}
]
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
}
]
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
}
]
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",
}
]
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
}
]
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
}
]
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
}
]
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": ""
},
]
This endpoint retrieves the metadata of a specified derivation.
Required parameter:
derivation_id: The ID of the derivation to retrieve.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"
}
This endpoint retrieves a list of steps in a specified derivation.
Required parameter:
derivation_id: The ID of the derivation whose steps to retrieve.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": ""
}
]
This endpoint allows users to send arbitrary Cypher queries. Use this endpoint with caution.
Required parameter:
query: The Cypher query to run.Example usage:
curl -s http://localhost:5000/api/v1/resources/cypher/?query=MATCH\(n\)%20RETURN%20DISTINCT%20labels\(n\) | python3 -m json.tool
This endpoint creates a new derivation.
Required parameters:
derivation_name_latex: Name of the derivation in LaTeX format.derivation_abstract_latex: Abstract of the derivation in LaTeX format.Optional parameters:
derivation_reference_latex: A reference for the derivation in LaTeX format.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"
}
This endpoint creates a new expression.
Required parameters:
expression_latex_lhs: The left-hand side of the expression in LaTeX format.expression_relation_latex: The relation symbol of the expression in LaTeX format.expression_latex_rhs: The right-hand side of the expression in LaTeX format.Optional parameters:
expression_latex_condition: A conditional statement of the expression in LaTeX format.expression_name_latex: Name of the expression in LaTeX format.expression_reference_latex: A reference for the expression in LaTeX format.expression_description_latex: Description of the expression in LaTeX format.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
}
}
This endpoint creates a new scalar symbol.
Required parameters:
scalar_latex: The symbol's LaTeX representation.scalar_scope: The scope of the scalar. Choose from 'arbitrary', 'local', 'global'.Optional parameters:
scalar_name_latex: The name of the scalar in LaTeX format.scalar_description_latex: A description of the scalar in LaTeX format.scalar_reference_latex: A reference for the scalar in LaTeX format.scalar_variable_or_constant: Choose from 'variable' or 'constant' (default is 'variable')scalar_domain: The domain of the scalar. Choose from 'any', 'positive', 'negative', 'integer', 'real', 'natural' (default is 'any').dimension_length: The length dimension exponent (default 0).dimension_time: The time dimension exponent (default 0).dimension_mass: The mass dimension exponent (default 0).dimension_temperature: The temperature dimension exponent (default 0).dimension_electric_charge: The electric charge dimension exponent (default 0).dimension_amount_of_substance: The amount of substance dimension exponent (default 0).dimension_luminous_intensity: The luminous intensity dimension exponent (default 0).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": {}
}
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"
}
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"
}
This endpoint creates a new operation symbol.
Required parameters:
operation_name_latex: The name of the operation in LaTeX format.operation_latex: The symbol of the operation in LaTeX format.operation_description_latex: Description of the operation in LaTeX format.operation_argument_count: The number of arguments for this operation.Optional parameters:
operation_reference_latex: A reference for the operation in LaTeX format.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": {}
}
This endpoint creates a new relation symbol.
Required parameters:
relation_name_latex: The name of the relation in LaTeX format.relation_latex: The symbol of the relation in LaTeX format.relation_description_latex: Description of the relation in LaTeX format.Optional parameters:
relation_reference_latex: A reference for the relation in LaTeX format.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": {}
}
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": {}
}
This endpoint deletes a specified derivation and all its steps.
Required parameters:
derivation_id: The ID of the derivation to delete.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"
}
This endpoint deletes an expression. Not implemented.
Response:
{
"STATUS": "TODO"
}