Datatype mismatch between Jira expression and Rest API, can we expect numbers for IDs?

Looking at the Jira Cloud Rest API, some of resource ids are defined as string (eg: Project.id, Version.id, Issue.id…).

Now, if I look at the Jira Expression Types, same fields are defined as number.

Can I expect always having a number converted to a string in the Rest API responses ? (in other words, can I safely cast these strings to numbers ?)

This mismatch exists also inside the Rest API, because some “reference” fields are defined as number (eg: Component.projectId, Version.projectId)

The same mismatch exists in Jira Server, where the Jira Server Rest API defines string for entity ids, but if you access entity from the managers in java, internal datatypes are numbers…

4 Likes

@julien did you manage to get an answer, by any chance?

Also wondering about this. @Jira?

This is a pretty important one to know. It looks like strings and numbers are used interchangeably for the same properties in the API. It seems that the underlying data type is number, but we don’t want to make this assumption and Atlassian suddenly swaps out what looks like numbers to guid string values.