Git Product home page Git Product logo

ktor-rabbits's Introduction

ktor-rabbits

A simple backend with ktor

Random Rabbits

Returns json data of a random rabbit.

  • URL

    /rabbit:random

  • Method:

    GET

  • URL Params

    None

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
       {
       "success": true,
       "message": "A random rabbit",
       "rabbits": null,
       "rabbit": {
         "id": 5,
         "name": "Rabbit 5",
         "description": "Just a fake description 5",
         "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit5.jpg"
       },
       "count": null 
       }
  • Error Response:

    • Code: 404 NOT FOUND
      Content:
      { error : "Unprecedented error!" }
  • Sample Call:

      $.ajax({
        url: "https://ktor-rabbits.herokuapp.com/rabbit:random",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Find a Rabbit

Returns json data of a rabbit given the id.

  • URL

    /rabbit:find

  • Method:

    GET

  • URL Params

    Required:

    id=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
      {
        "success": true,
        "message": "Rabbit with id:4",
        "rabbits": null,
        "rabbit": {
           "id": 4,
           "name": "Rabbit 4",
           "description": "Just a fake description 4",
           "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit4.jpg"
        },
       "count": null
      }
  • Error Response:

    • Code: 404 NOT FOUND
      Content:
      { error : "Unprecedented error!" }
  • Sample Call:

      $.ajax({
        url: "https://ktor-rabbits.herokuapp.com/rabbit:find?id=4",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Rabbits

Returns json data of a list of rabbits.

  • URL

    /rabbits

  • Method:

    GET

  • URL Params

    None

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
       {
       "success": true,
       "message": "List of all rabbits",
       "rabbits": [
         {
           "id": 1,
           "name": "Rabbit 1",
           "description": "Just a fake description 1",
           "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit1.jpg"
         },
         {
           "id": 2,
           "name": "Rabbit 2",
           "description": "Just a fake description 2",
           "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit2.jpg"
         },
         {
           "id": 3,
           "name": "Rabbit 3",
           "description": "Just a fake description 3",
           "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit3.jpg"
         },
         {
           "id": 4,
           "name": "Rabbit 4",
           "description": "Just a fake description 4",
           "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit4.jpg"
         },
         {
           "id": 5,
           "name": "Rabbit 5",
           "description": "Just a fake description 5",
           "imageUrl": "https://ktor-rabbits.herokuapp.com/rabbits/rabbit5.jpg"
         }
       ],
       "rabbit": null,
       "count": 5
      }
  • Error Response:

    • Code: 404 NOT FOUND
      Content:
      { error : "Unprecedented error!" }
  • Sample Call:

      $.ajax({
        url: "https://ktor-rabbits.herokuapp.com/rabbits",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

ktor-rabbits's People

Contributors

kiptechie avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.