Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
How to allow user to GET using a multipart key
When using a GET request on a collection of items that use multipart keys, I get a url for an item that looks something like api/endpoint/101*1. However, when I use that url in a GET request, I get an 400 error from Abyss Web Server. My guess is that Abyss is blocking the asterisk character. Is there a way to tell Abyss to allow this to be passed to the SRP HTTP Framework? If not, how can I use endpoints that are linked to tables with multipart keys?
Thanks
Thanks
Comments
Must your end point include the asterisk? Personally I think it looks a bit odd. I would have suggested a dash or even a slash. In your API you can swap it for an asterisk so you can safely read the database record. Remember, the URL is an abstraction of the resource on your server. It doesn't have to mirror the database and probably shouldn't in most cases.
Eg: api/timecards/4252~weglenor~17797~28800~57600
But it would not get the key because of the intial problem reported.
The HTTP_Resource_Services would need to be changed to change the hyperlink that is created with the */~ substitution.
/salesman/123-2
And still use HTTP_Resource_Services "as is", then in the GET method service handler he would just need to convert the "-" to "*" and then pass that in to get the record.
The self referencing URL that is automatically produced in the HAL+JSON response would include the '*'. In that case, your suggestion would be acceptable.