Services

Overview

Authentication

Authenticate

Users must authenticate in order to get an authentication token. All service calls that require writing to the back end should require an authentication token returned by this service call. In order to be able to login, first register.

URL: http://robocaddy.jorva.net/services/auth

Parameter Description Default Value Example
u The user name.   john.smith@google.com
p The plain-text password for the specified user name.   secret

Authenticate

Allows for a user to register with the system.

URL: http://robocaddy.jorva.net/services/register

Parameter Description Default Value Example
u The user name.   john.smith@google.com
p The plain-text password for the specified user name.   secret

Courses

Save Course

Allows for the saving of a course and its holes.

URL: http://robocaddy.jorva.net/services/courses/set

Parameter Description Default Value Example
course The course to save (with hole information).  

{ "course_id":"2", "name":"Willis Park", "description":null, "city":"Alpharetta", "state":"GA", "address":"11915 Wills Road", "latitude":"34.069", "longitude":"-84.311", "hole_count":"18", "distance_km":"9483.79", "holes":[] }

Get Courses (Search)

Allows for the searching of courses ordered by closest location.

URL: http://robocaddy.jorva.net/services/courses/get

Parameter Description Default Value Example
name The name of course. A simple LIKE operation is for searching.   Habersham
state The two letter state code that the course resides in.   GA
city The city course resides in.   Canton
latitude The latitude that the user is currently at. This is used to calculate the closest holes. 0.0 34.718
longitude The longitude that the user is currently at. This is used to calculate the closest holes. 0.0 -74.718

Get Courses (Favorites)

Gets a users favorite courses ordered by closest location.

URL: http://robocaddy.jorva.net/services/courses/get

Parameter Description Default Value Example
user_id The ID of the user in order to get their favorites courses returned   1

Get Course (Single)

Gets a single course by the ID. Note that hole information will be returned also.

URL: http://robocaddy.jorva.net/services/courses/get

Parameter Description Default Value Example
course_id The ID of the course to get   1

Images

Get Image

Allows for the retrieval of an image associated with a course or hole.

URL: http://robocaddy.jorva.net/services/images/get

Parameter Description Default Value Example
key_type The type of image to get (either courses or holes) courses courses
key_id The ID of the type of image you are getting. For example, if key_type = courses and key_id = 1 then the image for the course with ID = 1 will be returned   1
width The width to resize to. If width is specified and height is not specified, then the height of the image is scaled according to the ratio of the original image.   32
height The height to resize to. If height is specified and width is not specified, then the width of the image is scaled according to the ratio of the original image.   32

Example: http://robocaddy.jorva.net/services/images/get?key_type=courses&key_id=1&width=32

Favorites

Save Favorite

Allows for the saving of a favorite course.

URL: http://robocaddy.jorva.net/services/usercourse/set

Parameter Description Default Value Example
user_id The ID of the user who is going to favorite a course   1
course_id The ID of the course to favorite   1
is_favorite Boolean flag to indicate if the course is the user's favorite or not.   true

Example: http://robocaddy.jorva.net/services/usercourse/set?user_id=1&course_id=1&is_favorite=true