GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - gefalko/counter

BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
src/main
src/main
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Get counter

$ git clone https://github.com/gefalko/counter.git
$ cd ./counter
$ mvn wildfly:deploy

checked on 

ubuntu 14.10
maven 3.13.0-65-generic
wildfly 8.2

e.g url: http://localhost:8080/counterService/rest/create?name=test

Using service API

Create counter

Create new counter and add to the list

  • URL

    /users?name=:name

  • Method:

    POST

  • URL Params

Required:

name=[string]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: none
  • Error Response:

  • Code: 400 BAD REQUEST
    Content: {"error" : "Counter name exist" }

OR

  • Code: 400 BAD REQUEST
    Content: { "error" : "null can't be as name" }

  • Sample Call:

      $.ajax({
        url: "/rest/create?name=firstCounter",
        dataType: "json",
        type : "POST",
        success : function(r) {
          console.log(r);
        }
      });

Create counter

Create new counter and add to the list with initial value

  • URL

    /insert

  • Method:

    POST

  • URL Params

none

  • Data Params

    { name : [string] value : [integer] }

  • Success Response:

    • Code: 200
      Content: none
  • Error Response:

    • Code: 400 BAD REQUEST
      Content: {"error" : "Counter name exist" }

    OR

    • Code: 400 BAD REQUEST
      Content: { "error" : "null can't be as name" }
  • Sample Call:

      $.ajax({
        url: "/insert",
        data: {name:"firstCounter",value:10}
        dataType: "json",
        type : "POST",
        success : function(r) {
          console.log(r);
        }
      });

Delete counter

Delete counter from list

  • URL

    /delete?name=:name

  • Method:

    DELTE

  • URL Params

Required:

name=[string]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: none
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { "error" : "Counter name not exist" }
  • Sample Call:

      $.ajax({
        url: "/rest/delete?name=firstCounter",
        dataType: "json",
        type : "DELTE",
        success : function(r) {
          console.log(r);
        }
      });

Set value

Set counter value

  • URL

    /setValue?name=:name&value:value

  • Method:

    PUT

  • URL Params

Required:

name=[string]

value=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: none
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { "error" : "Counter name not exist" }

OR

  • Code: 400 BAD REQUEST
    Content: {"error" : "Value cannot be negative" }

  • Sample Call:

      $.ajax({
        url: "/rest/setValue?name=firstCounter&value=value",
        dataType: "json",
        type : "PUT",
        success : function(r) {
          console.log(r);
        }
      });

Increase value

Increase counter value

  • URL

    /increase?name=:name&value:value

  • Method:

    PUT

  • URL Params

Required:

name=[string]

value=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: none
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { "error" : "Counter name not exist" }

OR

  • Code: 400 BAD REQUEST
    Content: {"error" : "Value cannot be negative" }

  • Sample Call:

      $.ajax({
        url: "/rest/increase?name=firstCounter&value=value",
        dataType: "json",
        type : "PUT",
        success : function(r) {
          console.log(r);
        }
      }); 
**Get counter**
----
Return counter from list
 
* **URL**

 /get?name=:name

* **Method:**

 `GET`
 
*  **URL Params**

 **Required:**

 `name=[string]`

* **Data Params**

 None
 
* **Success Response:**

 * **Code:** 200 <br />
   **Content:** `{name:"counter1",value:10}` 
 
* **Error Response:**

 * **Code:** Code: 404 NOT FOUND <br />
   **Content:** `{"error" : "Counter name not exist" }`  


* **Sample Call:**

 ```javascript
   $.ajax({
     url: "/rest/get?name=firstCounter",
     dataType: "json",
     type : "GET",
     success : function(r) {
       console.log(r);
     }
   });

Get all counters

Return list of all counter

  • URL

    /getall

  • Method:

    GET

  • URL Params

none

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: [{name:"counter1",value:10},{name:"counter2",value:20}]
  • Sample Call:

      $.ajax({
        url: "/rest/getall",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.