Search code examples
flutterdartfilemaker

Flutter request Filemaker API (FieldData)


Im trying to access one specific call to the filemaker API, I have several requests which are working.. but if i try to do one with the fieldData field it doesn't work

var body = {"fieldData": {
  "testId": myId
}};

  HttpClient httpClient = new HttpClient();
  HttpClientRequest request = await httpClient.postUrl(Uri.parse(url));
  request.headers.set('content-type', 'application/json');
  request.headers.add('authorization', 'bearer $token');
  request.add(utf8.encode(json.encode(body)));
  HttpClientResponse httpClientResponse = await request.close();
  String reply = await httpClientResponse.transform(utf8.decoder).join();
  httpClient.close();

I just get the error:

{"messages":[{"message":"Unknown parameter(s): fieldData","code":"960"}],"response":{}}

Edit: Url: https://{Server}/fmi/data/vLatest/databases/{database}/layouts/DataAPIaddresses/records/{id}


Solution

  • Found it:

    HttpClientRequest request = await httpClient.patchUrl(Uri.parse(url));
    

    You have to patchUrl, because Filemaker wants a Patch request...