Tweet update with card_uri

api
cards

#1

Hi there, we are currently migrating to the V2 and we encountered a weird behaviour with the new card_uri field.
We create a tweet with the new field and it respond an error :

curl -X POST \
  https://api.twitter.com/2/statuses/update.json \
  -H 'authorization: OAuth oauth_consumer_key=\"kh6x0yPTflIQCzdI9ecw\",oauth_token=\"__-__\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1507727118\",oauth_nonce=\"7rZ4SLzwLDp\",oauth_version=\"1.0\",oauth_signature=\"__\"' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -H 'postman-token: 7d83da98-a84d-a998-98a3-f6d3d1361a09' \
  -F 'status=test message with new card uri field 02' \
  -F nullcast=true \
  -F cardUri=card://917378325345128448
{"errors":[{"message":"Sorry, that page does not exist","code":34}]}

The card itself is readable and do respond a card_uri field so we assumed it was safe to use it in a tweet.

What did we missed ? The changelog says : “The new card_uri parameter is accepted in the POST accounts/:account_id/tweet8 and POST statuses/update4 endpoints.”

Thanks !


#2

Thanks for the question, @PMillier. It looks like you’re using /2/ with the POST statuses/update endpoint. For the Public API, the version is /1.1/. Let us know if updating the version in the path helps resolve your issue.


#3

Hey @juanshishido,
sorry about that I put only half of the test.

We tested in 1.1 and the field card_uri is not processed in the tweet.

Call :

curl -X POST \
  https://api.twitter.com/1.1/statuses/update.json \
  -H 'authorization: OAuth oauth_consumer_key=\"kh6x0yPTflIQCzdI9ecw\",oauth_token=\"1605831858-Yaszrvs6rZMgktifTWMhAdZL9ll62yAnX4gnihh\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1507727362\",oauth_nonce=\"oiTV1agewQu\",oauth_version=\"1.0\",oauth_signature=\"t47tqasg3pXS4j5rHHEdYOs%2BAVc%3D\"' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -H 'postman-token: 889c1a48-5868-3e4e-4d29-6880d1df28ab' \
  -F 'status=test message with new card uri field 03' \
  -F nullcast=true \
  -F cardUri=card://917378325345128448
{"created_at":"Wed Oct 11 13:09:22 +0000 2017","id":918101217854803968,"id_str":"918101217854803968","text":"test message with new card uri field 03","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[],"urls":[]},"source":"\u003ca href=\"http:\/\/www.socialmoov.com\" rel=\"nofollow\"\u003eSocialmoov\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":1605831858,"id_str":"1605831858","name":"Catan Yann","screen_name":"CatanYann","location":"","description":"","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":0,"friends_count":1,"listed_count":0,"created_at":"Fri Jul 19 12:46:24 +0000 2013","favourites_count":0,"utc_offset":10800,"time_zone":"Athens","geo_enabled":true,"verified":false,"statuses_count":15,"lang":"fr","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/431065291074727937\/7NisUxqM_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/431065291074727937\/7NisUxqM_normal.png","profile_link_color":"A11E29","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"translator_type":"none"},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":0,"favorited":false,"retweeted":false,"scopes":{"followers":false},"lang":"en"}

Tweet without the card :

Hope this helps more.


#4

Thanks for the additional information, @PMillier. The param is card_uri, not cardUri. Let us know if that helps.


#5

Oh, that makes perfect sense… I will conduct more tests and let you know. It does help a lot ^^


#6

hey Juan,
just confirming it works fine with the proper parameter name. Thanks for the help.

Resolved.