Facebook Marketplace API

Search Facebook Marketplace listings by keyword near a location, filter by price, condition, delivery, recency, and availability, and get title, price, location, and image as normalized JSON.

USD 0.001200 / 次成功呼叫

公開 ID: commerce.facebook.marketplace · 版本 1

定價

USD 0.001200 / 次成功呼叫

快速開始

使用 API 金鑰探索此工具,再透過回傳的 provider 和 endpoint 檢查介面後執行。

將 GLOOP_API_BASE 設為 API 位址,GLOOP_API_KEY 設為伺服器端金鑰。

curl

curl --fail-with-body "${GLOOP_API_BASE%/}/v1/discover" \
  -H "Authorization: Bearer $GLOOP_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit": 5,
  "query": "Facebook Marketplace"
}'

Python

import os, json, urllib.request

url = os.environ['GLOOP_API_BASE'].rstrip('/') + "/v1/discover"
headers = {'Authorization': 'Bearer ' + os.environ['GLOOP_API_KEY']}
headers['Content-Type'] = 'application/json'
data = "{\n  \"limit\": 5,\n  \"query\": \"Facebook Marketplace\"\n}".encode('utf-8')
request = urllib.request.Request(url, data=data, headers=headers)
with urllib.request.urlopen(request) as response:
    print(json.load(response))

Node.js

const url = process.env.GLOOP_API_BASE.replace(/\/$/, '') + "/v1/discover";
const headers = { Authorization: `Bearer ${process.env.GLOOP_API_KEY}` };
headers['Content-Type'] = 'application/json';
const response = await fetch(url, { method: 'POST', headers, body: JSON.stringify({
  "limit": 5,
  "query": "Facebook Marketplace"
}) });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
工具 API 文件 · POST /v1/inspect

輸入結構

{
  "additionalProperties": false,
  "properties": {
    "availability": {
      "description": "Filter by availability: available (default), sold, or all (e.g. sold).",
      "enum": [
        "available",
        "sold",
        "all"
      ],
      "type": "string"
    },
    "condition": {
      "description": "Only return listings in this condition (e.g. used_good).",
      "enum": [
        "new",
        "used_like_new",
        "used_good",
        "used_fair"
      ],
      "type": "string"
    },
    "cursor": {
      "description": "Pagination cursor from a previous response to fetch the next page.",
      "type": "string"
    },
    "dateListed": {
      "description": "Only return listings posted within this window (e.g. last_7_days).",
      "enum": [
        "all",
        "last_24_hours",
        "last_7_days",
        "last_30_days"
      ],
      "type": "string"
    },
    "deliveryMethod": {
      "description": "Only return listings offering this delivery method (e.g. shipping).",
      "enum": [
        "all",
        "local_pickup",
        "shipping"
      ],
      "type": "string"
    },
    "lat": {
      "description": "Latitude of the search location (e.g. '30.2677').",
      "type": "string"
    },
    "lng": {
      "description": "Longitude of the search location (e.g. '-97.7475').",
      "type": "string"
    },
    "priceMax": {
      "description": "Maximum listing price in whole currency units, e.g. 500 for $500. Facebook may mix in a few suggested listings outside the range.",
      "minimum": 0,
      "type": "integer"
    },
    "priceMin": {
      "description": "Minimum listing price in whole currency units, e.g. 100 for $100. Facebook may mix in a few suggested listings outside the range.",
      "minimum": 0,
      "type": "integer"
    },
    "query": {
      "description": "Search keyword for Marketplace listings (e.g. 'bike').",
      "type": "string"
    },
    "sort": {
      "description": "Sort order for the returned listings (e.g. price_ascend).",
      "enum": [
        "suggested",
        "distance_ascend",
        "creation_time_descend",
        "price_ascend",
        "price_descend"
      ],
      "type": "string"
    }
  },
  "required": [
    "query",
    "lat",
    "lng"
  ],
  "title": "Facebook Marketplace input",
  "type": "object"
}

輸出結構

{
  "type": "object"
}

同類型工具