Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Is this working with Twitter Labs? #291

Closed
twnku opened this issue Jun 16, 2020 · 1 comment
Closed

Is this working with Twitter Labs? #291

twnku opened this issue Jun 16, 2020 · 1 comment

Comments

@twnku
Copy link

twnku commented Jun 16, 2020

i tried using this for https://developer.twitter.com/en/docs/labs/hide-replies/api-reference/put-hidden with this

$settings = array(
            'oauth_access_token' => $Data['AccessToken'],
            'oauth_access_token_secret' => $Data['AccessTokenSecret'],
            'consumer_key' => $Data['ConsumerKey'],
            'consumer_secret' => $Data['ConsumerKeySecret']
        );
        $url = 'https://api.twitter.com/labs/2/tweets/'.$Data['StatusID'].'/hidden';
        $requestMethod = 'PUT';
        $postfields = array(
            'hidden' => true
        );
        $twitter = new TwitterAPIExchange($settings);
        $dotwitter = $this->twitter->buildOauth($url, $requestMethod)->performRequest(true, [
                    CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
                    CURLOPT_POSTFIELDS => $postfields
                    ]);

but the response i get was
{"title":"Unauthorized","type":"about:blank","status":401,"detail":"Unauthorized"}

how can i use this for Twitter Labs API?

@andypiper
Copy link

Since this endpoint expects a JSON body, you might need to apply this patch for it to work.

@J7mbo J7mbo closed this as completed Jan 15, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants