31 'Accept: application/json',
32 'Content-Type: application/json',
62 if (!isset(parent::$baseUrl)) {
63 parent::resolveBaseUrl();
66 $this->storeCode = $storeCode;
81 'username' => getenv(
'MAGENTO_ADMIN_USERNAME'),
82 'password' => getenv(
'MAGENTO_ADMIN_PASSWORD')
85 $this->transport->write($authUrl, json_encode($authCreds),
CurlInterface::POST, $this->headers);
86 $this->headers = array_merge(
87 [
'Authorization: Bearer ' . str_replace(
'"',
"", $this->
read())],
104 $this->transport->write(
106 json_encode(
$data, JSON_PRETTY_PRINT),
108 array_unique(array_merge($headers, $this->headers))
120 public function read($successRegex =
null, $returnRegex =
null)
122 $this->response = $this->transport->read();
123 return $this->response;
145 $this->transport->close();
155 $urlResult = parent::$baseUrl .
'rest/';
156 if ($this->storeCode !=
null) {
157 $urlResult .= $this->storeCode .
"/";
read($successRegex=null, $returnRegex=null)
write($url, $data=[], $method=CurlInterface::POST, $headers=[])
addOption($option, $value)
__construct($storeCode=null)
getFormattedUrl($resource)