Every object in the PostFlow API has a unique ID. PostFlow uses a system called “Snowflake ID” created by Twitter.
These IDs are 64-bit unsigned integers. Some programming languages (JavaScript) cannot accurately represent 64-bit integers.
You must ALWAYS use strings for PostFlow IDs in your code.
String vs integer in Javascript
In JavaScript, integers are limited to 53 bits. This causes precision loss with large IDs:
// This loses precision!
const id = 10765432100123456789;
console.log(id.toString()); // "10765432100123458000" — wrong!
// Use strings instead
const id = "10765432100123456789";
console.log(id); // "10765432100123456789" — correct!
Comparing IDs
Examples of how you can compare PostFlow IDs:
// Use BigInt
if (BigInt(post1.id) > BigInt(post2.id)) {
console.log("post1 is newer");
}