Invalid media Id

ads
media-upload

#6

@andypiper @juanshishido
We are having the exact same issues - all media uploads are failing.
A simple example:
twurl -H upload.twitter.com “/1.1/media/upload.json” -f ~/Pictures/IMG_3877.JPG -F media -X POST
that returns a media_id of 774281214865702912
but then
twurl -H upload.twitter.com “/1.1/media/upload.json?command=STATUS&media_id=774281214865702912"
returns
{“request”:”/1.1/media/upload.json",“error”:“Invalid mediaId.”}

Please help!


#7

Does a subsequent STATUS request confirm that the upload was ok?


#9

No, it doesn’t. Every call to:
twurl -H upload.twitter.com “/1.1/media/upload.json?command=STATUS&media_id=774281214865702912”

returns the same “Invalid mediaId” error

Is there some other STATUS request I can make?

Is there an endpoint to get a list of valid mediaIds?


#11

Hi, all. Just a quick update. We’re still investigating why we’re seeing the following error when checking the status of a media processing operation:

$ twurl -H upload.twitter.com "/1.1/media/upload.json?command=STATUS&media_id=12345" | jq
{
  "request": "/1.1/media/upload.json",
  "error": "Invalid mediaId."
}

However, it is possible to use image media in creatives. It does not seem like this is the case for video, though.

We’ll update this thread once we know more. Thanks for your patience.


#13

Thanks @juanshishido - look forward to your update.


#14

@SocialOpinions You must not call STATUS command if FINALIZE response doesn’t contain ‘processing_info’ field.

“If the response contains a processing_info field, then use the STATUS command to poll for the status of the FINALIZE operation.” - https://dev.twitter.com/rest/reference/post/media/upload-finalize


Media/upload (STATUS) returns Invalid mediaId
#16

Hi @tushar_io - I’m not calling the STATUS command though?

Also - I am still getting them same problems in that I simply cannot upload any media.

Here is a sample of my code:

//https://ads-api.twitter.com/1/accounts/:account_id/cards/website
RequestBuilder(oAuth, “POST”, “https://ads-api.twitter.com/1/accounts/” + accountId +"/cards/website");

        rb.AddParameter("name", name);
        rb.AddParameter("website_title", websiteTitle);
        rb.AddParameter("website_url", websiteURL);
        rb.AddParameter("image_media_id", imageMediaId);

I have a valid media_id.


#17

@SocialOpinions: To clarify, you’re able to successfully upload an image using the media/upload endpoint, but get the Invalid mediaId error only when trying to associate that image with a website card?


#18

@juanshishido - Sorry it’s taken a while to get back to you on this but basically yes. I tried it out again a few days ago and still have the same issues. The first step returns the mediaId and then when I try the second step I get the error.


#19

We’re still working to identify the issue here, @SocialOpinions. We’ll update as soon as we know more. Thanks!


#20

@juanshishido - thanks, keep me posted!


#21

@SocialOpinions: We’re able to create a website card without issue. Please see the steps below.

Uploading the image. Please note that: (1) “the ratio of of image width/height for website cards must be 5:2” (source) and (2) the additional_owners parameter allows you to specify the user(s), by user_id, who are allowed to use the media (source).

$ twurl -X POST -H upload.twitter.com "/1.1/media/upload.json?additional_owners={additional_owners}" --file image.jpg --file-field "media" | jq
{
  "media_id": 790053336116453400,
  "media_id_string": "790053336116453376",
  "size": 96203,
  "expires_after_secs": 86400,
  "image": {
    "image_type": "image/jpeg",
    "w": 900,
    "h": 360
  }
}

Creating the website card.

$ twurl -X POST -H ads-api.twitter.com "/1/accounts/{account_id}/cards/website?name=test-website-card&website_title=test-website-title&website_url=https://twitter.com/&image_media_id=790053336116453376" | jq
{
  "data_type": "card",
  "data": {
    "name": "test-website-card",
    "image": {image_url},
    "preview_url": {preview_url},
    "website_cta": "READ_MORE",
    "id": "1aabc",
    "account_id": {account_id},
    "created_at": "2016-10-23T00:00:01Z",
    "website_title": "test-website-title",
    "website_url": "https://twitter.com/",
    "updated_at": "2016-10-23T00:00:01Z",
    "deleted": false,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "name": "test-website-card",
      "image": {image_url},
      "account_id": {account_id},
      "website_title": "test-website-title",
      "website_url": "https://twitter.com/",
      "card_type": "WEBSITE"
    }
  }
}

If, after following these steps, there are still issues, please provide the requests you are making, using twurl.


Image for website card
Error uploading websitecard image statusCode Forbidden code 326
Create a promotional Tweet with Website Card
#22

@SocialOpinions: Were you able to associate an image with a website card?


#23

@juanshishido - I’ll be trying tonight, I believe my image size is ok but will triple check it all again in light of your most recent updates and feedback. Thanks for your support!


#24

Sounds good, @SocialOpinions. Keep us posted :slight_smile:


#25

@SocialOpinions: All good now?


#26

@juanshishido - sorry, still testing! Will let you know asap.


#27

@juanshishido Hi,I have the same problem. I want to know media type,such as image or vedio.But I do this return error. Like this:
twurl -H http://upload.twitter.com “/1.1/media/upload.json?command=STATUS&media_id=********” | python -m json.tool
{
“error”: “Invalid mediaId.”,
“request”: “/1.1/media/upload.json”
}
Can you help me?


#28

@wangdao: Please see this reply in this thread. Essentially:

You must not call STATUS command if FINALIZE response doesn’t contain ‘processing_info’ field.

This is documented here.


#29

hi,I did this:

$ twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=INIT&total_bytes=155921&media_type=image/jpeg" | python -m json.tool
{
    "expires_after_secs": 86399,
    "media_id": 839306071013371905,
    "media_id_string": "839306071013371905"
}
$ twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=839306071013371905&segment_index=0" --file /home/wangdao/TwitterSmartAdsTest/pic/female/twitter_20170301_all_female_me_product_carousel_042263042TD.jpg  --file-field "media"
twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=FINALIZE&media_id=839306071013371905" | python -m json.tool

when I do this,return nothing

twurl -H upload.twitter.com "/1.1/media/upload.json?command=FINALIZE&media_id=839306071013371905"

don`t like document said:


Direct Message post with media returns code 131 (Internal server error)