I am trying to test the web service using the browser with the following:



The first one returns the json string.

The second one keeps coming up with KeyNotFoundException, the data variable is always blank.

I have tried using the sample RESTy with the same result.

Any advise why the sample app is not working?

We’d need to see the code in HandleSpecialUrl.

Maybe try

Thanks Michel, prompt as usual, however did not work, I got excited.

The code is as follow from the example

	Dim data As Text = DefineEncoding(Request.Entity, Encodings.UTF16).ToText
	Dim json As JSONItem
	Select Case Request.Path
	Case "GetAllCustomers"
			json = GetAllCustomers
	Case "GetCustomer"
			json = GetCustomer(data)
	Case "UpdateCustomer"
			json = UpdateCustomer(data)
	Case Else
			// Do not process request
			Return False
	End Select
	// Send back data
	Return True

Looking at your code, I’m assuming that GetCustomer is expecting the value of ID to be passed in through the Data property, which it’s not. You’ll need to use Request.GetParameter(“ID”) instead of Request.Entity.

To answer the original question a KeyNotFoundException usually means that you’re requesting something from the JSON data which doesn’t actually exist. For example, if your JSON looked like this:

{ "one" : 1, "two" : 2 }

and you asked for element “three”. That’s how you’d get a KeyNotFoundException.

There are code samples here:

Thanks Greg, I was just trying to run the app, it even fails on the demo site.

I have taken your advise and made a global property id As Integer and used Request.GetParameter(“ID”).Val

It worked using

Thank you.