I’m stuck!
I’m hoping some of you guys might be able to point me in the right direction. I’m using TwitterAPIExchange to successfully perform GETs and POSTs against various APIs. But when trying to create a Twitter list, I keep getting the error:
“The list failed validation: A list’s name can’t be blank.”
I know name is a required field - I AM supplying the name value (at least I’m supplying it how I supply other params for a POST) yet it keeps giving me the above error.
My code looks like this:
<?php
require_once('TwitterAPIExchange.php');
require_once('GetSharedParams.php');
$settings = array(
'oauth_access_token' => $oat,
'oauth_access_token_secret' => $oats,
'consumer_key' => $ck,
'consumer_secret' => $cs
);
$url = 'https://api.twitter.com/1.1/lists/create.json';
$requestMethod = 'POST';
$postfields = array(
'name' => 'test',
'mode' => 'public'
);
$twitter = new TwitterAPIExchange($settings);
echo $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();
?>
Am I doing something wrong? I’m blind to this now having stared at it for so long! Any help you can give would be appreciated. Thanks