I have a web service that I want to access with FME. How can I do that? There is something about REST and OAUTH and such. help?
Best answer by fmelizard
View originalI have a web service that I want to access with FME. How can I do that? There is something about REST and OAUTH and such. help?
Best answer by fmelizard
View originalFME can absolutely connect to web services and has built in support for a number of popular ones.
If we don't have built in support, you can add it with this basic pattern.Here's an example using Fitbit (note: I haven't gotten it to work yet, but I seem to have the right info in the right place).
1) I went to dev.fitbit.com and registered my "app":
2) Fitbit accepted this and returned all the secrets I needed to know (some info truncated for privacy reasons):
3) I opened Tools > FME Options > Web Connections > Manage Services and created a new service. I filled in the info given to me by Fitbit. I knew it was an Oauth2 connection, so I created one of those:
Notice all I did was to paste in the values that were given by Fitbit.
4) It didn't work! I visited the api docs for Fitbit and from their example...
https://www.fitbit.com/oauth2/authorize?response_type=token&client;_id=22942C&redirect;_uri=http%3A%2F%2Fexample.com%2Ffitbit_auth&scope;=activity%20nutrition%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight&expires;_in=604800
...figured out that the paths they had given me were the truth, but not the whole truth. I had to edit the FME Authorization Parameters to include the type of authorization (code or token) and the Fitbit parts I wanted access to (Activity, Exercise, Nutrition, Sleep, etc).
I also checked the format for the refresh parameter and found it wasn't quite the default. I had to change the Request Format in FME to:
grant_type=refresh_token&refresh;_token=[REFRESH_TOKEN]&expires;_in=604800
Now the test button opened a web page and let me log in to Fitbit.
Unfortunately that's where the progress ends... it works in a web browser but not in FME. I don't know if they are returning the token/code in a way that FME can't interpret.
Anyway... if it's of help I would say the steps to add a web service are...
Hi Mark2AtSafe,
I know this is an old thread but I'm having some issues with oauth2 that I can't seem to fix.
I've made another thread about it here https://knowledge.safe.com/questions/77895/stored-web-connection.html
The first time I authenticated my profile when testing the web connection it asked me to login on the web service pop-up. However when I updated the credentials to another user it simply asks whether I will allow/deny the application but it never asks for login credentials again and it seems to cache the initial login credentials somewhere?
So on every PC where have logged in once I can't update the connection. I can even fill in random strings in the web connection parameters and it still retrieves my initial account info if I call it through the HTTP caller.
Also the API I want to connect needs proper use of the state parameter and I wonder how I would fill in a random string in the web connection setup?
The setup for the API is explained here in detail https://service.projectplace.com/apidocs/#articles/pageOAuth2.html
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.