Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples of coreBOSCP REST enhancements: issues #160, #159, #161, #15…
…6, #155, #151, #150
- Loading branch information
Showing
7 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
//name of the module for which to retrieve the entity ID | ||
$moduleName = 'Contacts'; | ||
|
||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'vtyiicpng_getWSEntityId', | ||
"entityName"=>$moduleName); | ||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) Update",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response, true); | ||
$dmsg.= debugmsg("Webservice response Update",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('failed:'.$jsonResponse['error']['message']); | ||
echo 'failed!'; | ||
} else { | ||
$savedObject = $jsonResponse['result']; | ||
var_dump($savedObject); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
// list of IDS for which to retrieve the reference | ||
$ids = array('12x22','12x23','10x32','10x33'); | ||
$pids = serialize($ids); // to convert into a flat object string | ||
|
||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'getReferenceValue', | ||
"id"=>$pids); | ||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) Update",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response, true); | ||
$dmsg.= debugmsg("Webservice response Update",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('failed:'.$jsonResponse['error']['message']); | ||
echo 'failed!'; | ||
} else { | ||
$refs = unserialize($jsonResponse['result']); | ||
var_dump($refs); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
//name of the module for which to retrieve the entity ID | ||
$moduleName = 'Accounts'; | ||
|
||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'getPicklistValues', | ||
"module"=>$moduleName); | ||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) Update",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response, true); | ||
$dmsg.= debugmsg("Webservice response Update",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('failed:'.$jsonResponse['error']['message']); | ||
echo 'failed!'; | ||
} else { | ||
$vals = unserialize($jsonResponse['result']); | ||
var_dump($vals); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
//name of the module for which to retrieve the entity ID | ||
$moduleName = 'Accounts'; | ||
|
||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'getUItypes', | ||
"module"=>$moduleName); | ||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) Update",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response, true); | ||
$dmsg.= debugmsg("Webservice response Update",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('failed:'.$jsonResponse['error']['message']); | ||
echo 'failed!'; | ||
} else { | ||
$vals = unserialize($jsonResponse['result']); | ||
var_dump($vals); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
//name of the module for which to retrieve the entity ID | ||
$moduleName = 'Accounts'; | ||
|
||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'getfilterfields', | ||
"module"=>$moduleName); | ||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) Update",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response, true); | ||
$dmsg.= debugmsg("Webservice response Update",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('failed:'.$jsonResponse['error']['message']); | ||
echo 'failed!'; | ||
} else { | ||
$vals = $jsonResponse['result']; | ||
var_dump($vals); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
$translate = array( | ||
'Accounts'=>'Accounts', | ||
'LBL_LIST_ACCOUNT_NAME'=>'LBL_LIST_ACCOUNT_NAME', | ||
'Portal User'=>'Client Portal User', | ||
); | ||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'gettranslation', | ||
"totranslate"=> json_encode($translate), | ||
'language'=>'es_es', | ||
'module'=>'Contacts' | ||
); | ||
|
||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) GetTranslation",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response,true); | ||
$dmsg.= debugmsg("Webservice response GetTranslation",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('GetTranslation failed: '.$jsonResponse['error']['message']); | ||
echo 'GetTranslation failed!'; | ||
} else { | ||
var_dump($jsonResponse['result']); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
//fill in the details of the contacts.userId is obtained from loginResult. | ||
$contactData = array('comments'=>'Valiantwstut2', 'from_portal'=>0,'parent_id'=>'4x22'); | ||
//encode the object in JSON format to communicate with the server. | ||
$objectJson = json_encode($contactData); | ||
$dmsg.= debugmsg("Create, sending in",$objectJson); | ||
|
||
//name of the module for which the entry has to be created. | ||
$moduleName = 'ModComments'; | ||
|
||
//sessionId is obtained from loginResult. | ||
$params = array("sessionName"=>$cbSessionID, "operation"=>'addTicketFaqComment', | ||
"id"=>'10x64', "values"=>$objectJson); | ||
//Create must be POST Request. | ||
$response = $httpc->send_post_data($cbURL, $params, true); | ||
$dmsg.= debugmsg("Raw response (json) Create",$response); | ||
|
||
//decode the json encode response from the server. | ||
$jsonResponse = json_decode($response,true); | ||
$dmsg.= debugmsg("Webservice response Create",$jsonResponse); | ||
|
||
if($jsonResponse['success']==false) { | ||
$dmsg.= debugmsg('create failed:'.$jsonResponse['error']['message']); | ||
echo 'create failed!'; | ||
} else { | ||
$savedObject = $jsonResponse['result']; | ||
$id = $savedObject['id']; | ||
var_dump($savedObject); | ||
} | ||
?> |