So, I’m trying to export my posts from AniList as new notes in Joplin (that do not previously exist. I made sure to create a unique ID through a function based on the post ID on that site. That way I can later update the notes whenever I get a «this not already exist» response. However, for some reason it doesn’t create the notes with the ID I set it as?
Here’s my conversion to a Joplin-compatible ID.
// Converting PostID to to 32 characters
postID = "414c5f414354" + postID.toString(16).padStart(32 - "414c5f414354".length, "0"); // 16 is optional. Changes it to hex
An example post ID from AniList is: 138726754
Here’s the code I parse into JSON to send to Joplin:
// Sending the data to Joplin
fetch("http://localhost:41184/notes?" + joplinToken, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"title": postTitle,
"parent_id": parentID,
"id": postID,
"body": postWithCommentsAndNames,
"user_created_time": postCreated
})
}).then(res => {
console.log("Request complete! response:", res);
});
A link to the source code on GitHub. All the code is in the file AniListFetch.js
Keep in mind that this isn’t the latest version. It still works, but it doesn’t go through all pages, only the first, and it doesn’t fall back on trying to update if it fails to create.
I’m not at my PC atm, and won’t be for the next 14 hours. But if I have to provide additional information, I’m do what I can. Joplin on mobile (iOS) doesn’t seem to let me check note IDs tho.