HTTP
Learn how to perform HTTP operations.
A newer version of this Book is avaliable via BDK.
Prerequisites
These operations are part of the HTTP Book. To use this Book, you need to first learn it in your agent.
Performing HTTP Operations
GET Requests
Retrieve a File at a URL
To retrieve a file from a specified URL, use the following commands:
the string is "https://example.com/data/report.pdf"
get a file at the string
the string is "http://www.example.org/images/photo.png"
get a file at the string
the url is "http://www.example.org/images/photo.png"
get a file at the url
Send a GET Request
To send a GET request to a specified URL, use the following commands:
the url is "https://api.example.com/data"
send a GET request to the url
the request's response
the url is "https://api.example.com/data"
the query text is "{\"key\": \"value\"}"
the header is "{\"Authorization\": \"Bearer token\"}"
the timeout is 30
send a GET request to the url with
the query text
the header
the timeout
the request's response
the url is "https://api.example.com/upload"
get the file
send a GET request to the url with
the data is the file
the request's response
POST Requests
Send a POST Request
To send a POST request to a specified URL, use the following commands:
set the url to "https://api.example.com/data"
set the header to "{\"Content-Type\": \"application/json\"}"
send a POST request to the url
the request's response
send a POST request to the url with
the url to "https://api.example.com/data"
the header to "{\"Content-Type\": \"application/json\"}"
the request's response
set the url to "https://api.example.com/upload"
get the file
send a POST request to the url with
the data is the file
the request's response
DELETE Requests
Send a DELETE Request
To send a DELETE request to a specified URL, use the following commands:
set the url to "https://api.example.com/items/12345"
send a DELETE request to the url
the request's response
set the url to "https://api.example.com/items"
set the query parameters to "{\"item_id\": \"12345\"}"
send a DELETE request to the url with
the query parameters
the request's response
set the url to "https://api.example.com/items/12345"
set the header to "{\"Authorization\": \"Bearer <token>\"}"
send a DELETE request to the url with
the header
the request's response
PATCH Requests
Send a PATCH Request
To send a PATCH request to a specified URL, use the following commands:
the url is "https://api.example.com/update"
send a PATCH request to the url with
the query parameters is "{\"id\": \"123\"}"
the header is "{\"Content-Type\": \"application/json\"}"
the request's response
the url is "https://api.example.com/files"
get the file
send a PATCH request to the url with
the data is the file
the request's response
PUT Requests
Send a PUT Request
To send a PUT request to a specified URL, use the following commands:
the url is "https://api.example.com/update"
send a PUT request to the url with
the query parameters is "{\"id\": \"123\"}"
the header is "{\"Content-Type\": \"application/json\"}"
the request's response
the url is "https://api.example.com/update"
get the file
send a PUT request to the url with
the data is the file
the request's response
HEAD Requests
Send a HEAD Request
To send a HEAD request to a specified URL, use the following commands:
the url is "https://example.com"
send a HEAD request to the url
the url is "https://example.com"
the query parameters is "{\"param1\":\"value1\", \"param2\":\"value2\"}"
the header is "{\"Authorization\":\"Bearer token\"}"
send a HEAD request to the url with
the timeout is 10
URL Manipulation
Convert Text to a URL
To convert a text string to a URL, use the following commands:
get the text "example.com"
get the text as a url
the text is "www.example.com/page"
get the text as a url
get the text as a url with
the text is "https://www.example.com"
get the text as an url where
the text is "https://www.example.com"
Create a URL
To create a URL with specific components, use the following commands:
create a url with
the domain is "api.example.com"
create a url with
the domain is "api.example.com"
the path is "/images"
the query is '{"search": true}'
the scheme is "https"
Updated 8 days ago