Taobao API - isv.permission-api-package-empty - php

I'm new with Taobao API and I'm not Chinese. I need to obtain category list and items from Taobao.com.
I'm using Yii and this extension: http://www.yiiframework.com/extension/topsdk4yii/
I have Api key and Api Secret, I'm trying to make a query and a receive this error:
object(stdClass)[16]
public 'code' => int 11
public 'msg' => string 'Insufficient isv permissions' (length=28)
public 'sub_code' => string 'isv.permission-api-package-empty' (length=32)
I make query in this way ( in SiteController.php -> function actionIndex() ):
Yii::import('application.extensions.taobao.request.*');
$request = new ShopGetRequest();
$request->setNick('my_username_from_taobao');
$request->setFields('sid,cid,title,nick,desc,bulletin,pic_path,created,modified');
$shop = Yii::app()->top->execute($request);
var_dump($shop);
I found some explanation here http://open.taobao.com/support/question_detail.htm?id=496 but I can't find how to fix this.
Please help me.
Thanks in advance.

You can't fix it from your application
you have to tell to the Api owner to white-list your server ip address if not done your application will not be able to make requests to taobao api.

The error means your application has not applied for the required permissions. You can do this from the application menu (providing an explanation of the application plus reason for applying in Chinese), after which they will handle your application within 3 working days.

Related

Retrieve Data from a response object in PHP

New to php (used C and VB years ago) Using a Temboo API for Ebay, I'm attempting to retrieve messages from our eBay account. Although the API says it will return a JSON string, when executing it returns an object. Using var_dump(get_defined_vars($getMemberMessagesResults)); returns this relevant information:
'getMemberMessagesResults' =>
object(eBay_Trading_GetMemberMessages_Results)[7]
protected 'outputArray' =>
array (size=1)
'Response' => string '{"#xmlns":"urn:ebay:apis:eBLBaseComponents","Timestamp":"2021-07-29T21:52:49.047Z","Ack":"Warning","...
protected 'lowercaseKeyMap' =>
array (size=1)
'response' => string 'Response' (length=8)
I am trying to extract the information 'Response'=> string('xlmns":"urn:ebay:apis"... information so that I can then process to put in a database. But, I cannot figure out how to reference this information to extract it. I've tried lots of references but so far I've been stumped. I realize the information is probably there somewhere but being new to PHP I'm feeling stumped. Thanks in advance for your assistance.

Trouble adding intent to bot

When trying to add an intent to a bot, I'm getting the following:
{"message":"The resource 'SomeBotThatDefinitelyExists' referenced in resource 'TestBot' was not found. Choose another resource."}
I'm calling the putBot method, and passing the intents below:
`'intents' => [
[
'intentName' => 'SomeBotThatDefinitelyExists',
'intentVersion' => '1',
],
[
'intentName' => 'TestingTheBot',
'intentVersion' => '1'
]
]`
I am absolutely positive that I've successfully created the offending intent. I can see it in the AWS panel, and via the api. The only difference that I can see between the two intents is that the second intent, 'TestingTheBot' has been included in a previous version of the bot. I am able to add it via the api without issue, but, again, trying to add SomeBotThatDefinitelyExists returns the error above.
For anyone with the same issue, I discovered that intents created with putIntent don't have a version. After creating an intent, you must call createIntentVersion. You can then obtain the latest version from the intent returned by the API. That should be the version you use to set the intentVersion property when adding an intent to a bot.

Facebook Business PHP SDK : Cannot access an object not managed by the business owning this app

I am trying to create a facebook Adaccount with Facebook Business SDK. But when I use method createAdAccount it gives me an error. please see the image attached below. Here is the documentation about adacount creation
I am using createAdAccount like this.
public function createAdAccount() {
//$params['name'] = "My test Partner";
$params = ['name' => 'My test Partner',
'currency' => 'USD',
'timezone_id' => 1,
'end_advertiser'=> 'NONE',
'media_agency' => 'UNFOUND',
'partner' => 'UNFOUND'
];
$buisness = new Business('<buisness account id>');
$adacount = $buisness->createAdAccount(['name'], $params);
echo "<pre>"; print_r($adacount);
}
Update :
I also added my app id in my business account here.
Any help would be appreciated. Thanks in advance.
I got the reason behind this. This is due to the error because I haven't added the app into my business manager account. I added the app and it worked.
Please refer to the screenshot if you get the same issue.
You need to go into your business manager setting and add the app.
Hope this will help the needed person.

Twitter API responds with "Your credentials do not allow access to this resource" while calling statuses/update.json

I'm using Hybridauth 3 in my PHP app to make some periodical tweets on behalf of my account.
The app has all possible permissions. I'm giving it all permissions when it asks for them on the first auth step.
After that Twitter redirects me to the specified callback URL and there I'm getting a pair of access_token and access_token_secret.
But when I'm trying to make a tweet using these tokens - it gives me:
{"errors":[{"code":220,"message":"Your credentials do not allow access to this resource."}]}
Here's how I'm trying to make a tweet:
$config = [
'authentication_parameters' => [
//Location where to redirect users once they authenticate
'callback' => 'https://mysite/twittercallback/',
//Twitter application credentials
'keys' => [
'key' => 'xxx',
'secret' => 'yyy'
],
'authorize' => true
]
];
$adapter = new Hybridauth\Provider\Twitter($config['authentication_parameters']);
//Attempt to authenticate the user
$adapter->setAccessToken(/*tokens I've got from getAccessToken() on /twittercallback/*/);
if(! $adapter->isConnected()) {
// never goes here, so adapter is connected
return null;
}
try{
$response = $adapter->setUserStatus('Hello world!');
}
catch (\Exception $e) {
// here I've got the error
echo $e->getMessage();
return;
}
Tried to recreate tokens and key\secret pairs and passed auth process for the app many times, including entering password for my Twitter account (as suggested in some posts on stackoverflow) but still have this error.
P.S. According to this, Hybridauth has fixed the issue in the recent release.
It looks like you are using application authentication as opposed to user authentication. In order to post a tweet, you must authenticate as a user. Also, make sure your Twitter app has read/write privileges.
After comparing headers of outgoing requests from my server with the ones required by Twitter, I've noticed that Hybris doesn't add very important part of the header: oauth_token. At least it's not doing this in the code for Twitter adapter and for the scenario when you apply access token with setAccessToken(). It's just storing tokens in the inner storage but not initializing corresponding class member called consumerToken in OAuth1 class.
So to initialize the consumer token properly I've overridden the apiRequest method for Twitter class (before it used the defalut parent implementation) and added a small condition, so when consumer token is empty before the request - we need to try to init it.
public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [])
{
if(empty($this->consumerToken)) {
$this->initialize();
}
return parent::apiRequest($url, $method, $parameters, $headers);
}
I'm not sure that I've fixed it the best way, but as long as it's working - that's fine.
For your info setAccessToken was fixed in v3.0.0-beta.2 (see PR https://github.com/hybridauth/hybridauth/pull/880)
I faced the same error when implementing a sample app in clojure and the following resource was a huge help to sort out my confusion about application-only auth vs user authentication: https://developer.twitter.com/en/docs/basics/authentication/overview/oauth

PHP Sagepay iframe integration

I want to make my website payments via sagepay. The problem is I am not able to locate all the things in the PHPKit they provide. The version of the kit is 3.0 and I want to configure iframe integration but when I open the test method there is this piece of code
$view = new HelperView('server/low_profile');
$view->setData(array(
'env' => $this->sagepayConfig->getEnv(),
'vendorName' => $this->sagepayConfig->getVendorName(),
'integrationType' => $this->integrationType,
'request' => HelperCommon::getStore('txData'),
));
$view->render();
I want to locate those keys 'env', 'vendorName', 'integrationType', 'requests' and see how to put them to use in my system. I see this syntax in a lo of places
public function setSagepayConfig(SagepaySettings $sagepayConfig)
{
$this->sagepayConfig = $sagepayConfig;
}
But I don't know what SagepaySettings means and how to trace it. Can you tell me where can I find SagepaySettings, or what does this mean. Is it a class or method or attribute, because I cannot find it in all the files as any of those.
It's a class in \lib\classes\settings.php

Categories