Flutter Filemaker API _find请求 [英] Flutter Filemaker API _find request

查看:55
本文介绍了Flutter Filemaker API _find请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Flutter(package:http / http.dart)向Filemaker发出http请求

Im trying to make a http-request to Filemaker with Flutter(package:http/http.dart)

我可以正常获得令牌,但是如果我尝试向Filemaker发出_find请求总是会被拒绝( 400错误请求),而不会出现任何消​​息。
在邮递员中,我可以执行完全相同的请求而没有任何问题!

I can get the token normally, but if i try the make an _find request to Filemaker it always get's rejected(400 Bad Request) without any message. In Postman I can do the exact same request without issue!

var body = { "query":[{
  "loginName": "==testUser@test.com"
}]};
Response response = await post(url,
         headers: {
           HttpHeaders.authorizationHeader: 'Bearer $token',
           HttpHeaders.contentTypeHeader: 'application/json'},
         body: json.encode(body));


推荐答案

已解决。

我能够使用Dio访问FileMaker布局中的一个用户。

I was able to access one user in a FileMaker layout using Dio.

  Dio dio = Dio();

   dio.options.headers['content-Type'] = 'application/json';
   dio.options.headers["authorization"] = "Bearer ${token}";

   Response recordResponse;

   recordResponse = await dio.post(
     findUrl,
     options: Options(followRedirects: false, validateStatus: (status) 
 {return status < 500;}),
     data: { "query":
       [{
           "username": "=Jake",
           "password": "=password"
       }]
     }
   );

这篇关于Flutter Filemaker API _find请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆