Skip to content

Instantly share code, notes, and snippets.

@d11z
Created December 2, 2018 00:25
Show Gist options
  • Save d11z/ec4e66ea6138bc13f6c83b189b3ab51a to your computer and use it in GitHub Desktop.
Save d11z/ec4e66ea6138bc13f6c83b189b3ab51a to your computer and use it in GitHub Desktop.

Revisions

  1. d11z created this gist Dec 2, 2018.
    40 changes: 40 additions & 0 deletions api.http
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    @host = http://localhost:8080/api

    ###
    # @name register
    POST {{host}}/login
    Content-Type: application/json

    {
    "username": "tester",
    "password": "password"
    }

    ###
    # @name login
    POST {{host}}/login
    Content-Type: application/json

    {
    "username": "tester",
    "password": "password"
    }

    ###
    # @name newPost
    @token = {{login.response.body.token}}
    POST {{host}}/posts
    Authorization: Bearer {{token}}
    Content-Type: application/json

    {
    "title": "example post",
    "url": "http://google.com",
    "category": "test"
    }

    ###
    # @name getPosts
    GET {{host}}/posts

    ###