Skip to content

Commit aa47246

Browse files
minor fixes
1 parent e4af711 commit aa47246

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/content/docs/browser-rendering/rest-api/json-endpoint.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
22
pcx_content_type: how-to
3-
title: Capture Webpage Data in JSON Format
3+
title: Capture webpage data in JSON format
44
sidebar:
55
order: 9
66
---
77

8-
The `/json` endpoint extracts structured data from a webpage. You can specify the expected output using either a **prompt** or a **response_format** parameter (which accepts a JSON schema). The endpoint returns the extracted data in JSON format.
8+
The `/json` endpoint extracts structured data from a webpage. You can specify the expected output using either a `prompt` or a `response_format` parameter which accepts a JSON schema. The endpoint returns the extracted data in JSON format.
99

1010
## Parameters
1111

12-
| Parameter | Mandatory | Note |
13-
| ------------------- | --------- | -------------------------------------------------------------------------------- |
14-
| **url** | **yes** | The URL of the webpage to extract data from. |
15-
| **prompt** | **no** | **Must supply one of `prompt` or `response_format`**. |
16-
| **response_format** | **no** | **Must supply one of `prompt` or `response_format`**. May include a JSON schema. |
12+
| Parameter | Mandatory | Note |
13+
| --------------- | --------- | ---------------------------------------------------------------------------- |
14+
| url | yes | The URL of the webpage to extract data from. |
15+
| prompt | no | Must supply one of `prompt` or `response_format`. |
16+
| response_format | no | Must supply one of `prompt` or `response_format`. May include a JSON schema. |
1717

18-
## Basic Usage
18+
## Basic usage
1919

20-
### With a Prompt and JSON Schema
20+
### With a prompt and JSON schema
2121

2222
This example captures webpage data by providing both a prompt and a JSON schema. If multiple headings exist, the first occurrence of each (e.g. `h1`, `h2`) is returned.
2323

@@ -48,7 +48,7 @@ curl --request POST 'https://api.cloudflare.com/client/v4/accounts/CF_ACCOUNT_ID
4848
}'
4949
```
5050

51-
#### JSON Response
51+
#### JSON response
5252

5353
```json title="json response"
5454
{
@@ -60,7 +60,7 @@ curl --request POST 'https://api.cloudflare.com/client/v4/accounts/CF_ACCOUNT_ID
6060
}
6161
```
6262

63-
### With Only a Prompt
63+
### With only a prompt
6464

6565
In this example, only a prompt is provided. The endpoint will use the prompt to extract the heading information from the page.
6666

@@ -74,7 +74,7 @@ curl --request POST 'https://api.cloudflare.com/client/v4/accounts/CF_ACCOUNT_ID
7474
}'
7575
```
7676

77-
#### JSON Response
77+
#### JSON response
7878

7979
```json title="json response"
8080
{
@@ -86,7 +86,7 @@ curl --request POST 'https://api.cloudflare.com/client/v4/accounts/CF_ACCOUNT_ID
8686
}
8787
```
8888

89-
### With Only a JSON Schema (No Prompt)
89+
### With only a JSON schema (no prompt)
9090

9191
In this case, you supply a JSON schema via the `response_format` parameter. The schema defines the structure of the extracted data.
9292

@@ -116,7 +116,7 @@ curl --request POST 'https://api.cloudflare.com/client/v4/accounts/CF_ACCOUNT_ID
116116
}'
117117
```
118118

119-
#### JSON Response
119+
#### JSON response
120120

121121
```json title="json response"
122122
{
@@ -128,7 +128,7 @@ curl --request POST 'https://api.cloudflare.com/client/v4/accounts/CF_ACCOUNT_ID
128128
}
129129
```
130130

131-
## Potential Use-Cases
131+
## Potential use-cases
132132

133133
1. **Extract Movie Data:** Retrieve details like name, genre, and release date for the top 10 action movies from the IMDB top 250 list by supplying the appropriate IMDB link and JSON schema.
134134
2. **Weather Information:** Fetch current weather conditions for a location (e.g., Edinburgh) using a weather website link (like from BBC Weather).

0 commit comments

Comments
 (0)