61 lines
1.8 KiB
HTTP
61 lines
1.8 KiB
HTTP
@oauthBaseUrl = https://api.sparebank1.no/oauth
|
|
@bankingBaseUrl = https://api.sparebank1.no/personal/banking
|
|
|
|
### Authorize with Sparebank1
|
|
GET {{oauthBaseUrl}}/authorize?client_id={{sparebank1OauthClientId}}&
|
|
state={{sparebank1OauthState}}&
|
|
redirect_uri={{sparebank1OauthRedirectUri}}&
|
|
finInst=fid-smn&
|
|
response_type=code
|
|
|
|
### OAuth2 Access Token Request
|
|
# Refresh token is valid for 365 days
|
|
# Access token is valid for 10 minutes
|
|
@authenticationCode=<insert code here>
|
|
POST {{oauthBaseUrl}}/token
|
|
Content-Type: application/x-www-form-urlencoded
|
|
|
|
client_id = {{sparebank1OauthClientId}} &
|
|
client_secret = {{sparebank1OauthClientSecret}} &
|
|
code = {{authenticationCode}} &
|
|
grant_type = authorization_code &
|
|
state = {{sparebank1OauthState}} &
|
|
redirect_uri = {{sparebank1OauthRedirectUri}}
|
|
|
|
> {%
|
|
client.global.set("ACCESS_TOKEN", response.body.access_token)
|
|
client.global.set("REFRESH_TOKEN", response.body.refresh_token)
|
|
%}
|
|
|
|
### OAuth2 Access Token Refresh
|
|
|
|
POST {{oauthBaseUrl}}/token
|
|
Content-Type: application/x-www-form-urlencoded
|
|
|
|
client_id = {{sparebank1OauthClientId}} &
|
|
client_secret = {{sparebank1OauthClientSecret}} &
|
|
refresh_token = {{REFRESH_TOKEN}} &
|
|
grant_type = refresh_token
|
|
|
|
> {%
|
|
client.global.set("ACCESS_TOKEN", response.body.access_token)
|
|
client.global.set("REFRESH_TOKEN", response.body.refresh_token)
|
|
%}
|
|
|
|
### Hello World from Sparebank1
|
|
|
|
GET https://api.sparebank1.no/common/helloworld
|
|
Authorization: Bearer {{ACCESS_TOKEN}}
|
|
Accept: application/vnd.sparebank1.v1+json; charset=utf-8
|
|
|
|
### Fetch all accounts
|
|
GET {{bankingBaseUrl}}/accounts
|
|
Authorization: Bearer {{ACCESS_TOKEN}}
|
|
|
|
### Fetch all transactions of the previous day
|
|
# TODO date search not working?
|
|
GET {{bankingBaseUrl}}/transactions?accountKey={{brukskontoAccountKey}}&fromDate=2024-11-14&
|
|
toDate=2024-11-15
|
|
Authorization: Bearer {{ACCESS_TOKEN}}
|
|
|