HTTP Operations

Overview

This manual is divided into several sections, each focusing on a specific aspect of the Kognitos HTTP Operations Library.

Introduction

The Kognitos HTTP Operations Library provides a powerful and intuitive way to interact with web services and APIs. This library enables users to perform a wide range of HTTP operations, including GET, POST, DELETE, PATCH, PUT, and HEAD requests, as well as URL manipulation. By leveraging Kognitos' natural language processing capabilities, users can easily send requests, handle responses, and manage URLs. This section provides an overview of the Kognitos HTTP Operations Library and outlines the prerequisites for using it.

Prerequisites for Using Kognitos HTTP Operations Library

Before you can start using the Kognitos HTTP Operations Library, there are several prerequisites that need to be met:

  1. Kognitos Account: You need to have an active Kognitos account. If you do not have one, you can sign up for a Kognitos trial account to get started.
  2. Basic Understanding of HTTP Methods: While Kognitos simplifies interactions, having a basic understanding of HTTP methods (e.g., GET, POST, DELETE) and their purposes will help you automate more effectively with Kognitos.

Once these prerequisites are met, you are ready to start leveraging the power of Kognitos to enhance your web service interactions, making them more accessible, efficient, and customizable.


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"

Glossary of Terms

  • HTTP (Hypertext Transfer Protocol): The protocol used for transmitting hypertext requests and information on the internet.
  • URL (Uniform Resource Locator): The address of a web resource on the internet.
  • GET Request: An HTTP method used to request data from a specified resource.
  • POST Request: An HTTP method used to send data to a server to create/update a resource.
  • DELETE Request: An HTTP method used to delete a specified resource.
  • PATCH Request: An HTTP method used to apply partial modifications to a resource.
  • PUT Request: An HTTP method used to update a current resource with new data.
  • HEAD Request: An HTTP method used to retrieve the headers of a resource without the body content.
  • Header: Part of the HTTP request and response that carries additional information about the request or response.
  • Query Parameters: Key-value pairs added to the end of a URL to pass additional information to the server.

By following these guidelines, you can effectively manage HTTP operations and URL manipulations using the Kognitos HTTP Operations Library.