tgallice / oauth2-buffer

Buffer Provider for the OAuth 2.0 Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues passing data into Create call

jackroscoe opened this issue · comments

Hi!

I'm struggling to use the examples in the main repo to successfully create a buffer post via the API. The data doesn't appear to be getting built into the request when using the following code.

Am I misunderstanding the use of the $options array?

// Prepare options
$scheduleOptions = json_encode(
    [
        'profile_ids' => array(1, 2),
        'text' => 'Test',
        'shorten' => false,
        'media' => [
            'link' => 'http://test.com',
            'description' => 'Test',
            'title' => 'Test',
            'picture' => 'https://example.com/img.jpg'
        ],
        'scheduled_at' => $scheduleTimestamp->format(DateTime::ATOM)
    ]
);
// Create the request for the new post
$requestCreate = $provider->getAuthenticatedRequest(
    'POST',
    'https://api.bufferapp.com/1/updates/create.json',
    $token,
    array(
        'body' => $scheduleOptions
    )
);

Thanks for any help.