Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3630

Image upload by rest api to TikTok integration via image string generated by binary

$
0
0

I am trying to make http multipart request from my app to tiktok, but getting the response

**param body.data is invalid,detail:type incorrect,expected type:binary**

here is the my code:

    public function uploadToTikTok(    string $endpoint,    TikTokStoreAuthData $authData,    array $query = [],    $body = null,    string $requestOptionType = RequestOptions::MULTIPART,): array {    $options = [        $requestOptionType => [            ['contents' => file_get_contents(body['image_url']),'name' => 'data',            ],        ]    ];    $url = $this->buildUrl($endpoint, $authData, $query);    return (array)$this->client->post($url, $options);}

here is the documentation from tiktok

as TikTok ducumenation, they are requiring to send image as a string from binary

could you please suggest if i am doing something wrong? how should i format my contents value to get the successful response from tiktok?

Any help will be highly appreciated!


Viewing all articles
Browse latest Browse all 3630

Trending Articles