Skip to content

Bradcomp/egghunt-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Egghunt API An API for servicing the Egghunt iOS app that doesn't exist yet.

All responses will have either a data field containing the response data, or an error field with the relevant information.

Egg

The structure of an egg is as follows

{
    user: UUID,
    icon: String,  //A single unicode character
    id: UUID,
    guestBook: Array,
    location: {
        type: 'Point',
        coordinates: [ Longitude, Latitude ]
    }
}

User

The structure of a user is as follows

{
    id: UUID,
    apiKey: String,
    signature: String,
    eggsFound: [UUID]
}

##Authentication Authentication can be set via an authentication header.

authentication: apiKey

You get the apiKey when you create a user. All endpoints are authenticated.

API endpoints

All endpoints have a {status: 'SUCCESS'} field, or an error field with an indication of what went wrong.

GET /eggs

Returns a list of the found eggs for the user.

Response:

{
    "data": [Egg]
}

###POST /eggs Adds a new egg at the specified location.

  • Must be at least 25 meters away from existing eggs.
  • Required fields in the body: latitude, longitude, icon
  • icon is a single unicode character (should be an emoji).

Response:

{
    "data": {
        "created": Boolean,
        "egg": Egg?
    }
}

###DELETE /eggs/:id Deletes an egg. Requires that the egg belong to the person doing the deleting.

Response:

{
    "data": {"removed": Boolean}  
}

###GET /eggs/check Checks for an egg at a specified location. Takes a latitude and longitude query parameter. Will add the egg to the foundEggs for the User.

Response:

{
    "data": {
        "found": Boolean,
        "egg": Egg?
    }
}

###PUT /eggs/guestbook Adds your signature to the guestbook for the egg. Expects a body with a single field - egg - which contains the egg ID.

Response:

{
    "data": {
        "signed: Boolean"
    }
}

###POST /users Creates a user. You don't need a body. Currently requires admin authentication.

Response:

{
    "data": {
        "apiKey": "String",
        "id": "UUID"
    }
}

###DELETE /users/:id Deletes a user. Requires admin authentication.

Response:

{
    "data": {"removed": Boolean}  
}

###PUT /users/signature Expects a body with a single field - signature. The field should contain a string.

Response:

{
    "data": {
        "updated": Boolean,
        "signature": "String"
    }
}

About

API backing the Egg Hunt iOS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published