Deleting Marketplace Listings

Problem

I need to delete a Marketplace listing.

Solution

Use the Marketplace.removeListing() method:

$result = $facebook->api_client->marketplace_removeListing('1234567');

You can optionally specify a status to make it clear why the listing is being removed. Valid statuses are SUCCESS, DEFAULT, or NOT_SUCCESS (the default is, unsurprisingly, DEFAULT):

$result = $facebook->api_client->marketplace_removeListing('1234567', 'SUCCESS');

Discussion

You can also tag a uid on the end to specify whose listings you’re deleting if they are not the current loggedinuser (this will be ignored for desktop apps). Marketplace.removeListing() will return true (1) on success, and false (0) or an error on failure.

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.