AnsweredAssumed Answered

RESTfm POST not working, all else works

Question asked by FMCostaRica on Apr 16, 2018
Latest reply on Apr 21, 2018 by FMCostaRica

Hola amigos,

 

I got RESTfm installed in FM Server 16, so far I have used it to GET records and perform scripts, all that works great, installation report from RESTfm shows all items in green telling me it is working fine.

 

Recently I have the need to create records from a php script and no matter what I tried it doesnt work.

 

To make it easy for troubleshooting purposes I created the POST HTTP request with Postman and the problem is the same, I get FileMaker error 500 from the RESTfm result.

 

The user has the correct rights to create records in that table and layout, I even gave that user Full Access to test and make sure I was not missing something but that did not work either.

 

Here is my request from Postman code:

curl -X POST \

  https://www.fms.domain.com/RESTfm/dataBaseName/layout/layoutName \

  -H 'Accept: application/json' \

  -H 'Authorization: Basic oipua09w8er080' \

  -H 'Content-Type: application/json' \

  -d '{

    "data": [

        {

            "name": "Jimi"

        },

        {

            "lastName": "Hendrix"

        }

    ]

}'

 

For testing purposes I am trying to add Jimi Hendrix to my database as a contact, but no luck.

 

I have also tried the bulk option and also sending the query parameters via URL, but nothing.

 

With RESTfm debugging turned on I get this as an error: "exception 'RESTfm\\BackendFileMaker\\FileMakerResponseException' with message 'FileMaker Error' in /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/lib/RESTfm/BackendFileMaker/FileMakerOpsRecord.php:88\nStack trace:\n#0 /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/lib/RESTfm/OpsRecordAbstract.php(209): RESTfm\\BackendFileMaker\\FileMakerOpsRecord->_createRecord(Object(RESTfm\\Message\\Message), Object(RESTfm\\Message\\Record), 1)\n#1 /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/lib/RESTfm/OpsRecordAbstract.php(167): RESTfm\\OpsRecordAbstract->createBulk(Object(RESTfm\\Message\\Message))\n#2 /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/lib/uriLayout.php(283): RESTfm\\OpsRecordAbstract->createSingle(Object(RESTfm\\Message\\Message))\n#3 [internal function]: uriLayout->post(Object(RESTfm\\Request), 'database', 'layout')\n#4 /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/lib/tonic/lib/tonic.php(695): call_user_func_array(Array, Array)\n#5 /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/lib/RESTfm/Resource.php(54): Tonic\\Resource->exec(Object(RESTfm\\Request))\n#6 /Library/FileMaker Server/HTTPServer/htdocs/RESTfm/RESTfm.php(99): RESTfm\\Resource->exec(Object(RESTfm\\Request))\n#7 {main}",

 

RESTfm Report:

OK: RESTfm version

  5.0.1/20171223-f1578aa

OK: PHP version

  5.6.24

  /Library/FileMaker Server/Web Publishing/publishing-engine/php/sierra/lib/php.ini

OK: PHP PDO drivers

  mysql, sqlite

OK: Web Server version

  Apache/2.4.25 (Unix) LibreSSL/2.2.7

OK: Host Server version

 

I reached out to Goya about a week ago, but since I am not a contributor they may not ever get back to me.

 

Any help will be greatly appreciated.

Outcomes