Skip to content
  • Why WPGetAPI?
  • Examples
  • Pricing
  • Plugins
    • PRO Plugin
    • API to Posts Plugin
    • OAuth 2.0 Plugin
  • Docs
  • Support
    • Frequently Asked Questions
    • Feature Request
    • Support Ticket
  • account_circle
PRO Plugin
Howdy! How can we help you?
  • Introduction

    • Quick Start
    • Frequently Asked Questions
    • Will this work with my API?
    • Understanding API docs
    • Step by Step Example
  • Setup

    • Setup Page
    • Endpoint Page
    • Parameters - Query String
    • Parameters - Headers
    • Parameters - Body POST
    • Shortcode
    • Template Tag
    • Gutenberg Block
  • Connecting your API

    • API Key in Headers
    • API Key in Query String
    • Authentication & Authorization
  • Output API Data

    • Format API to HTML
    • Format API to HTML Table
    • Format API to Image Gallery
    • Format JSON Data
  • Integrations

    • Send form data to API
    • WPForms to API
    • Gravity Forms to API
    • Contact Form 7 to API
    • WooCommerce to API
    • WooCommerce API Product Sync
    • wpDataTables to API
    • Connect WordPress to OpenAI
    • Connect RapidAPI to WordPress
    • Connect Zoho CRM to WordPress
    • Page Builders (Elementor, DIVI)
    • Formidable Forms to API
    • Elementor Form to API
    • JetFormBuilder to API
    • Fluent Forms to API
    • WS Form to API
    • Ninja Tables to API
    • Easy Digital Downloads(EDD) API Product Sync
    • Ultimate Member Forms to API
  • Tips & Tricks

    • Filters & Action Hooks
    • Code Snippets Plugin
    • Troubleshooting
    • Code Snippets
  • PRO Plugin

    • Installation
    • Actions
    • Tokens
    • Caching
    • Nested data
    • Chaining API calls
    • Dynamic Variables
    • Format API to HTML
    • Call API on user registration
    • Using AJAX to trigger API call
    • Base64 Encoding
    • Licensing
    • Filters & Action Hooks
  • OAuth 2.0 Plugin

    • Installation
    • How it works
    • Grant Type - Client Credentials
    • Grant Type - Authorization Code
    • Licensing
  • API to Posts Plugin

    • Installation
    • Getting Started
    • Multiple Endpoints
    • Mapping Fields
    • Filters & Action Hooks
    • Pagination

In this article we will look at how to read API documentation.

Every good API should be well documented and be fairly easy to understand, once you know how to read it properly.

Quick Examples

Below is an example from RapidAPI that shows what each part of their docs mean.


Below is an example from Huggingface that shows what each part of their docs mean.


OpenAI API documentation

We will firstly take a look at OpenAI’s documentation as their docs are clear and well written: https://beta.openai.com/docs/api-reference/introduction

The Introduction section tells us we “can interact with the API through HTTP requests from any language”. Perfect.

WordPress is built with PHP, which uses cURL to make the HTTP requests. We can simply ignore anything they say about Python, Node or other languages. We are only interested in cURL, PHP or HTTP, which we will see a little further down.

Scrolling down to the Authentication section will tell us how we need to authenticate ourselves to the API.

OpenAI uses the ‘Bearer’ method with your API key. But for other API’s, authentication could be via a secret key or a user:password combo or some other method. Most docs will have an Authentication section.

The OpenAI docs tell us that we need to include the API key in an Authorization header as shown below. The word Authorization is the ‘name’ of the header and the Bearer YOUR_API_KEY is the corresponding ‘value’. The colon is what separates the name:value.

To add this name:value pair in WPGetAPI, you simply need to fill in the name and value within the Headers fields as shown below. Simple!

You can also see below that you can add other headers into this section, such as the ‘Content-Type’ header.


Reading curl requests

If you scroll further down to the Making Requests section of the OpenAI docs, we can see a bunch code that might look a little odd. This is basically a list of cURL commands that will make a request to the https://api.openai.com/v1/completions API endpoint.

cURL is a command-line tool that allows us to make HTTP requests, which is really all an API request is. Some API docs will show other languages or provide an option to choose the language that you view the docs in, but for us we want to be looking at either cURL, HTTP or PHP commands usually.

The 4 lines below give us everything we need to make a request to the API.

How do we read this?

The word curl as well as the -H and the -D flags tell us where we need to add the pieces of information that follow them. Unfortunately, curl commands can be written in a number of different ways, so we need to look for the ‘clues’ that tell us what we need to do.

Let’s break down each line and see what they mean.

Line 1: The word curl on it’s own, followed directly by the URL will tell us we need to send the request to https://api.openai.com/v1/completions

Line 2: The -H flag indicates that we need to add Content-Type:application/json as a header like we did earlier.

Line 3: Again we have the -H flag that indicates we add the Authorization as a header

Line 4: The -d flag is short for -data and tells us we need to send the data in this line within the Body POST fields. And because we are sending data in the Body POST fields, we know that this will be a POST request.

Setting up this OpenAI endpoint using WPGetAPI should look something like the below.

You will also notice that we have set the temperature as float(0.7) – this float() keyword is a special function that we can add to the parameters. It will simply send the value of 0.7 as a float value rather than a string, as OpenAI requires it this way.

Once saved, you can hit the ‘Test Endpoint’ button to see if it was successful.

 

On this page
contact_support

Still not sure?

APIs can be daunting and sometimes downright confusing.

But we are here to help! Our support is amazing and we can assist you with any setup required and ensure your API integrations are a success!

Ask Us Anything

Connect your WordPress website to external APIs without writing a single line of code. Send data from WordPress to your API or display data from your API within WordPress.

Support

  • Documentation
  • Support Ticket
  • Refund Policy
  • Contact Us
  • About Us
  • Affiliates

Articles

  • Quick Start Guide
  • WooCommerce Orders to API
  • WooCommerce API Products Sync
  • Contact Form 7 to API
  • WPForms to API
  • Gravity Forms to API
  • WordPress to RapidAPI

WordPress API Plugins

  • Free WPGetAPI Plugin
  • PRO Plugin
  • API to Posts Plugin Plugin
  • OAuth 2.0 Authorization Plugin

© 2025 WPGetAPI. All Rights Reserved.

"*" indicates required fields

Name*
This field is for validation purposes and should be left unchanged.