Difference between revisions of "RESTful and SOAP calls"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
 (Created page with "= Use curl to test RESTful API =   curl --insecure -X GET \   --header "Accept: application/json" \   --header "Authorization: Bearer geasrExampleTokengwsdvb" \   <nowiki>"htt...")  | 
				|||
| (8 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= Restful - specification =  | |||
RFC 3986 defines URIs as case-sensitive except for the scheme and host components. e.g.  | |||
;Resources  | |||
*[https://restfulapi.net/resource-naming/ Resource naming]  | |||
=[https://dev.to/inambe/how-http-works-2492 Basics of HTTP]=  | |||
= Use curl to test RESTful API =  | = Use curl to test RESTful API =  | ||
| Line 10: | Line 18: | ||
*<code>-X, --request <command></code> it defaults to GET commands, check HTTP1.1 specification for more  | *<code>-X, --request <command></code> it defaults to GET commands, check HTTP1.1 specification for more  | ||
*<code>-H, --header <header></code> (HTTP) Extra header to include in the request when sending HTTP to a server  | *<code>-H, --header <header></code> (HTTP) Extra header to include in the request when sending HTTP to a server  | ||
= Use Chrome addon Postman =  | |||
Run Chrome in ssl disable verification mode in case you hit CN url mismatch in SSL certificate  | |||
 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ignore-certificate-errors  | |||
= HTTP Prompt – An Interactive Command Line HTTP Client =  | |||
Install  | |||
<source lang=bash>  | |||
pip install http-prompt        #requires root and sudo is not advised  | |||
pip install --user http-prompt #local install in ~/.local/bin/http-prompt  | |||
</source>  | |||
Use  | |||
<source lang=bash>  | |||
http-prompt http://localhost:3000  | |||
http-prompt localhost:3000/api --auth user:pass username=somebody  | |||
</source>  | |||
[https://httpie.org/run HTTPie] online tool  | |||
<source lang=bash>  | |||
sudo apt-get install httpie  | |||
</source>  | |||
== Resources ==  | |||
*[http://http-prompt.com/ http-prompt.com]  | |||
*[https://www.tecmint.com/http-prompt-command-line-http-client/ http-prompt-command-line-http-client]  | |||
*[https://github.com/jakubroztocil/httpie HTTPie: a CLI, cURL-like tool for humans] Github  | |||
= References =  | = References =  | ||
*[http://www.codingpedia.org/ama/how-to-test-a-rest-api-from-command-line-with-curl/ How to test a REST api from command line with curl] codingpedia.org  | *[http://www.codingpedia.org/ama/how-to-test-a-rest-api-from-command-line-with-curl/ How to test a REST api from command line with curl] codingpedia.org  | ||
*[https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en Chrome Postan Addon] advanced UI addon to test Restful API. You may need to disable SSL verification in <tt>chrome://flags/#allow-insecure-localhost</tt>  | *[https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en Chrome Postan Addon] advanced UI addon to test Restful API. You may need to disable SSL verification in <tt>chrome://flags/#allow-insecure-localhost</tt>  | ||
*[http://peter.sh/experiments/chromium-command-line-switches/ List of Chromium Command Line Switches] Chrome command line options  | |||
Latest revision as of 09:53, 24 May 2020
Restful - specification
RFC 3986 defines URIs as case-sensitive except for the scheme and host components. e.g.
- Resources
 
Basics of HTTP
Use curl to test RESTful API
curl --insecure -X GET \ --header "Accept: application/json" \ --header "Authorization: Bearer geasrExampleTokengwsdvb" \ "https://host1.aws.example.com/ApiBaseLocation/v1/ApiName/Value"
Options explained
--insecuredisables ssl checks like the certificate chain check, etc.-X, --request <command>it defaults to GET commands, check HTTP1.1 specification for more-H, --header <header>(HTTP) Extra header to include in the request when sending HTTP to a server
Use Chrome addon Postman
Run Chrome in ssl disable verification mode in case you hit CN url mismatch in SSL certificate
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ignore-certificate-errors
HTTP Prompt – An Interactive Command Line HTTP Client
Install
pip install http-prompt #requires root and sudo is not advised pip install --user http-prompt #local install in ~/.local/bin/http-prompt
Use
http-prompt http://localhost:3000 http-prompt localhost:3000/api --auth user:pass username=somebody
HTTPie online tool
sudo apt-get install httpie
Resources
- http-prompt.com
 - http-prompt-command-line-http-client
 - HTTPie: a CLI, cURL-like tool for humans Github
 
References
- How to test a REST api from command line with curl codingpedia.org
 - Chrome Postan Addon advanced UI addon to test Restful API. You may need to disable SSL verification in chrome://flags/#allow-insecure-localhost
 - List of Chromium Command Line Switches Chrome command line options