Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile paths changed #99

Open
cfh-se opened this issue Apr 15, 2023 · 6 comments
Open

Mobile paths changed #99

cfh-se opened this issue Apr 15, 2023 · 6 comments

Comments

@cfh-se
Copy link

cfh-se commented Apr 15, 2023

Hi,
I just started using the library again after a year and it seems that many of the api paths are not available anymore. I tried to proxy my iOS requests to capture the mobile app urls but for some reason I cant do it on iOS 16. Does anyone else have the possibility to find the new urls?

@frefor
Copy link

frefor commented Apr 16, 2023

Hi,
Thanks for a great API. I got these urls to work. They are probably the same for mobile apps. I don't know much about the previous mobile urls but I'm guessing the data payload has changed quite a bit.

constants.paths.TOTP_PATH = '/_api/authentication/sessions/totp';

constants.paths.POSITIONS_PATH = '/_api/position-data/positions';
constants.paths.OVERVIEW_PATH = '/_api/account-performance/overview/total-values';
constants.paths.ORDERS_AND_DEALS_PATH = '/_api/trading/rest/allordersanddeals';
constants.paths.FUND_PATH = '/_api/fund-guide/guide/{0}';
constants.paths.INSTRUMENT_PATH = '/_api/market-guide/{0}/{1}';
constants.paths.SEARCH_PATH = '/_api/search/global-search';
constants.paths.TRANSACTIONS_PATH = '/_api/transactions';

constants.paths.ORDER_NEW_PATH = '/_api/trading-critical/rest/order/new';
constants.paths.ORDER_EDIT_PATH = '/_api/trading-critical/rest/order/modify';
constants.paths.ORDER_DELETE_PATH = '/_api/trading-critical/rest/order/delete';
constants.paths.ORDER_GET_PATH = '/_api/trading-critical/rest/order/find';

constants.paths.STOPLOSS_NEW_PATH = '/_api/trading-critical/rest/stoploss/new';
constants.paths.STOPLOSS_EDIT_PATH = '/_api/trading-critical/rest/stoploss/modify';
constants.paths.STOPLOSS_DELETE_PATH = '/_api/trading-critical/rest/stoploss/{0}/{1}';
constants.paths.STOPLOSS_GET_PATH = '/_api/trading-critical/rest/stoploss';```

Also attaching index.js which I modified a bit for my own needs.

[avanza.zip](https://github.com/fhqvst/avanza/files/11241581/avanza.zip)

@jegt
Copy link

jegt commented Dec 3, 2023

I'm trying to use the new paths in my Elixir version of an Avanza client, and it does not respect my accept: application/json header. I get a bunch of HTML when requesting '/_api/account-performance/overview/total-values'.

Will we have to crawl the HTML to extract what we need now? Or do we need to make the requests look more like legit app requests? Properly setting user agents or stuff?

It works for me. I set both accept and content type to json and get json back.

@simpers
Copy link

simpers commented Dec 3, 2023

I'm trying to use the new paths in my Elixir version of an Avanza client, and it does not respect my accept: application/json header. I get a bunch of HTML when requesting '/_api/account-performance/overview/total-values'.
Will we have to crawl the HTML to extract what we need now? Or do we need to make the requests look more like legit app requests? Properly setting user agents or stuff?

It works for me. I set both accept and content type to json and get json back.

Yes, I had made a different mistake so it didn't compile properly to use the new endpoint. So my bad, and I am getting the JSON I expected now. That's why I deleted the comment hah

@linus-skold
Copy link

I'm getting a 302 http code, how did either of you solve that ?

@simpers
Copy link

simpers commented Dec 9, 2023

I'm getting a 302 http code, how did either of you solve that ?

I did nothing special other than just swapping out the old URL for the new one. So if everything else is working for you, that should as well? I'm coding in Elixir though so I'm not using this client as I'm writing my own.

@linus-skold
Copy link

Strange, I will have to look into it a bit more then. Might be a user-agent issue or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants