Hi,
I am working on an app that needs a URLConnection. When searching my ContentReceived event for a response, I need to check for dynamic Urls. For example i can make a call to /api/users
and don’t have to worry about anything because it will always be the same. But what about /api/users/[user_id]
where [user_id] changes. Example: /api/users/12345
or /api/users/09876
.
Is there any pattern that the community has adopted? Below is an example.
Sub ContentReceived(URL As String, HTTPStatus As Integer, content As String)
// Using logic to extract the endpoint from the URL only in the cases below
Select Case URL
Case "/users"
OnUsersResponse(URL, HTTPStatus, content)
Case "/users/12345" // <--- THIS WILL CHANGE DEPENDING ON THE USER
OnUserResponse(URL, HTTPStatus, content)
End Select
End Sub
TIA
1 post - 1 participant