Topic: Updating posts via the API

Posted under General

The way I do it is by creating and sending a POST request to http://e621.net/post/update.xml with the following POST fields:

id=<id>
post[source]=<source goes here>
login=<username>
password_hash=<e621.net password hash>

But yeah, post[source] is kind of weird. When uploading, it's used to point to the file you want to upload. (When you're uploading a file through a multipart form, I don't know if post[source] will override it, or set the Source text).

When updating a post, it just sets the Source field like you'd expect. Annoyingly, when you're uploading, since you're already using post[source] to point to the remote file, you can't also set the Source field without sending a second request after the post is uploaded to update the Source field. I fixed this in the next update by adding a post[sourceurl] parameter so you can upload a remote image and set its source in the same request.

I've fixed this in the next update, so you can use post[sourceurl] to fill the Source field if you're already using post[source] to point to the remote image to upload.

Updated by anonymous

  • 1