dolor3sh4ze
dolor3sh4ze

Reputation: 1165

404 not found on Revolut API

Today I started coding a script in NodeJS that uses the Revolut API. The problem being that I can't retrieve the account information, I systematically fall on a 404 page.

I made a first request as said in the documentation to retrieve my authentication token:

curl --location --request POST 'https://b2b.revolut.com/api/1.0/auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=myauthcode' \
--data-urlencode 'client_id=myclientid' \
--data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \
--data-urlencode 'client_assertion=myjwttoken'

From this request I get an answer in this style:

{
    "access_token": "an access token",
    "token_type": "bearer",
    "expires_in": 2399,
    "refresh_token": "a refresh token"
}

Now, with this access_token, I try to make a new query:

curl --location --request POST 'https://b2b.revolut.com/api/1.0/accounts' \
--header 'Authorization: Bearer <access_token>'

But I always get the same answer:

{
    "message": "The requested resource not found"
}

I don't understand why I always get a 404...

Upvotes: 1

Views: 524

Answers (1)

rjbathgate
rjbathgate

Reputation: 319

The documentation suggests the accounts endpoint is a GET request

https://developer.revolut.com/docs/manage-accounts/#api-reference-api-reference-accounts-get-accounts

You're sending a POST, not a GET.

This is untested, but when I do simple GET to the endpoint I get "message":"The request should be authorized. which is better than a 404.

Upvotes: 1

Related Questions