Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigcommerce rest api v3 php #259

Open
Er-Kalpesh opened this issue Aug 12, 2020 · 5 comments
Open

bigcommerce rest api v3 php #259

Er-Kalpesh opened this issue Aug 12, 2020 · 5 comments

Comments

@Er-Kalpesh
Copy link

and I am not even able to start step 1 here.

Issues:

Basic Auth method

Bigcommerce::configure(array(
	'store_url' => 'https://store.mybigcommerce.com',
	'username'	=> 'admin',
	'api_key'	=> 'd81aada4xc34xx3e18f0xxxx7f36ca'
));

So the question here is how to get a username? bigcommerece user only created using email address so how to get username here?

OAuth method

In order to obtain the auth_token you would consume Bigcommerce::getAuthToken method

$object = new \stdClass();
$object->client_id = 'xxxxxx';
$object->client_secret = 'xxxxx;
$object->redirect_uri = 'https://app.com/redirect';
$object->code = $request->get('code');
$object->context = $request->get('context');
$object->scope = $request->get('scope');

$authTokenResponse = Bigcommerce::getAuthToken($object);

Bigcommerce::configure(array(
    'client_id' => 'xxxxxxxx',
    'auth_token' => $authTokenResponse->access_token,
    'store_hash' => 'xxxxxxx'
));

here the question is what is the $request variable? also, redirect_uri is the bigcommerce store URL or my site URL?

Please can anyone help to get started with this?

@everthere
Copy link

bump this, docs could do with explaining the $request object being passed in the example.

@azolyoung
Copy link

yeah, is there anyone can help.. I have no idea which values should be for the 'code', 'context' and 'scope'

@pkaser
Copy link

pkaser commented Sep 18, 2020

I am stuck at the $request issue too. Anyone figure this out?

@brodsolutions
Copy link

brodsolutions commented Oct 22, 2020

Current documentation doesn't reflect the current API credential system. We only need the Store Hash, Auth Token, and Client ID to access. The following code works:

<?php
require 'vendor/autoload.php';
use Bigcommerce\Api\Client as Bigcommerce;

Bigcommerce::configure(array(
    'client_id' => '{client-id}}',
    'auth_token' => '{auth-token}',
    'store_hash' => '{store-hash}}'
));

$ping = Bigcommerce::getTime();
if ($ping) echo $ping->format('H:i:s');
?>

@cgsmith
Copy link

cgsmith commented Sep 30, 2021

The documentation is still out of date. @brodsolutions it isn't clear where you generate the auth-token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants