I have a question on whether I can use the same attribute in an API but will have different information based on a type flag within the API.
The function we are planning to build is to do an automated information update vs. an On-demand information update. The plan is to build a single API with a type flag differentiating between automated vs. on-demand. In the API, I have an attribute named accountNumber. In the automated process, the system invokes the API will provide the new accountNumber. In the on-demand process, the system which invokes the API will provide the old accountNumber, and our system will retrieve the new accountNumber from an external account and update DB.
The question is whether it is the correct approach to use a single attribute named accountNumber for both the automated and on-demand processes, even though the input value is different.
Here is the sample API definition with a single attribute serving the dual purpose.
{
"data": {
"type": "string - /* AT - Automated MN - Manual */",
"subOrder": [
{
"account": {
"accountNumber": "string",
"contextId": "string",
"type": "string"
}
}
]
}
}
Here is the sample API definition with two object names.
{
"data": {
"type": "string - /* AT - Automated MN - Manual */",
"subOrder": [
{
"account": {
"accountNumber": "string",
"contextId": "string",
"type": "string"
},
"newAccount": {
"accountNumber": "string",
"contextId": "string",
"type": "string"
}
}
]
}
}
Based on API defintion standards, please let me know the appropriate structure