Populate data from the multiple collection, databases or instances we use deep in the request payload.
-
We can provide deep information at two places:
- In collection schema
- In payload it self, check more
simple deep
Here,
- s_key = Source table field name
- t_col = Target table name
- t_key = Target table field name
- t_instance = The instance name in which target table is present.
- t_db = The database name in which the target table is present.
{
"find": {
"owner_id": 1
},
"deep": [
{
"s_key": "owner_id",
"t_instance": "mysql",
"t_db": "inventory",
"t_col": "customers",
"t_key": "customer_id"
}
]
}
Add deep information in schema
- Set instance, database, collection, and column in schema of the collection and provide only 's_key'(source key) in the deep to get deep data.
Request Payload
{
"deep": [
{
"s_key": "owner_id"
}
]
}
Set deep for multiple fields
- You can set deep inheritance using dot.
Request Payload
{
"deep": [
{
"s_key": "owner_id"
},
{
"s_key": "owner_id.shipping_id"
}
]
}
Deep inheritance
- Write 'deep' in to the 'deep' and you will get inherited data.
Request Payload
{
"deep": [
{
"s_key": "price",
"t_col": "orders",
"t_key": "total",
"select": "pincode",
"deep": [
{
"s_key": "shipping_id",
"t_col": "customers",
"t_key": "shipping_id",
"select": "phone"
},
{
"s_key": "shipping_id.pincode",
"t_col": "orders",
"t_key": "pincode"
}
]
}
]
}
Circular dependency
- API Maker automatically handle the circular dependency so you do not need to take care of it.
Request Payload
{
"deep": [
{
"s_key": "owner_id",
"t_col": "customers",
"t_key": "customer_id",
"deep": [
{
"s_key": "customer_id",
"t_col": "products",
"t_key": "owner_id",
"select": "owner_id",
"deep": [
{
"s_key": "owner_id",
"t_col": "customers",
"t_key": "customer_id",
"select": "customer_id"
}
]
}
]
}
]
}
To get more information about API Maker APIs please refer API Maker documentation.
API Maker deep feature video.
Websites
https://apimaker.dev
Follow on twitter
https://twitter.com/api_maker
Linked In
https://www.linkedin.com/company/api-maker
API Maker Youtube channel
https://www.youtube.com/@api_maker
Top comments (0)