=== Apitect API Feed Display ===
Contributors: phpinterview1991
Tags: api, rest api, json, xml, shortcode
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fetch, cache, and display data from any external REST API or XML source via shortcode, sidebar widget, or Gutenberg block.

== Description ==

Apitect API Feed Display lets you connect to any external REST API or XML feed and display the response data anywhere on your WordPress site — no coding required.

**Key Features:**

* **Admin Endpoint Manager** — Add, edit, delete, and live-test saved API endpoints
* **JSON & XML Support** — Auto-detect or manually specify the response format
* **Response Caching** — Configurable TTL using the WordPress Transients API
* **4 Display Modes** — Table, Cards, List, or Raw JSON
* **Shortcode** — `[apitect_feed]` with rich attribute support
* **Sidebar Widget** — Display any saved endpoint in any widget area
* **Gutenberg Block** — Drag-and-drop block with live editor preview
* **Custom HTTP Headers** — Bearer tokens, API keys, and custom headers per endpoint
* **Data Path Drilling** — Dot-notation to target nested data (e.g. `data.items`)
* **Field Filtering** — Show only specific keys from the response
* **Item Limiting** — Restrict the number of rows or cards displayed

== Installation ==

1. Upload the `apitect-api-feed-display` folder to `/wp-content/plugins/`, or install via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **Apitect Feed** in your admin sidebar to add your first endpoint.

== External Services ==

This plugin connects to external APIs and services that you configure yourself. No external service is contacted by default — connections only occur when you explicitly add an endpoint URL in the plugin's admin settings and that endpoint is requested on your site.

**What data is sent:**
The plugin makes HTTP requests (GET, POST, etc.) to the API URLs you configure. The request may include any custom HTTP headers you specify (such as API keys or Bearer tokens). No data is sent to any third-party service by Apitect API Feed Display itself — all API calls go directly to the URL you enter.

**When data is sent:**
A request is made to your configured API URL when:
- A page/post containing the `[apitect_feed]` shortcode or the Gutenberg block is loaded by a visitor.
- You use the "Test" button in the admin panel to preview a response.
- A sidebar widget configured with an endpoint is displayed.

Responses are cached using WordPress Transients to reduce repeated API calls (configurable per endpoint; default 300 seconds).

**Third-party API policies:**
You are solely responsible for ensuring that your use of any external API complies with that service's terms of service and privacy policy. Please review the terms and privacy policy of any API you connect to:

- The plugin has no affiliation with any external API provider.
- API providers may log IP addresses, request metadata, or other information per their own policies.
- For APIs that handle personal data, ensure you have appropriate disclosures in your site's own Privacy Policy.

== Frequently Asked Questions ==

= Can I use it with authenticated APIs? =
Yes. Add your `Authorization: Bearer TOKEN` or `X-Api-Key: KEY` header in the endpoint configuration form.

= Where is cached data stored? =
In WordPress Transients (the `wp_options` table). You can clear all plugin caches at any time from the **Apitect Feed** admin page.

= How do I target nested data in the response? =
Use the `path` attribute with dot-notation. For a response like `{ "data": { "users": [...] } }`, use `path="data.users"`.

= Does it support POST requests? =
Yes. Set the HTTP method to POST and provide your request body (usually JSON) in the endpoint form.

= What display modes are available? =
Table, Cards, List, and Raw JSON. The renderer auto-links URLs found in data values.

= Does the plugin send any data to the plugin author? =
No. The plugin makes no calls to any server controlled by the plugin author. All API requests go directly to the URLs you configure.

== Shortcode Reference ==

Basic usage:
`[apitect_feed id="my-endpoint"]`

With options:
`[apitect_feed id="my-endpoint" display="card" limit="5" fields="id,name,email" title="Users"]`

Ad-hoc URL (no saved endpoint needed):
`[apitect_feed url="https://jsonplaceholder.typicode.com/users" format="json" display="table"]`

**Available attributes:**

* `id` — ID of a saved endpoint
* `url` — Ad-hoc API URL (used when no `id` is provided)
* `method` — HTTP method, default `GET`
* `format` — `auto`, `json`, or `xml` (default `auto`)
* `cache_ttl` — Cache duration in seconds, default `300` (0 = disabled)
* `display` — `table`, `card`, `list`, or `raw` (default `table`)
* `path` — Dot-notation path into the response, e.g. `data.items`
* `limit` — Maximum number of items to show (0 = all)
* `fields` — Comma-separated list of keys to display
* `title` — Optional heading rendered above the output

== Screenshots ==

1. Admin endpoint manager with saved endpoints list
2. Add/Edit endpoint form with live test feature
3. Table display mode on the frontend
4. Card display mode on the frontend
5. Gutenberg block with sidebar controls

== Changelog ==

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade steps required.
