API Documentation
Everything you can do within our application can also be done via our API. The only catch is that all calls require OAuth authentication so we know on behalf of which user you are performing them.
There are however a few things you can do without registering an application – you can get a list of a users shared notes in JSON and you can get the shared notes both Markdown and JSON.
Authentication
The authentication of users is a straight forward OAuth flow. Campus Notes is responsible for a large part of the OAuth.net PHP library so we are fairly sure we got it right. Campus Notes runs OAuth 1.0 Revision A exclusively.
First you need to registered your app to receive your consumer key and secret. With these you are able to procure a Request Token from the follwoing endpoint: http://getcampusnotes.com/api/request_token
When you have your Access Token you send your user over to us along with your request token so they can authorize your application. The endpoint you need to send them to is: http://getcampusnotes.com/api/authorize
After your users return from the authorization page (either by callback if you specified one or by manual user action) you swap your Request Token for a permanent Access Token. Since Campus Notes are using OAuth 1.0 Rev. A you need to send along the verifier code that the authorization step provided you with. The endpoint you need to get your Access Token is: http://getcampusnotes.com/api/access_token
If you for some reason decides that you no longer want your Access Token – say the user wants to log out of your application – you can revoke a token by performing an authorized call to this endpoint: http://getcampusnotes.com/api/revoke_token
Non-authorized Reading
Okay, so you just read the authentication section and you want to get data from Campus Notes without all that hassle, fair enough. We do have a few things you can read from our service without having to register, understand OAuth or anything. If you can download a webpage, you can use this part of our API.
If you request any users shared notes page (ie http://getcampusnotes.com/campusnotes) with a Accept of application/json you will receive the list in JSON instead of HTML. If you don't know how to set a header, you can also just append ?type=application/json to the URL
The same is true for the URL of a shared note. You can request any shared note with either an Accept header or with a type=xx url-addition. If you specify application/markdown as the desired type you will get only the unrendered markdown. If you on the other hand specify it as application/json you will get all the metadata plus the unrendered markdown as a JSON document.
Authorized API calls
Okay, so you want to read private data or perhaps even write data – you have no choice but to use the OAuth authorized way of making calls to our API. The API is fairly simple - you simple call one single endpoint, namely http://getcampusnotes.com/api/json with a method parameter plus any other parmeters the given method requires. We recommend passing the OAuth parameter with the Authorize-header but you can send them as POST or GET if you so desire.
So for instance if you want to call the notes.getList method, you simply request the URL http://getcampusnotes.com/api/json?method=notes.getList with a OAuth Authorize-style header.
API Methods
This section is still in writing! This is a list of all the provided API methods. If you really want to use them you should be able to use Firebug or similar to find the parameter-list required for the methods when the Campus Notes application performs its calls to the API
misc.echo
A very simple debugging method you can use to check if you perform your OAuth signing correct. Will simply return all parameters given to it.
user.getInfo
Returns the details of the user that is tied to this token.
security.getTokenDetails
...
security.expireToken
...
notes.getList
Returns a list of all the users notes.
Parameter-list
No parameters needed
notes.getListByClass
Returns a list of all the users notes in a given class.
Parameter-list
- class_id
- The ID of the class you want the list from
notes.getListByFolder
...
note.get
...
note.create
...
note.remove
...
note.setTitle
...
note.setContent
...
note.setShared
...
note.addToClass
...
note.removeFromClass
...
note.addToFolder
...
note.removeFromFolder
...
attachment.add
...
attachment.remove
...
semesters.getList
...
semester.add
...
semester.rename
...
semester.remove
...
class.add
...
class.rename
...
class.remove
...
class.reposition
...
folders.getList
...
folder.add
...
folder.rename
...
folder.remove
...