Ben,
I am not support, but we have exposed several RESTful services. These are all called by our own internal systems, but I do not see any reason why a third party could not call them.
I will try to answer you question based on my observations of using these services.
A) In the data we return from these services we have a message field that either contains “success” or an error message. We do all of our validation in the called process, not with rules attached to the object. The reason being that if a rule attached to the object executes a REPORT ERROR when the object is being created, the object is not created, the called process is not executed (any Failure rules are also not executed) and an HTTP Status 500 returned to the caller. With the validation rules in the process, the object has already been created and we can set the message with any appropriate error message and the caller gets a more user friendly error message.
B) How can we authenticate that a service requester (i.e. a user from phone) is an authenticated user in the system?
We authenticate a user by requiring the loginname and password to be passed in with the incoming data. We then use the PWD_ENCRYPT function to encrypt the password and verify that the loginname and encrypted password match what is in the RegularUser table.
How can we Authorized the user level and what processes they can call?
Only the process (and any sub-processess) that is called by the service will be executed. It's not like they are logged in and have a menu of options to choose from. If you need to execute a sub-process based on their access level, you will need their loginname to be passed in the data then you can look up their access level.
And Do we have to do authentication in every request?
Each request is separate. If you require authentication, you need to do it with each request. If you do not require authentication, that is you allow anyone access to the service, you do not need to authenticate any request.
And how do we reject an unauthorized or unauthenticated requester?
On the services where we require authentication and the authentication fails (see above), we set the message field to an appropriate error message and that is all that is returned to the user.
C) When the process completes, AwareIM sends any response back to the caller. If the process takes a long time and the connection times out, you will have to redesign the service to complete sooner.
D) I do not know.
E) The caller will know the process completes when they get the response back. If the service is set to not send a response, the caller should not care when it completes.
Some gotchas to watch out for:
Make all Plain Text fields bigger than required. If the user sends data that is longer then the defined length, the process will bomb and return a 500 status. If you make the field bigger than required, you can check the length and return a user friendly error message if they send more data than allowed. The process will still bomb if they send data longer than the defined length, but the bigger you make it, the less likely that will happen.
Make all fields Plain Text fields. If you define a field as a number, and the user sends not a number, the process will bomb and return a 500 status. With a text field, you can check that the data is a number and return a user friendly error if it is not.