[Python] Meta (Facebook) API - products - start_date and "Date of last edit" field

Discussão em 'Python' iniciado por Stack, Maio 29, 2025.

  1. Stack

    Stack Membro Participativo

    I have been reading the following page of Meta (Facebook): https://developers.facebook.com/docs/marketing-api/reference/product-item/ this is the page for products.

    There is a field start_date string Date when the product started to exist

    when I write python code to get this field for products that I have added in a Facebook catalog through the Facebook Commerce Manager, it returns no value. I tried it also with the Graph Explorer, and the same issue happens there.

    Furthermore, in the Commerce Manager, there is a field "date of last edit", but I can't seem to find a way to get this field with code as well.

    [​IMG]

    Can you help me get these two fields using code?

    Here is the code I currently have:

    def fetch_products_from_catalog(access_token: str, catalog_id: str):
    try:
    print('Fetching products for catalog id: ', catalog_id)
    url = f"https://graph.facebook.com/v22.0/{catalog_id}/products"
    params = {
    "access_token": access_token,
    "fields": "id,retailer_id,name,price,sale_price,category,start_date"
    }
    products = []
    while url:
    response = requests.get(url, params=params)
    response.raise_for_status()
    data = response.json()
    products.extend(data.get("data", []))
    url = data.get("paging", {}).get("next")
    params = {} # Only needed for the first request
    print('Products: ', products)
    return products
    except Exception as e:
    raise Exception(f"Error fetching products from catalog: {e}")

    Continue reading...

Compartilhe esta Página