<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Server API Docs</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>Recent changes to Server API Docs</description><atom:link href="https://sourceforge.net/p/geochat/wiki/Server%20API%20Docs/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 12 Jun 2013 12:30:24 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/geochat/wiki/Server%20API%20Docs/feed" rel="self" type="application/rss+xml"/><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v15
+++ v16
@@ -11,7 +11,7 @@

 &gt;{"username":"georgepburdell@gatech.edu", "password":"jackets"}

-If the username does not already exist in the database, the user will be created and his information will be returned to you in another JSON object. Make sure to set the header of your POST request to 'applcation/json'
+If the username does not already exist in the database, the user will be created and his information will be returned to you in another JSON object. Make sure to set the Content-Type header of your POST request to 'applcation/json'

 ##Logging in
 Sessions in GeoPhotos are managed with tokens. This allows for single sign on in mobile apps. 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Wed, 12 Jun 2013 12:30:24 -0000</pubDate><guid>https://sourceforge.net08c9d46aa52069bcca7e03ddfb1426ea5c444e65</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v14
+++ v15
@@ -1,6 +1,6 @@
 This page will contain a description on how to use the web API in the GeoChats application.
 The server is now located at http://abettadapur.dynathome.net:3000
-[TOC]
+

 # Background
 The server that hosts the API is written in nodeJS, a serverside javascript library. It also uses the NodeJS module Express, which allows for easy creation of websites with complex routes and methods. All data that is received through the API is stored in a MongoDB instance, which supports scale-ability in the future through possible sharding and clustering More information can be found at   
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Tue, 11 Jun 2013 17:54:08 -0000</pubDate><guid>https://sourceforge.netd84a2557de5a6a80f69dcd63fa3408cebb79df81</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v13
+++ v14
@@ -15,7 +15,7 @@

 ##Logging in
 Sessions in GeoPhotos are managed with tokens. This allows for single sign on in mobile apps. 
-To request a token, send a POST request to /users/sessions with a JSON object that describes the login credentials. It should be identical to the create user object.
+To request a token, send a POST request to /users/login with a JSON object that describes the login credentials. It should be identical to the create user object.
 Provided your credentials are correct, the server will create a token for you and return it in a JSON object

 &gt;{
@@ -26,7 +26,7 @@
 You should store this token somewhere as it will be needed to authenticate future requests

 ##Logging out
-To log out, send a DELETE request to /users/sessions with either the token of the session you wish to send or the username of the session you wish to send.
+To log out, send a POST request to /users/logout with either the token of the session you wish to send or the username of the session you wish to send.
 &gt;{
 "username":"georgepburdell@gatech.edu",
 "token":"your token here"
@@ -91,4 +91,4 @@
 To retrieve a photo's metadata, navigate to photos/id/:id, where :id is the unique id returned to you when you added the photo. This will return a JSON object with the metadata about the photo as well as a URL where you can retrieve the image itself. This url is located at /photos/images/:id.

 ##Deleting a photo
-To delete a photo, send a HTTP DELETE request to /photos/:id. If the ID exists in the database, the photo will be removed from the database and deleted. This request must also be authenticated with a token. Add it to the request body as a JSON object
+To delete a photo, send a HTTP POST request to /photos/delete. The request must contain the ID of the photo and the authentication token of the user to which the photo belongs. If the ID exists in the database, the photo will be removed from the database and deleted. 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Tue, 11 Jun 2013 13:42:00 -0000</pubDate><guid>https://sourceforge.net0f8e720850beeaf526e0a2aae21414d78a803688</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Mon, 10 Jun 2013 15:43:07 -0000</pubDate><guid>https://sourceforge.net2f7353394ac79c2e8ded3186d2953c66b8557d86</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -91,4 +91,4 @@
 To retrieve a photo's metadata, navigate to photos/id/:id, where :id is the unique id returned to you when you added the photo. This will return a JSON object with the metadata about the photo as well as a URL where you can retrieve the image itself. This url is located at /photos/images/:id.

 ##Deleting a photo
-To delete a photo, send a HTTP DELETE request to /photos/:id. If the ID exists in the database, the photo will be removed from the database and deleted.
+To delete a photo, send a HTTP DELETE request to /photos/:id. If the ID exists in the database, the photo will be removed from the database and deleted. This request must also be authenticated with a token. Add it to the request body as a JSON object
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Mon, 10 Jun 2013 15:42:26 -0000</pubDate><guid>https://sourceforge.netdbb35784ca5931189b7ba778b222d2c6820360de</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -15,7 +15,7 @@

 ##Logging in
 Sessions in GeoPhotos are managed with tokens. This allows for single sign on in mobile apps. 
-To request a token, send a POST request to /users/login with a JSON object that describes the login credentials. It should be identical to the create user object.
+To request a token, send a POST request to /users/sessions with a JSON object that describes the login credentials. It should be identical to the create user object.
 Provided your credentials are correct, the server will create a token for you and return it in a JSON object

 &gt;{
@@ -25,11 +25,17 @@

 You should store this token somewhere as it will be needed to authenticate future requests

-
+##Logging out
+To log out, send a DELETE request to /users/sessions with either the token of the session you wish to send or the username of the session you wish to send.
+&gt;{
+"username":"georgepburdell@gatech.edu",
+"token":"your token here"
+}
+This request will end the session and make the authentication token invalid on future requests. To request a new token, you must log in again.

 # Dealing with Photos
 ##Uploading a photo
-Currently, a photo can be uploaded with a few metadata tags through the use of an HTTP POST Multipart request. This is the same type of request that is commonly used in web-forms and is the easiest way to send files via HTTP. Every library has a different way of implementing multipart requests. What follows is the correct method for Android. 
+Currently, a photo can be uploaded with a few metadata tags through the use of an HTTP POST Multipart request. This is the same type of request that is commonly used in web-forms and is the easiest way to send files via HTTP. All photo upload requests must be authenticated using a token. It should be added as a parameter in the multipart request. Every library has a different way of implementing multipart requests. What follows is the correct method for Android. 

 You must include the httpmime 4.x jar from the Apache HttpComponents  for this to work on Android.

@@ -43,7 +49,7 @@

 Here, we have created a simple POST request to the API endpoint. Note, of course, that the ip and port may change.

-We must now create a multipart entry and fill it with our data, including the File and any metadata we want to attach.
+We must now create a multipart entry and fill it with our data, including the File, any metadata we want to attach, and the authentication token we will be using

 ~~~~java
 try
@@ -52,6 +58,7 @@
     File photo = new File("/sdcard/image.png");
     entity.addPart("userImage", new FileBody(photo));
     entity.addPart("title", new StringBody("Fireworks"));
+    entity.addPart("token", new StringBody("6ajqdgbn5dhd7vin0520i7u11ulq5mi");
     httpPost.setEntity(entity);
 ~~~~

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Mon, 10 Jun 2013 15:41:36 -0000</pubDate><guid>https://sourceforge.net973033a3f3cedc0655dd9308d14406e9e2c1b6f7</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -8,10 +8,24 @@
 # Authentication
 ## Creating a User Account
 User accounts are easy to create in the database. To create a new user account, you must send a HTTP POST request to /users. In this POST request, you must include a JSON object that describes the user you are trying to create. Here is an example POST body:
-~~~~~java
-{"username":"georgepburdell@gatech.edu", "password":"jackets"}
-~~~~~
+
+&gt;{"username":"georgepburdell@gatech.edu", "password":"jackets"}
+
 If the username does not already exist in the database, the user will be created and his information will be returned to you in another JSON object. Make sure to set the header of your POST request to 'applcation/json'
+
+##Logging in
+Sessions in GeoPhotos are managed with tokens. This allows for single sign on in mobile apps. 
+To request a token, send a POST request to /users/login with a JSON object that describes the login credentials. It should be identical to the create user object.
+Provided your credentials are correct, the server will create a token for you and return it in a JSON object
+
+&gt;{
+"result:":"Success",
+"token":"6ajqdgbn5dhd7vin0520i7u11ulq5mi"
+}
+
+You should store this token somewhere as it will be needed to authenticate future requests
+
+

 # Dealing with Photos
 ##Uploading a photo
@@ -71,4 +85,3 @@

 ##Deleting a photo
 To delete a photo, send a HTTP DELETE request to /photos/:id. If the ID exists in the database, the photo will be removed from the database and deleted.
-
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Mon, 10 Jun 2013 15:35:03 -0000</pubDate><guid>https://sourceforge.net668e8e26cdde1a1464da6790c835f374415bd50d</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -1,5 +1,5 @@
 This page will contain a description on how to use the web API in the GeoChats application.
-
+The server is now located at http://abettadapur.dynathome.net:3000
 [TOC]

 # Background
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Mon, 10 Jun 2013 13:27:49 -0000</pubDate><guid>https://sourceforge.netcb01f08b5f5a9fcb30c3e4b0339de78c7f5b6a47</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -8,7 +8,7 @@
 # Authentication
 ## Creating a User Account
 User accounts are easy to create in the database. To create a new user account, you must send a HTTP POST request to /users. In this POST request, you must include a JSON object that describes the user you are trying to create. Here is an example POST body:
-~~~~~javascript
+~~~~~java
 {"username":"georgepburdell@gatech.edu", "password":"jackets"}
 ~~~~~
 If the username does not already exist in the database, the user will be created and his information will be returned to you in another JSON object. Make sure to set the header of your POST request to 'applcation/json'
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Sun, 09 Jun 2013 18:12:30 -0000</pubDate><guid>https://sourceforge.neta39349f636b7455885c0a5ed6be566ba73f8156e</guid></item><item><title>Server API Docs modified by Alex Bettadapur</title><link>https://sourceforge.net/p/geochat/wiki/Server%2520API%2520Docs/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -6,7 +6,12 @@
 The server that hosts the API is written in nodeJS, a serverside javascript library. It also uses the NodeJS module Express, which allows for easy creation of websites with complex routes and methods. All data that is received through the API is stored in a MongoDB instance, which supports scale-ability in the future through possible sharding and clustering More information can be found at   

 # Authentication
-Not yet implemented. Call protected methods to your heart's content
+## Creating a User Account
+User accounts are easy to create in the database. To create a new user account, you must send a HTTP POST request to /users. In this POST request, you must include a JSON object that describes the user you are trying to create. Here is an example POST body:
+~~~~~javascript
+{"username":"georgepburdell@gatech.edu", "password":"jackets"}
+~~~~~
+If the username does not already exist in the database, the user will be created and his information will be returned to you in another JSON object. Make sure to set the header of your POST request to 'applcation/json'

 # Dealing with Photos
 ##Uploading a photo
@@ -55,11 +60,15 @@
 ~~~~~~

-Now that we have created a POST request, the last part is just to send the request as above. The photo then will be uploaded to the server and stored in the MongoDB with all the StringBody parameters specified.
+Now that we have created a POST request, the last part is just to send the request as above. The photo then will be uploaded to the server and stored in the MongoDB with all the StringBody parameters specified. The server will then send a response in JSON format with the unique id of the photo you just stored. You will need this to later retrieve the photo

 Remember of course, that this must all occur within an AsyncTask on Android

 ##Retrieving a photo
-Assuming you have the ID handy (should be returned to you, hasnt been implemented yet), simply navigate to /photos/id/:id to retrieve the photo. That easy
+To retrieve a photo's metadata, navigate to photos/id/:id, where :id is the unique id returned to you when you added the photo. This will return a JSON object with the metadata about the photo as well as a URL where you can retrieve the image itself. This url is located at /photos/images/:id.
+
+##Deleting a photo
+To delete a photo, send a HTTP DELETE request to /photos/:id. If the ID exists in the database, the photo will be removed from the database and deleted.
+
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Bettadapur</dc:creator><pubDate>Sun, 09 Jun 2013 18:12:05 -0000</pubDate><guid>https://sourceforge.net9bfa897483c8613dbe37eb7fac92ee716921dea4</guid></item></channel></rss>