{"action":"created","issue":{"url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php/issues/7","repository_url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php","labels_url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php/issues/7/comments","events_url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php/issues/7/events","html_url":"https://github.com/UltraCart/rest_api_v2_sdk_php/issues/7","id":309708196,"number":7,"title":"`401 Unauthorized` response Error","user":{"login":"chadhakavita","id":37872809,"avatar_url":"https://avatars1.githubusercontent.com/u/37872809?v=4","gravatar_id":"","url":"https://api.github.com/users/chadhakavita","html_url":"https://github.com/chadhakavita","followers_url":"https://api.github.com/users/chadhakavita/followers","following_url":"https://api.github.com/users/chadhakavita/following{/other_user}","gists_url":"https://api.github.com/users/chadhakavita/gists{/gist_id}","starred_url":"https://api.github.com/users/chadhakavita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chadhakavita/subscriptions","organizations_url":"https://api.github.com/users/chadhakavita/orgs","repos_url":"https://api.github.com/users/chadhakavita/repos","events_url":"https://api.github.com/users/chadhakavita/events{/privacy}","received_events_url":"https://api.github.com/users/chadhakavita/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-29T10:49:57Z","updated_at":"2018-04-02T07:09:46Z","closed_at":null,"author_association":"NONE","body":"I am getting following error.Please have a look and revert me ASAP:\r\n\r\nFatal error: Uncaught ultracart\\v2\\ApiException: [401] Client error: GET https://secure.ultracart.com/rest/v2/checkout/cart?_expand=checkout%2Citems resulted in a 401 Unauthorized response: {\"error\":{\"developer_message\":\"Permission Denied.\",\"user_message\":\"Permission Denied.\"},\"metadata\":{}} in /home/dsdevelo/public_html/demo/CRM/vendor/UltraCart/rest_api_v2_sdk_php/lib/api/CheckoutApi.php:728 Stack trace: #0 /home/dsdevelo/public_html/demo/CRM/vendor/UltraCart/rest_api_v2_sdk_php/lib/api/CheckoutApi.php(703): ultracart\\v2\\api\\CheckoutApi->getCartWithHttpInfo('checkout,items') #1 /home/dsdevelo/public_html/demo/CRM/sync.php(52): ultracart\\v2\\api\\CheckoutApi->getCart('checkout,items') #2 {main} thrown in /home/dsdevelo/public_html/demo/CRM/vendor/UltraCart/rest_api_v2_sdk_php/lib/api/CheckoutApi.php on line 728\r\n\r\nFollowing is my code:\r\n\r\n<?php\r\nset_time_limit(3000);\r\nini_set('max_execution_time', 3000);\r\nini_set('display_errors', 1);\r\n?>\r\n<!DOCTYPE html>\r\n<html>\r\n<body>\r\n<?php\r\n/**\r\n * Created by PhpStorm.\r\n * User: perry\r\n * Date: 4/25/2017\r\n * Time: 5:09 PM\r\n */\r\n\r\nerror_reporting(E_ALL);\r\n\r\n// BEWARE: Almost every item here starts with 'Cart'.  There are similar items\r\n// with other APIs.  Do not mistakenly use the other items.\r\n// For example:  CartItem vs. Item, CartItemOption vs. ItemOption.  CartPaymentCreditCard vs. CustomerCard.\r\n\r\n// initialization code\r\nrequire_once './vendor/autoload.php';\r\n// See https://github.com/UltraCart/hosted_fields for this file.\r\nrequire_once('./hosted_fields/HostedFields.class.php');\r\n\r\n\r\n\r\n// Configure API key authorization: ultraCartSimpleApiKey\r\n$api_key = \"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\";\r\nultracart\\v2\\Configuration::getDefaultConfiguration()->setApiKey('x-ultracart-simple-key', $api_key);\r\n\r\n$client = new GuzzleHttp\\Client(['verify' => true, 'debug' => false]);\r\n$config = ultracart\\v2\\Configuration::getDefaultConfiguration();\r\n$headerSelector = new \\ultracart\\v2\\HeaderSelector();\r\n\r\n\r\n//$auto_order_api = new ultracart\\v2\\api\\AutoOrderApi($client, $config, $headerSelector);\r\n\r\n$checkout_api = new ultracart\\v2\\api\\CheckoutApi();\r\necho \"<pre>\";   print_r($checkout_api); echo \"</pre>\";  die('Error Detect!');\r\n// expansion should contain all the objects that will be needed throughout the checkout.\r\n// see https://www.ultracart.com/api/#Topic3 for the complete list.\r\n// This expansion list should be supplied for each get/put throughout or data may be lost on the return objects.\r\n//$expansion = \"billing,checkout,coupons,items,payment,settings.shipping.estimates,shipping,summary,taxes,coupons\";\r\n\r\n$expansion = \"checkout,items\";\r\n// The expansion above doesn't include much of the item objects because they're not needed.  For example, we don't\r\n// need the item multimedia because we're not showing this cart to an end customer like a javascript implementation would\r\n\r\n$get_response = $checkout_api->getCart($expansion);\r\n\r\n\r\nif($get_response->getErrors() != null &&  count($get_response->getErrors()) > 0){\r\n    // handle errors here.\r\n    die('System error.  Could not retrieve shopping cart.');\r\n} else {\r\n    $cart = $get_response->getCart();\r\n}\r\n \r\n"},"comment":{"url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php/issues/comments/377871617","html_url":"https://github.com/UltraCart/rest_api_v2_sdk_php/issues/7#issuecomment-377871617","issue_url":"https://api.github.com/repos/UltraCart/rest_api_v2_sdk_php/issues/7","id":377871617,"user":{"login":"perrytew","id":3085264,"avatar_url":"https://avatars2.githubusercontent.com/u/3085264?v=4","gravatar_id":"","url":"https://api.github.com/users/perrytew","html_url":"https://github.com/perrytew","followers_url":"https://api.github.com/users/perrytew/followers","following_url":"https://api.github.com/users/perrytew/following{/other_user}","gists_url":"https://api.github.com/users/perrytew/gists{/gist_id}","starred_url":"https://api.github.com/users/perrytew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perrytew/subscriptions","organizations_url":"https://api.github.com/users/perrytew/orgs","repos_url":"https://api.github.com/users/perrytew/repos","events_url":"https://api.github.com/users/perrytew/events{/privacy}","received_events_url":"https://api.github.com/users/perrytew/received_events","type":"User","site_admin":false},"created_at":"2018-04-02T07:09:46Z","updated_at":"2018-04-02T07:09:46Z","author_association":"CONTRIBUTOR","body":"chadhakavita,\r\nPlease email me your entire script if possible.  \r\nEmail it to support@ultracart.com and put \"Attention Perry\" in the subject.\r\n\r\nI'd like to review it.\r\nThank you."}}
{"actor":{"display_login":"perrytew"}}