user123
user123

Reputation: 411

Bigcommerce API connection error

I am new to the Big-commerce.

I am try to connect the PHP API of the Big-commerce below is my code.

BigCommerce_Api::configure(array(
    'store_url' => 'mystore url',
    'username'  => 'admin',
    'api_key'   => 'my apikey'
));

$ping = BigCommerce_Api::getTime();
if ($ping) 
{
    echo $ping->format('H:i:s');
}
else
{
    echo "error in connection";
}

i am try to display the time if connection is completed but getting error.

is there any problem in my code?

Please help me out form this problem.

Upvotes: 0

Views: 726

Answers (1)

Nazariy
Nazariy

Reputation: 6088

By default generated URL looks like https://uniquestoreid.mybigcommerce.com/api/v2/, when using BigCommerce API remove api/v2 from URL, your config should look like this:

BigCommerce_Api::configure(
    array(
        'store_url' => 'https://uniquestoreid.mybigcommerce.com',
        'username'  => 'username',
        'api_key'   => 'longtokenstring'
    )
);

Upvotes: 3

Related Questions