How to post a dictionary<string,object> with a file?

Hi There!

I am trying to figure out how to post an object that contains dictionary<string,object> to an ASP.NET Web API Controller.

The dictionary<string,object> needs to contains a file.

The endpoint takes an object, so I am trying to figure out how to get this working using x-www-form-urlencoded or raw.

My endpoint object looks like this:

public class PostData
{
    public string EntityName { get; set; }
    public object EntityId { get; set; }
    public string MethodName { get; set; }
    public Dictionary<string, object> Parameters { get; set; }
}

I have been trying figure out how to set they keys for dictionaries, can you help out? I need:

A dictionary named “Parameters” to contain:

  • FileName = “My file name”
  • FileExtension = “zip”
  • FileContent = The content of the file

Thank you!

Hey @garylima! Welcome to the Postman community :rocket:

I understand you would like to post object/dictionary to your endpoint.

Can you use raw body with JSON type like below?

Please let me know if that works :smiley: