Coder Social home page Coder Social logo

Comments (10)

pruno avatar pruno commented on April 20, 2024

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.

alexkappa avatar alexkappa commented on April 20, 2024

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.

allentsai avatar allentsai commented on April 20, 2024

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.

newerton avatar newerton commented on April 20, 2024

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.

newerton avatar newerton commented on April 20, 2024

@alexkappa Solve this problem of creating Account?

from facebook-php-business-sdk.

ianberdin avatar ianberdin commented on April 20, 2024

@newerton Did you solve this? I can't create with my business id too...

from facebook-php-business-sdk.

newerton avatar newerton commented on April 20, 2024

@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.

ianberdin avatar ianberdin commented on April 20, 2024

from facebook-php-business-sdk.

newerton avatar newerton commented on April 20, 2024

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.

GuangStack avatar GuangStack commented on April 20, 2024

(#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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.