Zapier can post something like this when tickets are cancelled
    {
        "ticket_type": "Individual (Regular)",
        "barcode": "12345678",
        "email": "demo@example.com"
    }
767175
def zapier_cancel_hook(request):
    '''
    
    '''
    if request.META.get('HTTP_X_ZAPIER_SECRET', None) != settings.WAFER_TICKETS_SECRET:
        raise PermissionDenied('Incorrect secret')

    # This is required for python 3, and in theory fine on python 2
    payload = json.loads(request.body.decode('utf8'))
    ticket = Ticket.objects.filter(barcode=payload['barcode'])
    if ticket.exists():
        # delete the ticket
        ticket.delete()
    return HttpResponse("Cancelled\n", content_type='text/plain')
1325965
def get_attachments_ids(self, ticket_id):
        
        attachments = self.get_attachments(ticket_id)
        return [int(at[0]) for at in attachments] if attachments else attachments
1663
def get_ticket(self, service):
        """"""
        return self.auth_tickets \
            .filter(expires__gt=datetime.now(timezone.utc), service=service) \
            .last()
249262
def cancel_room(self, booking_id):
        
        resp = self._request("POST", "/1.1/space/cancel/{}".format(booking_id))
        return resp.json()
963350
def bind(self, ticket, device_id, user_id):
        
        return self._post(
            'bind',
            data={
                'ticket': ticket,
                'device_id': device_id,
                'openid': user_id
            }
        )
386152
def create_ticket(self, subject, **kwargs):
        

        url = 'tickets'
        status = kwargs.get('status', 2)
        priority = kwargs.get('priority', 1)
        data = {
            'subject': subject,
            'status': status,
            'priority': priority,
        }
        data.update(kwargs)
        if 'attachments' in data:
            ticket = self._create_ticket_with_attachment(url, data)
            return Ticket(**ticket)

        ticket = self._api._post(url, data=json.dumps(data))
        return Ticket(**ticket)
12022
function(err){
                client.del(recommendedZSet, function(err){
                  async.each(scoreMap,
                    function(scorePair, callback){
                      client.zadd(recommendedZSet, scorePair[0], scorePair[1], function(err){
                        callback();
                      });
                    },
                    // after all the additions have been made to the recommended set,
                    function(err){
                      client.del(tempAllLikedSet, function(err){
                        client.zcard(recommendedZSet, function(err, length){
                          client.zremrangebyrank(recommendedZSet, 0, length-config.numOfRecsStore-1, function(err){
                            cb();
                          });
                        });
                      });
                    }
                  );
                });
              }
784661
private function _ticketChange($options = [], $action = 'answer', $batch = true)
    {
        try {
            Thread::perform($action, $options, ['batch' => $batch]);
        } catch (ResponseErrorException $e) {
            return false;
        }

        return true;
    }
777002
def zendesk_ticket(self):
        
        if self.api and self.zendesk_ticket_id:
            return self.api._get_zendesk_ticket(self.zendesk_ticket_id)
25398
def create_ticket(subject, tags, ticket_body, requester_email=None,
                  custom_fields=[]):
    

    payload = {'ticket': {
        'subject': subject,
        'comment': {
            'body': ticket_body
        },
        'group_id': settings.ZENDESK_GROUP_ID,
        'tags': tags,
        'custom_fields': custom_fields
    }}

    if requester_email:
        payload['ticket']['requester'] = {
            'name': 'Sender: %s' % requester_email.split('@')[0],
            'email': requester_email,
        }
    else:
        payload['ticket']['requester_id'] = settings.ZENDESK_REQUESTER_ID

    requests.post(
        get_ticket_endpoint(),
        data=json.dumps(payload),
        auth=zendesk_auth(),
        headers={'content-type': 'application/json'}).raise_for_status()
512870
public function onBeforeWrite()
    {
        // Set the title of the attendee
        $this->Title = $this->getName();

        // Generate the ticket code
        if ($this->exists() && empty($this->TicketCode)) {
            $this->TicketCode = $this->generateTicketCode();
        }

        if (
            $this->getEmail()
            && $this->getName()
            && !$this->TicketFile()->exists()
            && !$this->TicketQRCode()->exists()
        ) {
            $this->createQRCode();
            $this->createTicketFile();
        }

        if ($fields = $this->Fields()) {
            foreach ($fields as $field) {
                if ($value = $this->{"$field->Name[$field->ID]"}) {
                    //$cache = self::getCacheFactory();
                    //$cache->save(serialize($value), $this->getFieldCacheKey($field));
                    $fields->add($field->ID, array('Value' => $value));
                }
            }
        }

        parent::onBeforeWrite();
    }
433591
def post_event_ticket_class(self, id, ticket_class_id, **data):
        
        
        return self.post("/events/{0}/ticket_classes/{0}/".format(id,ticket_class_id), data=data)
1282757
def create_ticket_str(self, prefix=None):
        
        if not prefix:
            prefix = self.model.TICKET_PREFIX
        return "%s-%d-%s" % (prefix, int(time.time()),
                             get_random_string(length=self.model.TICKET_RAND_LEN))
667689
def tickets(self, view, include=None):
        
        return self._get(self._build_url(self.endpoint.tickets(id=view, include=include)))
535057
def ticket_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/tickets/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
883068
def create_outbound_email(self, subject, description, email, email_config_id, **kwargs):
        """"""
        url = 'tickets/outbound_email'
        priority = kwargs.get('priority', 1)
        data = {
            'subject': subject,
            'description': description,
            'priority': priority,
            'email': email,
            'email_config_id': email_config_id,
        }
        data.update(kwargs)
        ticket = self._api._post(url, data=json.dumps(data))
        return Ticket(**ticket)
948028
def ticket_field_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/ticket_fields.json"
        return self.call(api_path, method="POST", data=data, **kwargs)