# Facebook

> Facebook。8 个工具，附参数和调用示例。

Source: https://piqline.com/zh/docs/api/reference/facebook

Facebook 智能体的工具：实时读取 Marketplace 商品和公开群组。

每次调用都是一个 `POST` 请求，密钥放在 `Authorization: Bearer` 中。JSON 请求体是工具的输入，响应形如 `{ "tool": "nom", "output": … }`。示例中只包含必填参数。参数说明与智能体读到的相同。

### `findMarketplaceLocation`

把城市或区域名称转换为 Marketplace 坐标。

`POST https://piqline.com/api/v1/tools/findMarketplaceLocation`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `query` | `string` | 是 | City or area name, e.g. 'Lyon' or 'Austin, Texas' |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/findMarketplaceLocation \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"levée de fonds"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/findMarketplaceLocation", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "query": "levée de fonds"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/findMarketplaceLocation",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "query": "levée de fonds",
    },
)
output = response.json()["output"]
```

### `searchMarketplace`

按关键词搜索某地（城市或坐标）周边的 Marketplace 公开商品，最多 3 页。

`POST https://piqline.com/api/v1/tools/searchMarketplace`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `query` | `string` | 是 | Search keyword(s) |
| `location` | `string` | 否 | City or area name; ignored when lat and lng are both given |
| `lat` | `number` | 否 |  |
| `lng` | `number` | 否 |  |
| `radiusKm` | `integer` | 否 |  |
| `minPrice` | `number` | 否 |  |
| `maxPrice` | `number` | 否 |  |
| `count` | `integer` | 否 |  |
| `pages` | `integer` | 否 | Pages to chain in one call (1 credit each); dedupes listings |
| `sortBy` | `suggested \| creation_time_descend \| distance_ascend \| price_ascend \| price_descend` | 否 |  |
| `delivery` | `all \| local_pickup \| shipping` | 否 |  |
| `condition` | `new \| used_like_new \| used_good \| used_fair` | 否 |  |
| `dateListed` | `all \| last_24_hours \| last_7_days \| last_30_days` | 否 |  |
| `availability` | `available \| sold \| all` | 否 |  |
| `categoryId` | `string` | 否 | Numeric Marketplace category id, as returned in listings |
| `exclude` | `array<string>` | 否 | Drop listings whose title contains any of these words (e.g. 'pièces', 'cadre seul') |
| `include` | `array<string>` | 否 | Keep only listings whose title contains at least one of these words |
| `cursor` | `string` | 否 | Opaque cursor from a previous page |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/searchMarketplace \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"levée de fonds"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/searchMarketplace", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "query": "levée de fonds"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/searchMarketplace",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "query": "levée de fonds",
    },
)
output = response.json()["output"]
```

### `getMarketplaceListing`

商品详情：描述、属性、照片、配送，以及 Facebook 提供时的确切日期。

`POST https://piqline.com/api/v1/tools/getMarketplaceListing`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `listing` | `string` | 是 | Listing id or Marketplace item URL |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getMarketplaceListing \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"listing":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getMarketplaceListing", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "listing": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/getMarketplaceListing",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "listing": "texte",
    },
)
output = response.json()["output"]
```

### `getMarketplaceListings`

一次获取 2 到 6 个商品的详情，以对比表格形式返回。

`POST https://piqline.com/api/v1/tools/getMarketplaceListings`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `listings` | `array<string>` | 是 | Listing ids or Marketplace item URLs |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getMarketplaceListings \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"listings":["texte"]}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getMarketplaceListings", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "listings": [
      "texte"
    ]
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/getMarketplaceListings",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "listings": [
            "texte",
        ],
    },
)
output = response.json()["output"]
```

### `getFacebookGroup`

群组的公开资料：隐私设置、规模、活跃度、分类、规则。

`POST https://piqline.com/api/v1/tools/getFacebookGroup`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `group` | `string` | 是 | Group URL, numeric id, or vanity slug |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getFacebookGroup \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"group":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getFacebookGroup", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "group": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/getFacebookGroup",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "group": "texte",
    },
)
output = response.json()["output"]
```

### `getFacebookGroupPosts`

公开群组的帖子，每页 3 条（最多 6 页）。

`POST https://piqline.com/api/v1/tools/getFacebookGroupPosts`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `group` | `string` | 是 | Group URL, numeric id, or vanity slug |
| `sortBy` | `CHRONOLOGICAL \| CHRONOLOGICAL_LISTINGS \| TOP_POSTS \| RECENT_ACTIVITY` | 否 |  |
| `pages` | `integer` | 否 |  |
| `keywords` | `array<string>` | 否 | Keep only posts containing at least one of these terms |
| `since` | `string` | 否 | ISO date; posts older than this are dropped and chronological paging stops there |
| `cursor` | `string` | 否 |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getFacebookGroupPosts \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"group":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getFacebookGroupPosts", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "group": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/getFacebookGroupPosts",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "group": "texte",
    },
)
output = response.json()["output"]
```

### `getFacebookPost`

公开帖子或 Reel 的详情：文本、作者、日期、互动、观看数。

`POST https://piqline.com/api/v1/tools/getFacebookPost`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `post` | `string` | 是 | Post or reel URL |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getFacebookPost \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"post":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getFacebookPost", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "post": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/getFacebookPost",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "post": "texte",
    },
)
output = response.json()["output"]
```

### `getFacebookPostComments`

公开帖子的评论，可按关键词筛选（最多 3 页）。

`POST https://piqline.com/api/v1/tools/getFacebookPostComments`

类型：实时读取。Scope：`explore`。

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `post` | `string` | 是 | Post or reel URL |
| `pages` | `integer` | 否 |  |
| `keywords` | `array<string>` | 否 |  |
| `cursor` | `string` | 否 |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getFacebookPostComments \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"post":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getFacebookPostComments", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "post": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/getFacebookPostComments",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "post": "texte",
    },
)
output = response.json()["output"]
```
