avanza icon indicating copy to clipboard operation
avanza copied to clipboard

Mobile paths changed

Open cfh-se opened this issue 1 year ago • 6 comments

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?

cfh-se avatar Apr 15 '23 17:04 cfh-se

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)

frefor avatar Apr 16 '23 07:04 frefor

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.

jegt avatar Dec 03 '23 17:12 jegt

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

simpers avatar Dec 03 '23 17:12 simpers

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

linus-skold avatar Dec 07 '23 08:12 linus-skold

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.

simpers avatar Dec 09 '23 13:12 simpers

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

linus-skold avatar Dec 11 '23 08:12 linus-skold