How can I create a REST server

I am thinking about writing a REST server to feed a Xojo app but I have two questions:

  1. Has anyone got any examples of a REST server written in Xojo?

  2. If the service is not going to be public would their be a better way if both the client and the server and going to be written is Xojo? The server could have 100s or even 1000s of users accessing it?

Done that a lot of times. Simply use HTTPSocket to query and JSON classes in Xojo.
If you need more security, use our CURL plugin and if you need speed on JSON, you can use our JSON plugin classes.

For the server part, you can use ServerSocket. I did that, too. You practically need to implement a little web server. Or you use the one built into web framework and use the HandleSpecialURL event there.

Thanks for the help, is the JSON plugin part of the Complete pack I purchased? From your experience would use the HandleSpecialURL in a standalone app or use the example web server in the Xojo examples?

Sorry forgot to ask, would you use this over eNet or EasyTCPSocket/EasyUDPSocket instead of REST?

Nathan, I have a limited functionality REST API server that I wrote using WE (web edition) and HandleSpecialURL. There is no Web pages that it servers up, but instead it takes POSTS to the API and the WE parses it and returns the data. With more coding I could have the API doing updates also if I wanted.

Now that WE app is a standalone one that runs on a non-standard web port (on purpose).

There are a dozen (if not more) ways you can do it. Depends on how you want to skill that cat.

JSONMBS class is included in Complete set.

Thanks guys, looks like I need to have a good look at HandleSpecialURL and JSONMBS.

[quote=82686:@Nathan Wright]I am thinking about writing a REST server to feed a Xojo app but I have two questions:

  1. Has anyone got any examples of a REST server written in Xojo?
  2. If the service is not going to be public would their be a better way if both the client and the server and going to be written is Xojo? The server could have 100s or even 1000s of users accessing it?[/quote]
    A few years ago, for an animated movie project, I had been put in an unexpected situation where I had just a few weeks to put in place an asset manager for the production and the artists. This was something not planned and ‘urgent’. I have to admit that using RealStudio at that time almost saved my life on this one, so to speak.

I create a REST linux server, very simple, no Jason, just one /special/xxx/xxx/xxx/… URL per command with GET parameters (it was on an intranet, security was not an issue). Then Windows clients for the artists, with plugins for their 3d applications. And also Mac OS X clients for the editor and sound editor who didn’t wanted to hear about Windows :-). So all platforms were involved in this project.

I didn’t used EasyTCP/UDPSockets because the REST server had to be accessible from the 3d applications plugins which were written in Javascript. Everything on the server was handle in the HandleSepcialURL event.

At pic production time we had a little over 100 artists working every day using the asset manager, plus the production crew. It worked very well.

Unfortunately I can’t share the source code as it is not my property, but rest assured this is very possible and work quite well. I didn’t tested with thousands of clients through, just a hundred.

I use JSONMBS a lot! it is much faster than the Xojo JSON class.