Difference between revisions of "HTTPie"

From RHS Wiki
Jump to navigation Jump to search
(Created page with "= HTTPie = Alternative to curl == Install == sudo apt install httpie == GET == http 127.0.0.1:8000 == POST == http --follow POST 127.0.0.1:8000/auth/api-token-auth/ http...")
 
Tag: visualeditor
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= HTTPie =
+
=[https://httpie.org/doc HTTPie]=
 
Alternative to curl
 
Alternative to curl
== Install ==
+
==Install==
 
  sudo apt install httpie
 
  sudo apt install httpie
== GET ==
+
==GET==
 
  http 127.0.0.1:8000
 
  http 127.0.0.1:8000
 +
http --follow GET 127.0.0.1:8000/ 'Authorization: Bearer ey**...**Sg'
  
== POST ==
+
=== get with parameters ===
 +
<syntaxhighlight lang="bash">
 +
echo '{"query": {"match_all": {}}}' | http GET :9200/_count?pretty
 +
</syntaxhighlight>
 +
 
 +
==POST==
 
  http --follow POST 127.0.0.1:8000/auth/api-token-auth/
 
  http --follow POST 127.0.0.1:8000/auth/api-token-auth/
 
  http --follow POST 127.0.0.1:8000/auth/api-token-auth/ username=rafa password=1234qwer
 
  http --follow POST 127.0.0.1:8000/auth/api-token-auth/ username=rafa password=1234qwer

Latest revision as of 09:43, 15 April 2019

HTTPie[edit]

Alternative to curl

Install[edit]

sudo apt install httpie

GET[edit]

http 127.0.0.1:8000
http --follow GET 127.0.0.1:8000/ 'Authorization: Bearer ey**...**Sg'

get with parameters[edit]

echo '{"query": {"match_all": {}}}' | http GET :9200/_count?pretty

POST[edit]

http --follow POST 127.0.0.1:8000/auth/api-token-auth/
http --follow POST 127.0.0.1:8000/auth/api-token-auth/ username=rafa password=1234qwer