[aerogear-dev] [QUICKSTART] Information for the mobile clients
Sebastien Blanc
scm.blanc at gmail.com
Thu Apr 17 05:27:07 EDT 2014
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<https://issues.jboss.org/browse/AGPUSH-604> 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<https://github.com/pedroigor/jboss-wfk-quickstarts/tree/PLINK-392/contacts-mobile-basic>
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<https://github.com/sebastienblanc/jboss-wfk-quickstarts/tree/push_and_secured>
.
But let's take a look at the diffrent REST endpoints :
<https://gist.github.com/sebastienblanc/10966803#crud-operations>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
<https://gist.github.com/sebastienblanc/10966803#security>Security
*DISCLAIMER* : These might change
<https://gist.github.com/sebastienblanc/10966803#register>REGISTER<https://gist.github.com/sebastienblanc/10966803#register-a-new-user>register
a new user<https://gist.github.com/sebastienblanc/10966803#restsecurityregistration>
/rest/security/registration
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
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 at westerlands.com","password":"hearmeroar"}'
http://contacts-sblanc.rhcloud.com/rest/security/registration
*NOTE* : We should use the convention to use the *email* as userName
<https://gist.github.com/sebastienblanc/10966803#getlogin>GET/LOGIN<https://gist.github.com/sebastienblanc/10966803#rerieve-a-user-and-log-him-in>Rerieve
a user and log him
in<https://gist.github.com/sebastienblanc/10966803#restsecurityuserinfo>
/rest/security/user/info
- Request type: GET
- Request type: JSON
- Auth : Basic Auth
- Return type: JSON
- Request example:
curl -v -b cookies.txt -c cookies.txt -u
"jaime.lannister at westerlands.com:hearmeroar" -H "Accept:
application/json" -H "Content-type: application/json" -X GET
http://contacts-sblanc.rhcloud.com/rest/security/user/info
<https://gist.github.com/sebastienblanc/10966803#logout>LOGOUT<https://gist.github.com/sebastienblanc/10966803#logout-a-user>Logout
a user<https://gist.github.com/sebastienblanc/10966803#restsecurityuserinfo-1>
/rest/security/user/info
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
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
<https://gist.github.com/sebastienblanc/10966803#push-rest-endpoint>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.
<https://gist.github.com/sebastienblanc/10966803#registration-with-the-ups-instance>Registration
with the UPS instance
I think the good flow would be to register with UPS once the login was
successfull. As *alias* the *email*should be passed
<https://gist.github.com/sebastienblanc/10966803#endpoint>Endpoint<https://gist.github.com/sebastienblanc/10966803#restcontactssendmessage>
/rest/contacts/sendMessage
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
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 at 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 at westerlands.com",
"receiver":"john.snow at 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<https://gist.github.com/sebastienblanc/10966803>
)
Sebi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140417/d8862f4e/attachment.html
More information about the aerogear-dev
mailing list