Using API to remove stories failing

stories

#1

I have a Board with some columns of cards and card in the third column with a gid of 762549936245465. I’m trying to use the API to remove the stories from the card as the card has 1000 stories and won’t hold any more. I’m told that a maximum of 1000 stories can be stored per card and I have hit that limit hard.

My initial url to get the list of stories from the card is

https://app.asana.com/api/1.0/tasks/762549936245465/stories

This works fine for all other cards, but for this particular card I always get

The remote server returned an error: (400) Bad Request.

What’s the solution?


#2

Hi @Bruce_Axtens :wave:t3:

I’m moving your thread to the #developersAPI; our API experts should be able to advise you!


#3

If you do the same request for other cards, that works fine? Asana is slowly rolling out gid on top of id and not all endpoints accept gid

Bastien - Asana Certified Pro
Delegate tasks to a virtual assistant :computer:


#4

So we have a board with an id 727446585486058. We have a column with some cards in it. The topmost card has an id of 762549936245465 (the value taken from the browser’s address bar). We cannot delete stories from that card using the API.

Immediately under that card is another card with an id of 756102822043252 (value taken from address bar). We have successfully deleted stories from this card.

Also the code we’ve developed does not explicitly specify whether the card identifier is an id or a gid. It’s simply an url with a DELETE http-verb.

Please clarify your comment as I’m curious to know how it applies to this situation.


#5

P.S. This card was converted to a project. This put the card to sleep in some way. We have since re-awakened the card.


#6

Hi @Bruce_Axtens, when our API returns a 400 Bad Request error, the body of the response should include a short description of what went wrong. Are you able to confirm whether the body contains this message and, if so, share it? For reference, the body would look something like this:

{
    "errors": [{
        "error": "html_lacks_body",
        "message": "Rich text should be wrapped in <body> tag."
    }]
}

#7

G’day @Joe_Trollo, that was a helpful suggestion. The response is quite interesting

{
    "errors": [
        {
            "message": "The result is too large. You should use pagination (may require specifying a workspace)!",
            "help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
        }
    ]
}

So I’ll experiment with pagination of the result-set. If I run into anything I can’t figure out I’ll be in touch.


#8

Okay @Joe_Trollo, I’m looking at https://asana.com/developers/api-reference/stories and I can’t see anything obvious regarding pagination. Haven’t given up yet though. Mind find something in related documentation resources.


#9

Okay, now we’re cookin’: https://app.asana.com/api/1.0/tasks/762549936245465/stories?limit=100


#10

Hi @Bruce_Axtens, because pagination applies to several endpoints and resources, the documentation for pagination has a dedicated page. I’m glad you were able to resolve the issue!