Difference between revisions of "Offerit REST API Set Affiliate Payvia Info"
From Offerit
OfferitDave (talk | contribs) (Created page with "{{Offerit Manual | show_api_admin_section = true }} == '''PATCH /affiliate/setpayviainfo''' == '''Description''' *The /affiliate/setpayviainfo action is a feature in Offer...") |
Offeritnick (talk | contribs) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Offerit Manual | {{Offerit Manual | ||
| − | | | + | | show_rest_api_section = true |
}} | }} | ||
| − | == '''PATCH /affiliate/ | + | == '''PATCH /affiliate/payvia''' == |
'''Description''' | '''Description''' | ||
| − | *The /affiliate/ | + | *The /affiliate/payvia action is a feature in [[Offerit]] that allows you to set the affiliate payvia info settings |
'''Resource URL''' | '''Resource URL''' | ||
| − | *<nowiki>http://domain/api/affiliate/ | + | *<nowiki>http://domain/api/affiliate/payvia</nowiki> |
*Replace domain with the offerit domain | *Replace domain with the offerit domain | ||
| Line 39: | Line 39: | ||
'''PATCH''' | '''PATCH''' | ||
| − | <nowiki>http://domain/api/affiliate/ | + | <nowiki>http://domain/api/affiliate/payvia</nowiki> |
*Response: | *Response: | ||
| Line 82: | Line 82: | ||
); | ); | ||
| − | $url = 'http://domain/api/affiliate/ | + | $url = 'http://domain/api/affiliate/payvia'; |
$headers = array( | $headers = array( | ||
| Line 95: | Line 95: | ||
$resp = curl_exec($curl); | $resp = curl_exec($curl); | ||
| − | //dumps an associative array representation of the json | + | //dumps an associative array representation of the json response |
| − | + | $output = json_decode($resp, true); | |
| + | if($output !== NULL) { | ||
| + | //json was valid. Dump the decoded array | ||
| + | print_r($output); | ||
| + | } | ||
| + | else { | ||
| + | //invalid json, just dump the raw response | ||
| + | print_r($resp); | ||
| + | } | ||
// Close request to clear up some resources | // Close request to clear up some resources | ||
curl_close($curl); | curl_close($curl); | ||
Latest revision as of 16:23, 12 May 2017
PATCH /affiliate/payvia
Description
- The /affiliate/payvia action is a feature in Offerit that allows you to set the affiliate payvia info settings
Resource URL
- http://domain/api/affiliate/payvia
- 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
- loginid: is the affiliates loginid
- type: string
- required
- payvia_type_id: is the id of the payvia that the loginid should be switched to
- type: string
- required
- payvia_info: is an array containing arrays of info to update for the payvia type.
- type: array
- required
Example Request
PATCH
http://domain/api/affiliate/payvia
- Response:
[
{
"field":"Payvia Type",
"result":"Updated Payvia Type to 1 for loginid 1"
},
{
"field":"Pay To",
"result":"Updated Payvia Info: 'Pay To' is now 'TestPayTo'"
},
{
"field":"Address",
"result":"Updated Payvia Info: 'Address' is now 'Riga, Latvia'"
}
]
Example Code
PHP
<?php
$curl = curl_init();
$payvia_info = array();
$payvia_info[] = array(
'field' => 'Pay To',
'value' => 'TestPayTo'
);
$payvia_info[] = array(
'field' => 'Address',
'value' => 'Riga, Latvia'
);
$data = array(
'loginid' => 1,
'payvia_type_id' => '1',
'payvia_info' => $payvia_info
);
$url = 'http://domain/api/affiliate/payvia';
$headers = array(
'api-key: 44b5498dbcb481a0d00b404c0169af62',
'api-username: productsupport'
);
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 response
$output = json_decode($resp, true);
if($output !== NULL) {
//json was valid. Dump the decoded array
print_r($output);
}
else {
//invalid json, just dump the raw response
print_r($resp);
}
// Close request to clear up some resources
curl_close($curl);
?>