This repository demonstrates a sample API endpoint to configure the input tables as required to run the GCBM simulation
The idea is to enforce a one-to-one mapping between the user tables and the tables required for the configuration, hence any attribute names that have to be changed are accepted.
The user will provided information about the tables, their attributes and functionalities in a format similar to this PR
The API is designed to accept a POST
method.
The payload is passed in the format :
{
table_name_1 : {
old_attribute_1 : new_attribute_1,
old_attribute_2 : new_attribute_2,
old_attribute_3 : new_attribute_3,
},
table_name_2 : {
old_attribute_1 : new_attribute_1,
old_attribute_2 : new_attribute_2,
old_attribute_3 : new_attribute_3,
}
}
Only the attributes that require to be changed are passed table-wise
The python script can be run as python app.py
on PORT 5000
gcbm.db
has a table sample
on which the API has been tested.
The initial attributes/headers are id
, A_before
, B_before
, C_before
, D_before
JSON body of the POST request :
{
"sample" : {
"A_before" : "A_after",
"B_before" : "B_after",
"C_before" : "C_after",
"D_before" : "D_after"
}
}
The API has been tested in Postman, it it passed as :
The response is the old and new schemas of the table :
Request payload
Response