Topic: Unknown issue with "create post" feature of API

Posted under e621 Tools and Applications

As the title says, I'm having problems uploading images to esix using the API at https://e621.net/uploads.json, and the error messages aren't giving me much help.

The parameters I'm sending in look something like this (shortened down):

{
  "login": "SpruceMarten",
  "api_key": "************************",
  "tag_string": "smile :3 english_text 2020 ...",
  "rating": "s",
  "direct_url": "https://d.facdn.net/art/ ... .png",
  "source": "https://www.furaffinity.net/ ...",
  "description": "lorem ipsum \ndolor sit \namet"
}

(I'm also defining a User-Agent of "Image Uploader (by SpruceMarten)")

The message I get in response is this:

{
  "success": false,
  "message": "An unexpected error occurred.",
  "code": "352b0f98-d2a0-443d-9b2d-b415d3ac0cce"
}

Anyone who can see what I'm doing wrong?

@AoBird Oh yeah, that's true. I've altered the parameters to look like this instead:

{
  "login": "SpruceMarten",
  "api_key": "************************",
  "upload": {
    "tag_string": "smile :3 english_text 2020 ...",
    "rating": "s",
    "direct_url": "https://d.facdn.net/art/ ... .png",
    "source": "https://www.furaffinity.net/ ...",
    "description": "lorem ipsum \ndolor sit \namet"
  }
}

Unfortunately, it doesn't seem to have changed much. I still get the same "An unexpected error occurred." message.
I'm really confused now. I'm providing all the necessary information, and your change makes it correctly formatted. I should at least be getting some more helpful errors...

{
  "login": "SpruceMarten",
  "api_key": "************************",
  "upload[tag_string]": "smile :3 english_text 2020 ...",
  "upload[rating]": "s",
  "upload[direct_url]": "https://d.facdn.net/art/ ... .png",
  "upload[source]": "https://www.furaffinity.net/ ...",
  "upload[description]": "lorem ipsum \ndolor sit \namet"
}

Like that.

aobird said:

{
  "login": "SpruceMarten",
  "api_key": "************************",
  "upload[tag_string]": "smile :3 english_text 2020 ...",
  "upload[rating]": "s",
  "upload[direct_url]": "https://d.facdn.net/art/ ... .png",
  "upload[source]": "https://www.furaffinity.net/ ...",
  "upload[description]": "lorem ipsum \ndolor sit \namet"
}

Like that.

Yup, that fixed it!

{
  "success": true,
  "location": "/posts/2325820",
  "post_id": 2325820
}

I gotta be honest though, that's some pretty weird syntax. The docs could probably do a better job explaining that the brackets represent literal bracket characters.
Either way, thank you very much!

sprucemarten said:

I gotta be honest though, that's some pretty weird syntax. The docs could probably do a better job explaining that the brackets represent literal bracket characters.
Either way, thank you very much!

They do say field upload[rating], which means "upload[rating]"

{"upload[rating]":"s"}

is not the same as

{"upload":["rating":"s"]}

You're the first one to have that problem D:

  • 1