Hi all,

As we are almost done with the HelloWorlds, I think we can we start on the Quickstart clients. As a reminder, the Quickstart will consist in a simple Contact CRUD application with the possibility to send a Push Notification to one of the listed contacts. Please refer to this JIRA to have more information.

The clients will have to communicate against secured REST endpoints. Joshua and Pedro have started to work on that but nothing official is released yet. I've tried out their branch and IMHO it's good enough to start using it for building our clients, the restpoints won't change that much I believe.

And because I love you, I deployed on OpenShift a version of this secured backend to ease the development of the clients !

If you browse to http://contacts-sblanc.rhcloud.com/ you will even see the mobile web client. This deployed version contains also the Push Message endpoint.

The branch of this deployed version can be found here.

But let's take a look at the diffrent REST endpoints :

CRUD operations

I won't detail them here, since there is already a doc for that : https://github.com/jboss-developer/jboss-wfk-quickstarts/blob/2.6.x-develop/contacts-mobile-basic/SERVICES.md

Security

DISCLAIMER : These might change

REGISTER

register a new user

/rest/security/registration


curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"firstName":"Jaime","lastName":"Lannister","userName":"jaime.lannister@westerlands.com","password":"hearmeroar"}' http://contacts-sblanc.rhcloud.com/rest/security/registration

NOTE : We should use the convention to use the email as userName

GET/LOGIN

Rerieve a user and log him in

/rest/security/user/info


curl -v -b cookies.txt -c cookies.txt -u "jaime.lannister@westerlands.com:hearmeroar" -H "Accept: application/json" -H "Content-type: application/json" -X GET http://contacts-sblanc.rhcloud.com/rest/security/user/info 

LOGOUT

Logout a user

/rest/security/user/info


curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json" -X POST http://contacts-sblanc.rhcloud.com/rest/security/logout 

Push Rest Endpoint

I've added a new endpoint to push a message. In the deployed version, it's hardcoded for now to send to the "quickstart" application created for the https://quickstartsups-sblanc.rhcloud.com/ UPS instance, you will also have to create the appropriate variants.

Registration with the UPS instance

I think the good flow would be to register with UPS once the login was successfull. As alias the emailshould be passed

Endpoint

/rest/contacts/sendMessage


curl -v -b cookies.txt -c cookies.txt -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"author":"Jaime","receiver":"john.snow@thenorth.com","message":"Winter is coming !"}' http://contacts-sblanc.rhcloud.com/rest/contacts/sendMessage

So here we can see that we pass data like :


{
  "author":"jaime.lannister@westerlands.com",
  "receiver":"john.snow@thenorth.com",
  "message":"Winter is coming !"
}

To keep it simple, the client should always pass a hardcoded value for the message , we don't want (for now)to add any complexity to the clients by adding an extra dialog to enter custom messages.

author and receiver should contain the emails as we used that for the alias in UPS.

So, I hope all this will help to boostrap the client's work. Remarks, questions ?

(the content of this email is available here )

Sebi