When I call GET accounts/:account_id/cards/all, I can’t seem to get the website card.

When I added the uri of conversational card and website card to the card uri parameter, only the information of conversational card was returned.

Then, I called GET accounts/:account_id/cards/all/:card_id
I received this error message

TwitterAdsApiError => HTTPStatusCode: 400, code: INVALID_PARAMETER, message: Expected an id, got "1543855857460985692" for card_id

I noticed that the ID format of the Conversational and Website cards are different.
Could this be the cause of the bug?

Thank you.

1 Like

Hello,

Thanks for reaching out. As for the 400 error, it seems like there is no card_id param that can be specified in the card fetch ( GET accounts/:account_id/cards/all) endpoint. As such, you are facing this the 400 error.

We are currently investigating on an issue where using the card fetch API (GET accounts/:account_id/cards/all?:card_uris), it returns no data (Could be related to what you have mentioned, where the website card does not appear).

For now, please use the GET accounts/:account_id/cards endpoint to retrieve the relevant details of the cards first.

We will update again when the team replies on the issue related to card fetch endpoint.

1 Like

As for the 400 error, it seems like there is no card_id param that can be specified in the card fetch ( GET accounts/:account_id/cards/all) endpoint. As such, you are facing this the 400 error.

Yes, That is the problem.
When I called the card creation API (POST accounts/:account_id/cards), it was in the response as an ID.
Below is the response.

{
  "request"=>{
    "params"=>{
      "account_id"=>"18ce55eu180"
    }
  },
  "data"=>{
    "name"=>"test web site",
    "components"=>[
      {
        "media_key"=>"7_1544261678405406720",
        "media_metadata"=>{
          "7_1544261678405406720"=>{
            "type"=>"VIDEO",
            "url"=>"https://video.twimg.com/ext_tw_video/1544261678405406720/pu/pl/xWmqh_fAIsc9wlCj.m3u8?tag=12&container=fmp4",
            "width"=>1920,
            "height"=>1080,
            "video_duration"=>11225,
            "video_aspect_ratio"=>"16:9"
          }
        },
        "type"=>"MEDIA"
      },
      {
        "title"=>"This is Head line Content",
        "destination"=>{
          "url"=>"https://www.google.com/",
          "type"=>"WEBSITE"
        },
        "type"=>"DETAILS"
      }
    ],
    "id"=>"1544261978302316546",
    "created_at"=>"2022-07-05T10:08:41Z",
    "card_uri"=>"card://1544261978302316546",
    "updated_at"=>"2022-07-05T10:08:41Z",
    "deleted"=>false,
    "card_type"=>"VIDEO_WEBSITE"
  }
}

Is this ID not the ID of the card?

For now, please use the GET accounts/:account_id/cards endpoint to retrieve the relevant details of the cards first.

Okay. Thank you!

Hello,

Yes it is the ID of the card. I understand where you are coming from. I am checking with the team that is handling this. I will update again when they respond.

Hey!
I am also facing the problem when using the card fetch API (GET accounts/:account_id/cards/all?:card_uris ) no data is returned (data: []).
Any updates on this?

Hello,

Yes the team is investigating on this issue. We will update again when we have information from them. For now, please use the GET accounts/:account_id/cards endpoint to retrieve the relevant details of the cards first.

Could it be that this is related to this issue: Unable to retrieve card names from Tweets created in New Tweet Composer - #6 by juanshishido ?

Hey,

Thanks for checking on it but it does not seem like the case for this. As mentioned in the attached document, it says This /cards/all endpoint only returns cards created via the individual card create endpoints.

However, I think some of the users are also facing an issue where even though the card is created from the individual card endpoint, it still does not reflect in the cards/all endpoint.

Hence, we are still investigating on this.

Thank you. Could you please also refer me to the place where I can find what is the expected response type from GET accounts/:account_id/cards? I see there is an example, but it would be better to see actual types (like, what fields are mandatory and what could be returned as nulls?)

Hello,

From the documentation that you see, there are params which are specified as “required” / “optional”.
Screenshot 2022-07-15 at 8.44.43 AM

This should give you a better understanding on what are the mandatory fields required when performing the API call.

Note that for the GET accounts/:account_id/cards endpoint, it only returns cards that were created using the POST accounts/:account_id/cards endpoint. Cards created using other endpoints are not returned.

As such, if you would like to include all cards that were created by other endpoints, please specify the include_legacy_cards=true param.

Sample GET API call:

twurl -H ads-api.twitter.com "/11/accounts/<account_id>/cards?include_legacy_cards=true" | jq .

You can find more information on twurl here

Hey,

What you replied is the request parameters, and I was talking about the response.
E.g. new endpoint GET accounts/:account_id/cards response structure differs a lot from the response of GET accounts/:account_id/cards/all.

The documentation does provide some response examples, however, not all the fields are discussed. For some fields, we simply take values from the example response. E.g. if the value is value: "some-string" in an example response, we assume it’s a string. However, we do not know whether it’s a mandatory field and will always have a value, or an optional field and we need to handle the case when the value will be null. I was asking more of this kind of documentation.

Hello,

Unfortunately, for now, we do not have documentation which talks about fields that are mandatory/optional in the response of the API call. We only have examples, which is the one you shared.