I would like to be able to trigger payment orders through the Revolut Merchant API from FileMaker. I have the merchant account set up and have a simple working code that triggers a new payment order on the account (see below). This works just fine from Postman and Terminal, but when I run this from an Insert from URL script set in Filemaker, I simply get back '404 Not Found' in the result.
Insert using URL [Select ; With dialog: Off ; Target: $result ; $url ; cURL options: cURL]
I have tried numerous variations and even tried accessing other APIs with similar scripting with success. But I just can't get the Revolut API to play if I script it from FileMaker.
Any ideas?
P.s. I have no idea how to use --trace - is it possible to see what is actually being posted by FileMaker?
Malcolm is correct that the URL should be entered into the 'Specify URL' option of the Insert from URL script step rather than in the cURL Options. However, your use of the List function in your cURL options calculation results in the each cURL option/header being on a separate line numbers, whereas the cURL options should be a single line.
Note that although I have each option on a new line in the Specify Calculation dialog, these new lines actually evaluate as single spaces, so results in the desired single line... Here it is in Data Viewer:
I know that in the places I'm POSTing I haven't used the List function but I didn't realise it would interfere. I assumed that white space was not significant.
Thanks for that. I have put the URL into the Insert from URL script step, but put it here too for comepleteness. It makes no difference if I take it out.
I just noticed something - you are using smart quotes, e.g. --header “Revolut-Api-Version: 2023-09-01”
which is not the same as regular quotes: --header "Revolut-Api-Version: 2023-09-01"
Thanks Xoxhi - the quotes seem to make no difference (I have tried both). As far as I can make out, the handshaking is all working fine - al though from FileMaker I get the same result with a bogus API key and a correct one, so maybe there is something in this that is not working.
Thanks again
Currently I am testing with this code loaded into a text field for using as the cURLoptions:
Just worked out the difference between your code and mine - I put an extra '/' at the end of the URL!
I added the APIkey to your version and my corrected code and it still fails authentication. I will take this up with Revolut as I think it should be working now. There is still something peculiar about the actual output of FileMaker that the Revolut server doesn't agree with. It may just be one of the odd characters in the APIkey or something daft like that.
I will let you know how it goes. Thanks so much for your help - it is encouraging that I am so close.
Ok, I don't have a business account so it is difficult for me to help.
I have created a sample file referencing other APIs, could you fill in the API Key in the script step and execute the script once, and see the result, headers, and trace?
Thanks for everyones help here. At last I have it working.
I have at last located the issue(s) with the formatting of my cURL from FileMaker and the Revolut API is now accepting my authentication and responding correctly. It was just a peculiar bit of formatting that was holding the whole thing up.
I have been assembling the Insert from URL script step with variables holding url, cURL options (header) and data (JSON formatted). Adding the APIkey to the cURL options from a variable was not giving a result that was being accepted. By storing the APIkey in a text field and substituting it into the header cURL, it is now being accepted.
P.s. Substituting 'TempToken' for the API key was the only way I could get any of this to work. The only difference here is in the url query script containing the UUID and the lack of payload data. The $header and $curl_options work for other functions (create and retrieve payments). Postman put the "?=" on the end of the URL, which seems to make no difference. Should I be posting a blank data payload - and if so what?
Note: the payment ID shown here is an example from a record successfully cancelled. I am not trying to cancel records again that are already cancelled.
** the error reporting seems to tell me nothing. Trace shows nothing that I can decipher either.
It might be complaining that you're doing a POST but not passing any content via the -d option.
But to more quickly get to the bottom of it, I recommend installing ngrok on your computer, and then you can use that to create a temporary http server and inspect web requests. ngrok http 5000
Once running you can open the web interface in your browser at http://localhost:4040 and inspect web requests made to the temporary url that ngrok provisioned for you. You can make the "same" request from postman and filemaker, and look for differences.