E10 Web Service License for oData Calls

I got it working both with CURL and file_get_contents. For anyone looking for php breadcrumbs in the future, here are some working examples:

(Where “00000003-9439-4B30-A6F4-6D2FD4B9FD0F” is the specific GUID for Web Service Licenses)

CURL Headers:

$headers = array('Content-Type: application/json'
				,'CallSettings: {"Company": "'.$epicor_company.'"}'
				,'License: {"ClaimedLicense": "00000003-9439-4B30-A6F4-6D2FD4B9FD0F"}'
				);//GUID is for WebService License

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $epicorURL);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, $epicorJSON);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

file_get_contents headers:

  $opts = array(
  	"http" => array(
  	
  		"method" => "GET",
  		"header" => "Accept-language: en\r\n"
  				  . "License: {\"ClaimedLicense\": \"00000003-9439-4B30-A6F4-6D2FD4B9FD0F\"}\r\n"
  	)
  
  );
  
  $context = stream_context_create($opts);
  $response = json_decode(file_get_contents($oDataURL, false, $context), true);
3 Likes