BigCommerce API - 无法获得产品列表

时间:2014-10-12 13:25:24

标签: c# oauth-2.0 bigcommerce

显然我在这里遗漏了一些明显的东西。我认为使用OAuth v2查询BigCommerce API会很容易...但是我得到的响应是:{"错误":"您已获得授权,但您的范围不包括此资源"}

正在使用的令牌是从Auth回调返回的,其范围为:store_v2_orders store_v2_products store_v2_customers store_v2_content store_v2_marketing store_v2_information_read_only users_basic_information store_v2_default

显然,令牌具有适当的范围。我发送的错误是什么导致此无法访问?我已经搜遍了整个互联网并尝试了许多备用配置,但这个配置最接近解决方案。有什么想法吗?

string storeID = "store-abc123";
string clientID = "asdfdsafsdafdsafdsaf";
string token = "kljsdflkjsdflkjsdflkj";

var client = new RestClient( "https://api.bigcommerce.com/" );
var request = new RestRequest( "/stores/" + storeID + "/v2/products/", Method.GET );

request.AddParameter( "scope", "store_v2_products" );

request.AddHeader( "Accept", "application/json" );
request.AddHeader( "X-Auth-Client", clientID );
request.AddHeader( "X-Auth-Token", token );

var response = client.Execute( request );

1 个答案:

答案 0 :(得分:1)

是的,事实证明这是我的错。

该行

string storeID = "store-abc123";

应该只是

string storeID = "abc123";