【问题标题】:How to pass JSON string as parameter through postman如何通过邮递员将JSON字符串作为参数传递
【发布时间】:2021-12-24 01:02:05
【问题描述】:

我应该如何通过邮递员传递 JSON 字符串作为参数?

这是我想要使用的 API: /templates/published?page=0&size=25&sort=credentialSchemaIdentifiers,asc&q=Health&filter=&filterDTO={"firstName":"DAN"}

但是对于最后一个参数filterDTO它没有通过并返回一个Bad Request错误

【问题讨论】:

    标签: json api parameters get postman


    【解决方案1】:

    你最好试试这个

    ... /templates/published?page=0&size=25&sort=credentialSchemaIdentifiers,asc&q=Health&filter=
    &filterDTOName=firstName&FilterDtoValue=DAN
    

    或者您可以进行发布操作

    [HttpPost("~/templates/published")]
    public ActionResult Published ([FromBody] Jobject filterDto, [FromQueryString] int page, int size, ...)
    

    {"firstName":"DAN"}
    

    变成一个Postman body,另一个参数变成url

    【讨论】:

      猜你喜欢
      • 2021-04-05
      • 2014-02-03
      • 2018-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多