Skip to content

Question: Is it possible to send multipart/form-data request? #218

Open
@Klarys

Description

@Klarys

Hello!
I'm working with an API that requires me to send some files as multipart/form-data. Is this possible to achieve with restish? This is how the command's help looks like:

  ## Argument Schema:                                                                                                                                                                                                              
                                                                                                                                                                                                                                   
    {                                                                                                                                                                                                                              
      id: (string)                                                                                                                                                                                                         
    }                                                                                                                                                                                                                              
                                                                                                                                                                                                                                   
  ## Input Example                                                                                                                                                                                                                 
                                                                                                                                                                                                                                   
    {                                                                                                                                                                                                                              
      "filename": [                                                                                                                                                                                                                
        "string"                                                                                                                                                                                                                   
      ]                                                                                                                                                                                                                            
    }                                                                                                                                                                                                                              
                                                                                                                                                                                                                                   
  ## Request Schema (multipart/form-data)                                                                                                                                                                                          
                                                                                                                                                                                                                                   
    {                                                                                                                                                                                                                              
      filename: [                                                                                                                                                                                                                  
        (string format:binary)                                                                                                                                                                                                     
      ]                                                                                                                                                                                                                            
    } 

I've tried several approaches but I wasn't able to figure out something that works. Some examples:
1.

restish my-api upload-file 650d9c463c92333e6aa6cc0 @file
ERROR: Caught error: not sure how to marshal multipart/form-data
restish my-api upload-file 650d9c463c92333e6aa6cc0 filename: @file
ERROR: Caught error: not sure how to marshal multipart/form-data

I've also tried adding -H "Content-Type: multipart/form-data" to those commands but the result was the same. Am I doing something wrong or is there just no support for multipart/form-data? I will really appreciate any help, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions