T
TanStack3y ago
flat-fuchsia

API Endpoints Question to take advantage of Query Keys

I currently only have a single GET request for the Users object below and curious if I should ask the API team to make new endpoints.
Current API Setup /users -> Have one GET for users which returns the object above. /users/{filters}. To get one user, which returns an array of users (I just do users[0] on response). filters = "?id=${id}" Setup I want to propose /users/{filters} -> Stays the same and returns the full object given no filters /users/{ID} -> Returns a Single User /users/{ID}/roles -> Returns A single User's Roles /users/{ID}/skills-> Returns A single User's Skills /users/{ID}/job-position -> Returns a User's Job Position (For this I wasn't sure if it should be /job-position/user/{ID} instead since job-positions is a list view in other route)
"users": [
{
"id": "string",
"name" : string,
"userRoleAssignments": [
{
"role": {
"id": "string",
"roleDesc": "string",
"rolePermissionAssignments": [
{
"permission": {
"id": "string",
"permDesc": "string",
},
}
]
},
"createId": "string",
"createDt": "2023-03-02"
}
],
"userSkills": [
"skillID": 0,
"description": string
],
"jobPosition": {
"jobPositionId": 0,
"fullName": "string"
"PositionType": {
"positionType": "string",
"name": "string",
"notes": "string",
},
"phoneNumbers": [
{
"JobPositionPhoneId": 0,
"phoneType": {
"typeCode": "string",
"category": "ADDR",
},
"number": "string",
"extension": "string",
}
],
},
}
]
}
"users": [
{
"id": "string",
"name" : string,
"userRoleAssignments": [
{
"role": {
"id": "string",
"roleDesc": "string",
"rolePermissionAssignments": [
{
"permission": {
"id": "string",
"permDesc": "string",
},
}
]
},
"createId": "string",
"createDt": "2023-03-02"
}
],
"userSkills": [
"skillID": 0,
"description": string
],
"jobPosition": {
"jobPositionId": 0,
"fullName": "string"
"PositionType": {
"positionType": "string",
"name": "string",
"notes": "string",
},
"phoneNumbers": [
{
"JobPositionPhoneId": 0,
"phoneType": {
"typeCode": "string",
"category": "ADDR",
},
"number": "string",
"extension": "string",
}
],
},
}
]
}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?