Magento 1.x : Accessing Magento Rest Api as AdminRest Api - call custom rest api functionOAuth for REST API using PHPProper Mobile API Implementation for Magento?Magento's REST API responses claiming oauth_callback param is emptyhow to get the product details by rest API in Magento1.9?Magento Rest Api ErrorHow to use Magento 2 API?Simple Magento 2 rest API?Having issue with magento 1.9 with API handlingREST API Access Token Issues
When is one 'Ready' to make Original Contributions to Mathematics?
Taking advantage when HR forgets to communicate the rules
Howto display unicode character u2026 in terminal mode in emacs
Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?
Do intermediate subdomains need to exist?
How predictable is $RANDOM really?
Is conquering your neighbors to fight a greater enemy a valid strategy?
Do I need transit visa for Dublin?
Removing polygon holes in OpenLayers
How to delete multiple process id of a single process?
is this a question or an affirmation?
Did William Shakespeare hide things in his writings?
Merge overlapped intervals in a list
PhD: When to quit and move on?
How to reclaim personal item I've lent to the office without burning bridges?
Is it acceptable that I plot a time-series figure with years increasing from right to left?
Better random (unique) file name
How did Einstein know the speed of light was constant?
Why do we need a bootloader separate from our application program in microcontrollers?
Was the 45.9°C temperature in France in June 2019 the highest ever recorded in France?
Are "confidant" and "confident" homophones?
Examples of fluid (including air) being used to transmit digital data?
How to say "just a precision" properly in English?
SIunitx error when using lighter weight
Magento 1.x : Accessing Magento Rest Api as Admin
Rest Api - call custom rest api functionOAuth for REST API using PHPProper Mobile API Implementation for Magento?Magento's REST API responses claiming oauth_callback param is emptyhow to get the product details by rest API in Magento1.9?Magento Rest Api ErrorHow to use Magento 2 API?Simple Magento 2 rest API?Having issue with magento 1.9 with API handlingREST API Access Token Issues
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to access magento rest api with following script, but is uses default guest role to access, so I cannot access orders and other stuffs. How can I access Magento Rest api as admin.
<?php
$callbackUrl = "http://192.168.1.144/o2/api/rest/orders";
$temporaryCredentialsRequestUrl =
"http://192.168.1.144/o2/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://192.168.1.144/o2/admin/oAuth_authorize';
$accessTokenRequestUrl = 'http://192.168.1.144/o2/oauth/token';
$apiUrl = 'http://192.168.1.144/o2/api/rest';
$consumerKey = '**********************';
$consumerSecret = '**********************';
session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) &&
$_SESSION['state'] == 1)
$_SESSION['state'] = 0;
try
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION
: OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret,
OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();
if (!isset($_GET['oauth_token']) && !$_SESSION['state'])
$requestToken =
$oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
$_SESSION['secret'] = $requestToken['oauth_token_secret'];
$_SESSION['state'] = 1;
header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' .
$requestToken['oauth_token']);
exit;
else if ($_SESSION['state'] == 1)
$oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
$accessToken =
$oauthClient->getAccessToken($accessTokenRequestUrl);
$_SESSION['state'] = 2;
$_SESSION['token'] = $accessToken['oauth_token'];
$_SESSION['secret'] = $accessToken['oauth_token_secret'];
header('Location: ' . $callbackUrl);
exit;
else
$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
$resourceUrl = "$apiUrl/orders";
$oauthClient->fetch($resourceUrl);
$productsList = json_decode($oauthClient->getLastResponse());
print_r($productsList);
catch (OAuthException $e)
print_r($e);
magento-1 api rest role
add a comment |
I am trying to access magento rest api with following script, but is uses default guest role to access, so I cannot access orders and other stuffs. How can I access Magento Rest api as admin.
<?php
$callbackUrl = "http://192.168.1.144/o2/api/rest/orders";
$temporaryCredentialsRequestUrl =
"http://192.168.1.144/o2/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://192.168.1.144/o2/admin/oAuth_authorize';
$accessTokenRequestUrl = 'http://192.168.1.144/o2/oauth/token';
$apiUrl = 'http://192.168.1.144/o2/api/rest';
$consumerKey = '**********************';
$consumerSecret = '**********************';
session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) &&
$_SESSION['state'] == 1)
$_SESSION['state'] = 0;
try
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION
: OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret,
OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();
if (!isset($_GET['oauth_token']) && !$_SESSION['state'])
$requestToken =
$oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
$_SESSION['secret'] = $requestToken['oauth_token_secret'];
$_SESSION['state'] = 1;
header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' .
$requestToken['oauth_token']);
exit;
else if ($_SESSION['state'] == 1)
$oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
$accessToken =
$oauthClient->getAccessToken($accessTokenRequestUrl);
$_SESSION['state'] = 2;
$_SESSION['token'] = $accessToken['oauth_token'];
$_SESSION['secret'] = $accessToken['oauth_token_secret'];
header('Location: ' . $callbackUrl);
exit;
else
$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
$resourceUrl = "$apiUrl/orders";
$oauthClient->fetch($resourceUrl);
$productsList = json_decode($oauthClient->getLastResponse());
print_r($productsList);
catch (OAuthException $e)
print_r($e);
magento-1 api rest role
are you sure you created an admin role for REST API in the backend?
– Marius♦
May 6 '15 at 11:44
Yeah, I have created one and assigned it to user
– S. M. Shahinul Islam
May 7 '15 at 6:15
@Alvi_1987 - do you recall how you resolved this?
– TylersSN
Nov 4 '15 at 17:41
add a comment |
I am trying to access magento rest api with following script, but is uses default guest role to access, so I cannot access orders and other stuffs. How can I access Magento Rest api as admin.
<?php
$callbackUrl = "http://192.168.1.144/o2/api/rest/orders";
$temporaryCredentialsRequestUrl =
"http://192.168.1.144/o2/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://192.168.1.144/o2/admin/oAuth_authorize';
$accessTokenRequestUrl = 'http://192.168.1.144/o2/oauth/token';
$apiUrl = 'http://192.168.1.144/o2/api/rest';
$consumerKey = '**********************';
$consumerSecret = '**********************';
session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) &&
$_SESSION['state'] == 1)
$_SESSION['state'] = 0;
try
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION
: OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret,
OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();
if (!isset($_GET['oauth_token']) && !$_SESSION['state'])
$requestToken =
$oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
$_SESSION['secret'] = $requestToken['oauth_token_secret'];
$_SESSION['state'] = 1;
header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' .
$requestToken['oauth_token']);
exit;
else if ($_SESSION['state'] == 1)
$oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
$accessToken =
$oauthClient->getAccessToken($accessTokenRequestUrl);
$_SESSION['state'] = 2;
$_SESSION['token'] = $accessToken['oauth_token'];
$_SESSION['secret'] = $accessToken['oauth_token_secret'];
header('Location: ' . $callbackUrl);
exit;
else
$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
$resourceUrl = "$apiUrl/orders";
$oauthClient->fetch($resourceUrl);
$productsList = json_decode($oauthClient->getLastResponse());
print_r($productsList);
catch (OAuthException $e)
print_r($e);
magento-1 api rest role
I am trying to access magento rest api with following script, but is uses default guest role to access, so I cannot access orders and other stuffs. How can I access Magento Rest api as admin.
<?php
$callbackUrl = "http://192.168.1.144/o2/api/rest/orders";
$temporaryCredentialsRequestUrl =
"http://192.168.1.144/o2/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://192.168.1.144/o2/admin/oAuth_authorize';
$accessTokenRequestUrl = 'http://192.168.1.144/o2/oauth/token';
$apiUrl = 'http://192.168.1.144/o2/api/rest';
$consumerKey = '**********************';
$consumerSecret = '**********************';
session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) &&
$_SESSION['state'] == 1)
$_SESSION['state'] = 0;
try
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION
: OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret,
OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();
if (!isset($_GET['oauth_token']) && !$_SESSION['state'])
$requestToken =
$oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
$_SESSION['secret'] = $requestToken['oauth_token_secret'];
$_SESSION['state'] = 1;
header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' .
$requestToken['oauth_token']);
exit;
else if ($_SESSION['state'] == 1)
$oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
$accessToken =
$oauthClient->getAccessToken($accessTokenRequestUrl);
$_SESSION['state'] = 2;
$_SESSION['token'] = $accessToken['oauth_token'];
$_SESSION['secret'] = $accessToken['oauth_token_secret'];
header('Location: ' . $callbackUrl);
exit;
else
$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
$resourceUrl = "$apiUrl/orders";
$oauthClient->fetch($resourceUrl);
$productsList = json_decode($oauthClient->getLastResponse());
print_r($productsList);
catch (OAuthException $e)
print_r($e);
magento-1 api rest role
magento-1 api rest role
edited Jun 27 at 9:44
Vivek Kumar
2,7632 gold badges7 silver badges32 bronze badges
2,7632 gold badges7 silver badges32 bronze badges
asked May 6 '15 at 7:45
S. M. Shahinul IslamS. M. Shahinul Islam
1265 bronze badges
1265 bronze badges
are you sure you created an admin role for REST API in the backend?
– Marius♦
May 6 '15 at 11:44
Yeah, I have created one and assigned it to user
– S. M. Shahinul Islam
May 7 '15 at 6:15
@Alvi_1987 - do you recall how you resolved this?
– TylersSN
Nov 4 '15 at 17:41
add a comment |
are you sure you created an admin role for REST API in the backend?
– Marius♦
May 6 '15 at 11:44
Yeah, I have created one and assigned it to user
– S. M. Shahinul Islam
May 7 '15 at 6:15
@Alvi_1987 - do you recall how you resolved this?
– TylersSN
Nov 4 '15 at 17:41
are you sure you created an admin role for REST API in the backend?
– Marius♦
May 6 '15 at 11:44
are you sure you created an admin role for REST API in the backend?
– Marius♦
May 6 '15 at 11:44
Yeah, I have created one and assigned it to user
– S. M. Shahinul Islam
May 7 '15 at 6:15
Yeah, I have created one and assigned it to user
– S. M. Shahinul Islam
May 7 '15 at 6:15
@Alvi_1987 - do you recall how you resolved this?
– TylersSN
Nov 4 '15 at 17:41
@Alvi_1987 - do you recall how you resolved this?
– TylersSN
Nov 4 '15 at 17:41
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f66847%2fmagento-1-x-accessing-magento-rest-api-as-admin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f66847%2fmagento-1-x-accessing-magento-rest-api-as-admin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
are you sure you created an admin role for REST API in the backend?
– Marius♦
May 6 '15 at 11:44
Yeah, I have created one and assigned it to user
– S. M. Shahinul Islam
May 7 '15 at 6:15
@Alvi_1987 - do you recall how you resolved this?
– TylersSN
Nov 4 '15 at 17:41