ws_read can't contain a forward slash in parameter

Greetings

Looking at a get service I’m putting together, it seems the URI cannot contain a forward slash. For example,
I’ll send a part called DDE0041531828/64 and won’t get DDE0041531828/64 back
and if I send it over as DDE0041531828%2F64, I get a bad request.

Any tips?

/**
 * @AllowToRunInFind
 * 
 * // TODO generated, please specify type and doc for the params
 * @param {String} list
 *
 * 
 * @properties={typeid:24,uuid:"D2647355-B028-43E3-B257-E0653B555A9E"}
 */
function ws_read(list) {
	
	var test = ""
	if(list != null)
	{
	        list = utils.stringReplace(list,"%2F","/")
		return list;
        }

UPDATE:

I just created a global that I can execute. It takes just replaces %charchode with ~charcode. Suitable for what I am doing. Thanks :D

    function charCodes(uParam)
    {
       uParam = utils.stringReplace(uParam,"~2F","\/")
       uParam = utils.stringReplace(uParam,"~5C","\\")
       return uParam
    }

What’s your URL format look like?

I do all my rest calls like this:

…/rest_ws/mysolutionname/mybaseform (has the ws_ methods set up here)

and then add as many extra paths as I’m going to need →

function ws_read(baseResourcePath,parameter1){}

So a call for a foundset looks like → /rest_ws/mobile_connector/dataForm/employee → baseResourcePath = “employee”
a call for a specific record looks like → /rest_ws/mobile_connector/employee/123 → baseResourcePath = “employee”, param1 = “123”
a filtered foundset request looks like → /rest_ws/mobile_connector/employee?status=active → baseResourcePath = employee, param1 = {status:active}

i usually then test the type of object param1 is → if it’s a string, it’s going to be UUID/PKid search, whereas if it’s an object it’s normally a parameter object to be parsed…

So you should be able to define as many extra parameters you want, but the parameter map (ie the string after the ? in the url) will always be the LAST parameter passed.

Don’t know if that helps at all but doing it this way I can access any table in my solution with a single base ws_read method.

robwormald:
Don’t know if that helps at all but doing it this way I can access any table in my solution with a single base ws_read method.

Or a single vr_getContext(request) method using Velocity ;)

Or that ^

Definitely have a look at the velocity web client plugin, it’s got a lot more freedom to handle this kind of stuff.

I like your style Rob

My URL Format is like this:
http://localhost:8080/servoy-service/re … 049X1/fld7
Where INT2000048C1 is a part number and fld7 is a column

For what I was just talking about, I was trying to use a part number with a space in it like this -
http://localhost:8080/servoy-service/re … 1142561848 04 *Notice the space before 04

Now It’s formatted like this -
http://localhost:8080/servoy-service/re … 61848~2F04

The reason I can’t use %2F is that Apache doesn’t allow encoded spaces for… I think security reasons.

I’m definitely going to look further into the Velocity plugin. Thanks you guys :D