I need to replicate functionality from an existing api that has a dynamic url. It grabs a device id. How can I do this with scriptr? Can I convert part of a url to params somehow?
Marked as spam
I believe you are describing a URL of the form http://api.scriptrapps.io/myScript/deviceId. If this is the case, you can definitely do that from myScript where you can grab the deviceId using request.pathInfo.
Check out the Creating RESTful APIs with Scriptr.io section of the documentation for more on this (https://www.scriptr.io/documentation#documentation-restfulapisCreatingRESTfulAPIswithScriptr.io).
Hope this helps,
Marked as spam
This is exactly what I’m looking for Julien. Thank you.
When utilizing the GET strategy, parameter names and their esteems get submitted on the URL string after a question mark. Distinctive parameter name/esteem sets are isolated by ampersands. The following is an example of submitting two parameters to the \’my-demo-servlet\’ servletW. The primary parameter is called \’param1\’ and has an estimation of \’hi\’, and the second parameter is called \’param2\’ and has an estimation of \’farewell\’.
Be that as it may, what happens if the parameter esteem in the URL string has a space or some other extraordinary character? Presenting a HTMLW frame will bring about uncommon characters being consequently changed over to exceptional codes for us. Nonetheless, now and again it is important to encode these characters without the guide of a HTML frame. JavaSW has a class called URLEncoder that can encode these characters so they are legitimately dealt with. The encode strategy takes two parameters, the string to be encoded and the encoding plan. Unless you\’re smoking rocks, you most likely need the encoding plan to be \”UTF-8\”.