How do you handle an API that sends data to a callback URL using various methods
I have an API that sends data to the callback URL using various methods. For example: getPlayerBalance method comes with data like this: {"Login":"username","OperatorId":"1","Session":"465663"} while getPlayerBalances method comes with data like this: {"d":{"Data":[{"Balance":100.0000,"Login":" username1"},{"Balance":200,"Login":" username2"}],"ErrorCode":0,"HasErrors":false,"Message":""}} Now the question is how do I know the method sending data so that I can handle the data differently?
Do this Route::post("/api/response/{slug?}", [your_handler_class::class, "handler"]);
Create a class your_handler_class with a method called handler($slug = "").
I'm sure getPlayerBalance and getPlayerBalances are returned as part of the response.
Perhaps it is /api/response/getPlayerBalance and /api/response/getPlayerBalances?
Callback is a very specific and unique term meaning they load your URL. I think we might be confusing 2 different issues.
Since your objective appears to be calling web services and not handling callbacks, I suggest you refer to earlier answers regarding using file_get_contents() and also figure out which URL you have to call (which is probably somewhere in the docs).
In this case, they are the ones sending data to us. For example when a player wins or losses, they send the debit or credit data that we ought to process and return data to them to update the player's account information