I am created a piefed interface as a fun personal project but every time I try to create a post I get the following error:

{  
    "code": 400,  
    "message": "Validation failed",  
    "status": "{'json': {'title': ['Missing data for required field.'], 'community_id': ['Missing data for required field.']}}"  
}  

It says I’m missing the title and community but here’s what the body looks like on my most recent attempt:

{  
        "body": "[Source](https://mstdn.social/@grickle/115345057031028219)\n\nAlt Text: A cartoon illustration of a vampire in his living room surrounded by his pesky West Highland terriers. Caption reads \"He and the Westies had tormented the village for centuries now.\"",  
        "community_id": 891,  
        "language_id": 0,  
        "nsfw": false,  
        "title": "Forever pests.",  
        "url": "https://media.mstdn.social/media_attachments/files/115/345/056/927/012/957/original/b20b96453c62665c.jpeg"  
}  

The title is very much there and so is the community ID. Am I missing something?

  • Maven@crust.piefed.socialOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    I’m using reqwest within Rust. I think youre definitely right though. Tomorrow when I’m back at my desk ill try submitting the body in a different way

    • wjs018@piefed.wjs018.xyz
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 month ago

      I don’t really know rust at all…but combining what I found from a quick search here and the official docs, it looks like you need to build a structure matching the json that is then serialized into json by reqwest rather than passing a json string directly.