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 / appel réussi
ID public: commerce.facebook.marketplace · Version 1
Tarifs
USD 0.001200 / appel réussi
Démarrage rapide
Recherchez cet outil avec votre clé API, puis inspectez le provider et le endpoint renvoyés avant de lancer une exécution.
Définissez GLOOP_API_BASE sur votre adresse API et GLOOP_API_KEY sur votre clé côté serveur.
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());Documentation API des outils · POST /v1/inspectSchéma d'entrée
{
"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"
}Schéma de sortie
{
"type": "object"
}