Giter Club home page Giter Club logo

simple_rest_api's Introduction

Simple Flask API

This application is here to debug client request to an API.

This API will always return "OK", but will print some request informations in the console:

  • path
  • HTTP method (verb)
  • Header key-value
  • Query parameter (?name=Jon)
  • Raw body
  • Parser body like a form
  • Parser body like a JSON

Simple to run

python api.py

Examples

GET request with query parameters and custom header

curl -X GET 'http://localhost:8989?name=Jon' -H "X-Tag: 89"

New request:
	-path: /
	-verb: GET
	-headers: 
		Content-Length = 
		User-Agent = curl/7.43.0
		X-Tag = 89
		Host = localhost:8989
		Accept = */*
		Content-Type = 
	-query parameters: 
		name = Jon
	-raw body: 
		
	-form body: 
	-json body: 
		None

POST request with query parameters, body key/value and custom header

curl -X POST 'http://localhost:8989/users?name=Jon&age=25' -H "X-Tag: 89" -d "password=toto1234" -d "firstname=Snow&sister=Aria"

New request:
	-path: /users
	-verb: POST
	-headers: 
		Content-Length = 44
		User-Agent = curl/7.43.0
		X-Tag = 89
		Host = localhost:8989
		Accept = */*
		Content-Type = application/x-www-form-urlencoded
	-query parameters: 
		age = 25
		name = Jon
	-raw body: 
		
	-form body: 
		sister = Aria
		password = toto1234
		firstname = Snow
	-json body: 
		None

PUT request with json body (custom Content-Type header) and custom header

curl -X PUT 'http://localhost:8989/users/Jon' -H "X-Tag: 89" -H "Content-type: application/json" -d '{ "age": 26 }'

New request:
	-path: /users/Jon
	-verb: PUT
	-headers: 
		Content-Length = 13
		User-Agent = curl/7.43.0
		X-Tag = 89
		Host = localhost:8989
		Accept = */*
		Content-Type = application/json
	-query parameters: 
	-raw body: 
		{ "age": 26 }
	-form body: 
	-json body: 
		{u'age': 26}

simple_rest_api's People

Contributors

papamuziko avatar

Stargazers

Esteban David avatar Martin avatar  avatar Electra Chong avatar

Watchers

James Cloos avatar  avatar Julien 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.