AnsweredAssumed Answered

Filemaker 17 API and Javascript

Question asked by rd.trammel on May 31, 2018
Latest reply on Jun 1, 2018 by mikebeargie

I'm trying to open a connection to a database from a web call and I get a cross domain error. Is there a way around this? Here is my javascript. Maybe you guys can tell me what I'm doing wrong. Is this a FileMaker limitation that we can't override?

 

const postUrl = "https://test-server.com/fmi/data/v1/databases/someDatabase/sessions";

 

let PostOptions = {

     method:'POST',

     body:{},

     headers:{

          'Content-Type': 'application/json',

          'Authorization': 'Basic YXBpX3VzZXI6YXBpJdVzZX==',

     }

};

 

let token = fetch(postUrl, postOptions)

                       .then(result=>{ if (result.OK) return result.JSON() })

                       .then(fm=>{return fm.response.token});

 

Has anyone else had success with calling the data api from a web app using javascript? How did you do it? or else, how have you worked around the limitations of the data api to take advantage of this feature?

 

Your experiences, thoughts, and ideas would be greatly appreciated. Thank you.

FileMaker 17 API Failing@

Outcomes