Board and item ID spec/convention for input validation


What I’m doing

I’m currently parsing Monday board URLs to get their board IDs.

I can see that the board IDs that I happen to be working with are strings of 9 digits, like 123456789.

The issue

When I parse a URL, I’d like to be able to match against the ID spec so I know that what I have is an ID.

Grabbing the ID from its expected position in the URL (url.split("/")[4]) isn’t enough, since I need to guard against user input errors.

What I’m wondering about

Is string-of-9-digits a convention I can rely on for IDs? Will IDs ever:

  • Include alphabet characters?
  • Include punctuation or special characters?
  • Vary in length?

Thank you!

In my opinion, having an ID that matches a specification is only slightly better than nothing.

Validating by querying the database with the “suspected” ID would be better. Especially, if it is possible to verify against other expected information like the board name or an expected item, group, subscribers etc.

Validating by querying the database with the “suspected” ID

I can see value in this as well. It really depends on the use case as to which would be more suitable.

I’m hoping to make net fewer API calls to Monday in my current script. If I’m understanding correctly, sending a query to validate IDs would end up doubling the API calls I need to make. Although I’m convincible on pros and cons of any approach. :slight_smile:

If it is necessary to do the validation on the frontend then you are correct. If the number of API calls is a significant factor, maybe you could “validate” at processing time by adding some type of error handling for invalid IDs.

@Ash, Some additional thoughts…

I 'm working on something using APIs from excel. Partially based on your ideas, I put together a formula to extract a board ID from a cell that the user will paste a board link into. The user will be able to enter a board ID, a board URL, or board email address. The formula extracts the ID from this. It’s not perfect. But I think it will be sufficient. It does not depend a specific number of digits.

Here is the formula text just in case anyone is interested:

LEFT(LOWER(TRIM(B1)),6)=“board-”, VALUE(MID(B1,7,SEARCH("@",B1)-7)),
SEARCH("/boards/",B1&"/boards/")<LEN(B1), VALUE(MID(B1,SEARCH("/boards/",B1)+8,SEARCH("/",B1&"/",SEARCH("/boards/",B1)+8)-(SEARCH("/boards/",B1)+8))),
1, “ERROR”)