Offerit REST API Forget Customer
From Offerit
Revision as of 13:46, 31 August 2018 by OfferitDave (talk | contribs) (Created page with "{{Offerit Manual | show_rest_api_section = true }} == '''PATCH /customer/forget''' == '''Description''' *The api/customer/forget action is a feature in Offerit that allows y...")
PATCH /customer/forget
Description
- The api/customer/forget action is a feature in Offerit that allows you to forget identifying details of a customer
Resource URL
- http://domain/api/customer/forget
- Replace domain with the offerit domain
- PATCH
Response Format
- JSON
- HTTP headers
Parameters
Paremeters must be sent with the request body. The examples below show the parameters sent as x-www-form-urlencoded
You need to pass either customer_id or subscription_id or orderid for customer lookup otherwise the call will fail
- customer_id is used to pass in the customer_id of the customer to modify
- type: string
- optional
- subscription_id is used to pass in the subscription of the customer to modify
- type: string
- optional
- orderid is used to pass in the event id of one of the transactions associated with the customer to modify
- type: string
- optional
- keep - Comma separated list of fields to preserve
- type: string
- optional
- possible field names:
- username
- token_hash
- original_username
- password
- cryptpass
- session
- firstname
- lastname
- address1
- address2
- city
- state
- zip
- country
- shipping_firstname
- shipping_lastname
- shipping_address1
- shipping_address2
- shipping_zip
- shipping_city
- shipping_state
- shipping_country
- phone
- possible table names:
- member_auth
- member_note
Example Request
PATCH
http://domain/api/customer/forget
- Response:
true
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'customer_id' => 191, ); $url = 'http://domain/api/customer/forget'; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: offerit_admin' ); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($curl, CURLOPT_URL, $url); $resp = curl_exec($curl); //dumps an associative array representation of the json var_dump(json_decode($resp, true)); // Close request to clear up some resources curl_close($curl); ?>
Python
- This example requires pip and the request library which can be installed via pip by: 'pip install requests'
import requests import json url = 'http://domain/api/customer/forget' payload = { 'customer_id': 191, } headers = { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'offerit_admin' } res = requests.patch(url, data=payload, headers=headers) print res.json()
node.js
- This example requires npm and the request module which can be installed via npm by: 'npm install request'
var request = require('request'); data = { 'customer_id': 191, } var options = { url: 'http://domain/api/customer/forget', method: 'PATCH', form: data, json: true, headers: { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'offerit_admin' } }; function callback(error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } else{ console.log(body); } } request(options, callback);
Curl
curl -X PATCH 'http://domain/api/customer/forget' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: offerit_admin" -H "Content-Type: application/x-www-form-urlencoded" -d 'customer_id=191'