My Products
Help
AntonZ
CONTRIBUTOR ***

Business NXT Graph Api 401 error

by AntonZ

 

Hello,

When making requests to this endpoint, I'm encountering a 401 error. I have tried different applications and grant types, and everything works fine up to the point of making the request (authentication, access_code, and everything else are successful).

Here’s what my request looks like:

 

 

curl --location 'https://business.visma.net/api/graphql' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {access_code}' \ --data '{"query":"query GetAvailableCompanies {\n availableCompanies {\n totalCount\n items {\n name\n vismaNetCompanyId\n }\n }\n}","variables":{}}'

 

 

Could you please help identify the issue?

6 REPLIES 6
omelhus
PARTNER

by omelhus (Updated ‎10-12-2024 17:10 by omelhus PARTNER )

my guess is that you are missing the correct scope in your access token request, or if you are using a service integration you are missing the -service in the api url.

 

the correct url for service integrations is https://business.visma.net/api/graphql-service  

AntonZ
CONTRIBUTOR ***

by AntonZ
 

Yes, I know, but I need a different type of integration Business NXT GraphQL API. I am using scopes such as business-graphql-api:access-group-based and offline_access.

omelhus
PARTNER

by omelhus

Then I suggest that you verify that your access token is valid on https://jwt.io

AntonZ
CONTRIBUTOR ***

by AntonZ

image.pngIf I'm not mistaken, everything is fine with the token

omelhus
PARTNER

by omelhus

Yes, the last thing that comes to mind then is the expiry. Remember that the token expires after 1 hour.

AntonZ
CONTRIBUTOR ***

by AntonZ

Yes, I generate the token right before the request using a refresh token.