splitwise / api-docs

API documentation for the Splitwise API.
http://dev.splitwise.com
29 stars 16 forks source link

Not able to add expenses in splitwise using REST API #20

Closed jakeershaik217 closed 4 years ago

jakeershaik217 commented 4 years ago

Hi,

I used POST method for the endpoint URL{ https://secure.splitwise.com/api/v3.0/create_group} but im getting following error as response body

{ "errors": { "base": [ "Invalid API Request: you do not have permission to perform that action" ] } }

jas14 commented 4 years ago

@jakeershaik217 , can you provide more details? Are you providing an OAuth bearer token with your request?

jakeershaik217 commented 4 years ago

@jas14 , First requested for Authorized token in postman for OAuth 2.0 but it didn't return any token then I opened new window in postman then I try to GET protocol to fetch things like groups,users,expenses all those all working but when i make POST protocol in expenses or Groups none of them are working and getting error mentioned in above comment.please let me know if you need more clarification.

Thanks.

jas14 commented 4 years ago

@jakeershaik217 , I'm not very familiar with Postman but based on your report that GET requests are working but POSTs are not, my best guess is that you're authenticated with cookies instead of OAuth.

To work with the API, you must authenticate with OAuth 2.0 and provide the access token with each request. Postman provides documentation on its own OAuth 2.0 authorization system. You can get a "Client ID" and "Client Secret" by registering an app on Splitwise.

jas14 commented 4 years ago

Thanks @jas14 for the reply.I used Soap UI tool to get access token but it's not retrieving any values,it's continuously loading even i tried with postman but i'm not able to see any access token.Please let me know if you need any thing else.attached screenshot

@jakeershaik217 thanks for the additional info, I'll check it out. In the meantime I've deleted your comment (and quoted it here) because it had a screenshot with your client ID and secret, which are sensitive data and should not be shared with anyone.

jas14 commented 4 years ago

The authorization code flow requires the user to authorize the app's access to their account by visiting a page on the OAuth provider's website. The app you're using should have opened a browser window at https://secure.splitwise.com/oauth/authorize?client_id=XXXXXX, where the client_id query parameter is the client ID you entered. If no browser opened to the Splitwise authorization page, there's no way your client can get the access code it needs to obtain an access token.

jakeershaik217 commented 4 years ago

Thanks buddy @jas14 now I'm able do all API calls .So much thankful for the help