Comments (10)
Hi @alexkappa,
Through the API, only accounts owned by a business (not a user) can be created. Despite we are working on it, the SDK doesn't yet support the business manager API objects.
If you need to access that endpoint i suggest you temporary create the account through a direct API call (you i'll be able to read and update the account through the AdAccount class).
$response = Api::instance()->call(
'/<BUSINESS_ID>/adaccounts',
RequestInterface::METHOD_POST,
array(
AdAccountFields::NAME => 'My Business Account',
// All other required params
)
);
$account_id = $response->getContent()[AdAccountFields::ID];
$account = new AdAccount($account_id);
Note: i haven't tested this code :)
from facebook-php-business-sdk.
Thanks @pruno, we'll work around it for the time being and will be looking forward to having support for business manager objects in the SDK.
Cheers!
from facebook-php-business-sdk.
Quick note for anyone who stumbles upon this issue. The example uses '/<BUSINESS_ID>/adaccounts'
, but the path should really be '/<BUSINESS_ID>/adaccount'
(no 's').
If you search the facebook docs (https://developers.facebook.com/docs/marketing-api/reference/ad-account) you will find two sets of documentation:
/{business_id}/adaccounts
and
/{business_id}/adaccount
adaccounts
probably adds an existing ad account to a business manager, since one of the required parameters is adaccount_id
which a non-existing ad account would not have. Unless I am missing something obvious.
from facebook-php-business-sdk.
It is possible to create the user uses AdAccount?
My code:
$fieldsRequired = [
'name' => 'My Ad Account',
'currency' => 'USD',
'timezone_id' => 7,
];
$accounts = $fb->post('/me/adaccounts', $fieldsRequired);
(#275) Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects.
Where am I going wrong? It is obligatory to have the BUSINESS_ID instead of /me?
PHP 7.0.3 (cli) (built: Feb 2 2016 14:38:29) ( ZTS )
APP NAME: YAN ADS
APP ID: 839376919517850
Mode: Development
Access: User Test
[
'id' => 102771566809618,
'name' => 'Betty Alabcjcbdbehg Zamoreman',
'email' => '[email protected]'
]
cURL Log
curl \
-F 'name=Betty Alabcjcbdbehg Zamoreman' \
-F 'currency=BRL' \
-F 'timezone_id=25' \
-F 'access_token=EAAL...' \
-F 'appsecret_proof=99212...' \
https://graph.facebook.com/v2.6/me/adaccounts
Sorry my English!
from facebook-php-business-sdk.
@alexkappa Solve this problem of creating Account?
from facebook-php-business-sdk.
@newerton Did you solve this? I can't create with my business id too...
from facebook-php-business-sdk.
@happierall Without solution. In my case, I direct the client to Facebook Ads, automatically creates the account for the user.
My project is stopped. I was using version 2.6. Today it is in version 2.9, and did not solve this problem.
In the documentation, it would have to work.
Https://developers.facebook.com/docs/marketing-api/reference/ad-account#Creating
from facebook-php-business-sdk.
from facebook-php-business-sdk.
The code below should be implemented. Using the user session.
$fieldsRequired = [
'name' => 'My Ad Account',
'currency' => 'USD',
'timezone_id' => 7,
];
$accounts = $fb->post('/me/adaccounts', $fieldsRequired);
from facebook-php-business-sdk.
(#275) Cannot determine the target object for this request. Currently supported objects include ad account, business account and associated objects.
Why ?
from facebook-php-business-sdk.
Related Issues (20)
- Deprecations with `strlen` on null. HOT 4
- getDefaultRequestHeaders() is misspelled as getDefaultRequestHeaderds() HOT 1
- PHP 8.1 Deprecation HOT 4
- syntax error, unexpected '|', expecting ';' or '{' HOT 4
- Union types are only allowed since php8 HOT 2
- Exception: field 'id' is required Error HOT 2
- شخص ما أخترق حسابي الشخصي
- Normalizer.php strlen() must be of type string Problem
- Facebook Multi-Language Ads
- Syntax error in FB version v16.0.0 HOT 1
- The AdAccountFields enum does not currently implement the ACCOUNT_STATUS field. HOT 1
- Exception thrown without a stack frame in Unknown on line 0 HOT 1
- How to create a AAA advertisements above version 17
- Fix package installation instructions in README file
- Fff HOT 1
- error
- ad creative Url Tracking Params Update HOT 1
- OpenSSL SSL_connect: Connection reset by peer in connection to graph.facebook.com:443 Error
- Static singletons used everywhere HOT 3
- Incorrect PHPDoc types HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-php-business-sdk.