A few issues I've had with the Projects Preview API


#1

Hi GitHub Support team,

I’m working on providing support for the Projects Preview API (https://developer.github.com/changes/2016-09-14-projects-api/) in google/go-github (http://github.com/google/go-github) and I ran across a few issues:

I’m attaching a script that demonstrates the problems that I’ve found along with the output I see when I run the script.
It turns out that I can not upload a .sh or .log file to this forum. please email me and I will send the files to you.

Additionally, it seems odd to me that content_id is represented as a string when it is actually an integer.

Finally, I have a general question… I’ve noticed that all ID's in our package are defined as int whereas I think it might be better to specifically identify them as int64 if they truly could possibly be 64-bit integers. Can you please tell me if IDs within GitHub are represented as 64-bit integers (signed or unsigned)?

Thank you!
– Glenn Lewis


#2

:wave: hi @gmlewis!

Thank you for the great feedback! Let me break down your comments point by point:

You’re absolutely correct. I’ve updated this in the documentation.

  • moving a card to the bottom of a different column fails, although moving to the top of a different column succeeds

That seems like a :bug:. This hasn’t been reported yet, so I’ll research this and get back to you with a fix or an explanation as soon as I can.

  • moving a card after another card (which happens to be in another column) fails, although moving after another card in the same column succeeds.

That’s by design. You’ll need to pass the column_id along with the position string if the card is moving from one column to another. If this level of explicitness is unfavorable, please let us know and we’ll keep it in mind as we iterate on this API.

Definitely! Thank you for pointing these two out. I’ve updated them in the documentation.

Additionally, it seems odd to me that content_id2 is represented as a string when it is actually an integer.

That seems like an error in the documentation. I’ve updated it to be an integer :bow:.

Finally, I have a general question… I’ve noticed that all ID’s in our package are defined as int whereas I think it might be better to specifically identify them as int64 if they truly could possibly be 64-bit integers. Can you please tell me if IDs within GitHub are represented as 64-bit integers (signed or unsigned)?

Let me look into this and get back to you.

Thanks again for all of the feedback! I’ll circle back as soon as I can with the answers I didn’t have in this message.

Brooks


#3

:wave: hello again @gmlewis,

Regarding your earlier question:

When we refer to something as an “int”, it’s a 32-bit int. That being said, I’d like to stress that it may change in the future, and we’d do our best to communicate that to you should that day come. Based on that information, we’d recommend using an unsigned 64-bit integer.

I hope this helps, and I’ll circle back with a follow up to the below quote shortly:


#4

Thank you, @bswinnerton!

For now, I’ll leave the 'int’s alone in go-github as that would be a major breaking change for all users… but that is really good to know… if we were starting the design from scratch, I think we would definitely use uint64s for all IDs.

I’ll work on testing content_id - I’m concerned that it might be more than just a documentation change, but I’ll get back to you if it is.

Thanks for the information about moving a card after another one in a different column. It seems non-intuitive to me to require the column_id since the card_id is already unique (and it seems like you shouldn’t have to know where [in which column] the card is currently located to move another one after it), but that’s fine… maybe you could just clarify that column_id is required when using after:....

Thanks again!


#5

Hi @bswinnerton,

I’ve now tried to create new cards with content_id and content_type, but apparently I’m not doing it right, as I can’t get it to work. Here is what I tried, and below are the failed results:

echo "*** CREATING note in column, associating with issue..."
curl -i "https://api.github.com/repos/google-test/my-test-repo/projects/columns/120513/cards" \
     -X POST \
     -H "Authorization: token $TOKEN" \
     -H "Accept: application/vnd.github.inertia-preview+json" \
     --data $'
{
  "note": "Curl-created note associated with issue",
  "content_id": 8,
  "content_type": "Issue"
}
'

echo "*** CREATING note in column, associating with issue..."
curl -i "https://api.github.com/repos/google-test/my-test-repo/projects/columns/120513/cards" \
     -X POST \
     -H "Authorization: token $TOKEN" \
     -H "Accept: application/vnd.github.inertia-preview+json" \
     --data $'
{
  "content_id": 8,
  "content_type": "Issue"
}
'

echo "*** CREATING note in column, associating with issue..."
curl -i "https://api.github.com/repos/google-test/my-test-repo/projects/columns/120513/cards" \
     -X POST \
     -H "Authorization: token $TOKEN" \
     -H "Accept: application/vnd.github.inertia-preview+json" \
     --data $'
{
  "content_id": 7,
  "content_type": "PullRequest"
}
'

Here are the error messages:

*** CREATING note in column, associating with issue...

{
  "message": "Validation Failed",
  "errors": [
    "You can't provide a note and contentId for a single card."
  ],
  "documentation_url": "https://developer.github.com/v3"
}

*** CREATING note in column, associating with issue...

{
  "message": "Validation Failed",
  "errors": [
    "Note can't be blank, Project already has the associated issue"
  ],
  "documentation_url": "https://developer.github.com/v3"
}

*** CREATING note in column, associating with issue...

{
  "message": "Validation Failed",
  "errors": [
    "Could not resolve to a node with the global id of 'MDExOlB1bGxSZXF1ZXN0Nw=='"
  ],
  "documentation_url": "https://developer.github.com/v3"
}

Any ideas what I’m doing wrong?
Thanks!


#6

Hi @gmlewis,

A Project Card cannot have both a note and content value (where content is Issue or PullRequest), it can only have one or the other. That’s the reason you’re receiving:

{
  "message": "Validation Failed",
  "errors": [
    "You can't provide a note and contentId for a single card."
  ],
  "documentation_url": "https://developer.github.com/v3"
}

As for the following two errors:

{
  "message": "Validation Failed",
  "errors": [
    "Note can't be blank, Project already has the associated issue"
  ],
  "documentation_url": "https://developer.github.com/v3"
}

{
  "message": "Validation Failed",
  "errors": [
    "Could not resolve to a node with the global id of 'MDExOlB1bGxSZXF1ZXN0Nw=='"
  ],
  "documentation_url": "https://developer.github.com/v3"
}

These are both because you are passing the Issue number as the content_id argument instead of the Issue id. I’m assuming this is the Issue that you meant to add to the Project. You’ll want to first determine its ID, and then pass that as the value for content_id

$ curl https://api.github.com/repos/google-test/my-test-repo/issues/8 | jq .id
160506460

I’d imagine that if you were to modify your second curl command to the following, it would work:

curl -i "https://api.github.com/repos/google-test/my-test-repo/projects/columns/120513/cards" \
     -X POST \
     -H "Authorization: token $TOKEN" \
     -H "Accept: application/vnd.github.inertia-preview+json" \
     --data $'
{
  "content_id": 160506460,
  "content_type": "Issue"
}
'

I apologize for the content of these error messages. They’re not very helpful and we’re working on improving them.


Validation failed when moving card within a column
#7

SWEET!!! That worked, and I’m totally unblocked. Thanks so much, @bswinnerton! You rock!
:smile:


#8

@gmlewis, this should now be resolved. Thank you for reporting the bug!


#9

My pleasure, @bswinnerton… thanks for the cool API! This one was fun to test out and watch the cards fly around. :smiley:


#10

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.