@DELETE('^/api/v1/contracts')
    @authenticated
    def delete_contract(self, request):
        try:
            if "id" in request.args:
                file_path = self.db.filemap.get_file(request.args["id"][0])
                with open(file_path, 'r') as filename:
                    contract = json.load(filename, object_pairs_hook=OrderedDict)
                c = Contract(self.db, contract=contract)
                if "keywords" in c.contract["vendor_offer"]["listing"]["item"]:
                    for keyword in c.contract["vendor_offer"]["listing"]["item"]["keywords"]:
                        if keyword != "":
                            if isinstance(keyword, unicode):
                                keyword = keyword.encode('utf8')
                            self.kserver.delete(keyword.lower(), unhexlify(c.get_contract_id()),
                                                self.keychain.signing_key.sign(
                                                    unhexlify(c.get_contract_id()))[:64])
                if "delete_images" in request.args:
                    c.delete(delete_images=True)
                else:
                    c.delete()
            request.write(json.dumps({"success": True}))
            request.finish()
            return server.NOT_DONE_YET
        except Exception, e:
            request.write(json.dumps({"success": False, "reason": e.message}, indent=4))
            request.finish()
            return server.NOT_DONE_YET
dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/api/restapi.py/OpenBazaarAPI.delete_contract/original