Hi,
when attempting to get a tweet preview with media_ids using the request https://ads-api.twitter.com/5/accounts/:account_id/tweet/preview?media_ids=929240479471824897&as_user_id=811765148595535872
we receive an error:
{
"errors": [
{
"code": "INVALID_MEDIA_ID",
"message": "Media referenced by media_id 929240479471824897 was not found."
}
],
"request": {
"params": {}
}
}
but the image can be found in the media library.
Best,
Liu
Hello, @edt_sdc. Welcome!
Thanks for the question. This is a limitation of the GET accounts/:account_id/tweet/preview endpoint.
We recommend integrating with Draft Tweets (see the announcement) so that you can use all media assets (and card types) in previews.
Here is an example (using media from the Media Library).
# create the draft
$ twurl -X POST -H ads-api.twitter.com "/5/accounts/18ce54d4x5t/draft_tweets?media_ids=1073727963693117440&as_user_id=756201191646691328"
{
"request": {
"params": {
"media_ids": [
1073727963693117440
],
"as_user_id": 756201191646691328
}
},
"data": {
"id_str": "1118381656920948737",
"text": "",
"user_id": "756201191646691328",
"id": 1118381656920948737,
"media_ids": [
"1073727963693117440"
],
"nullcast": true,
"created_at": "2019-04-17T05:12:20Z",
"card_uri": null,
"updated_at": "2019-04-17T05:12:20Z",
"media_keys": [
"3_1073727963693117440"
]
}
}
# preview the draft
$ twurl -H ads-api.twitter.com "/5/accounts/18ce54d4x5t/draft_tweets/preview/1118381656920948737"
1 Like
thanks @juanshishido, draft tweets solve the problems.
1 Like