Adding posts to pool via API/scriptingPosted on: 12/13/23 08:44AM
I'm working on migrating my favorites to pools (as I appear to have hit the cap). Getting lists of favorites, deleting them - no problem. However, I'm having some trouble adding a post to a pool (public for testing; will be personal when done). I didn't see a direct API endpoint for this, but I found the following code in the page (de-obfuscated variables):
function addToPoolID(post_id) {
var pool_id = prompt("Please enter the ID of the pool you wish to add this post to.");
if (pool_id == "" || pool_id == null) {
return false
}
var json_data = {
id: pool_id,
commit: "import"
};
json_data.posts = {};
json_data.posts[post_id] = 1;
$.post("index.php?page=pool&s=import&id=" + pool_id, json_data, function(d) {})
}
Based on this I tried to whip up a quick proof-of-concept in first Perl, then simply curl, but no luck:
curl -v -d '{"commit":"import","id":61515,"posts":[9348759:1]}' -H 'Content-Type: application/json' '
gelbooru.com:443/index.ph...import&id=61515'I'm sure whatever I have wrong here is simple and subtle - anyone see what? Or have a better way of programmatically adding posts to a pool?