to get a personalized navigation.
to get a personalized navigation.
Hi,
we also try to get started with the service integration but I only get 401 in Postman. Generating token work great now (that means that clientID/Secret/Scope and all should be in place).
But when posting:
{
availableCustomers(vismaNetCustomerId:3466752)
{
totalCount
items
{
name
vismaNetCustomerId
}
}
}
to https://business.visma.net/api/graphql
results in:
<html>
<head>
<title>401 Authorization Required</title>
</head>
<body>
<center>
<h1>401 Authorization Required</h1>
</center>
<hr>
<center>nginx</center>
</body>
</html>
We followed the documentation for setup of the user in VBNxt. But how should we proceed now. Token generation is working, but API answers with 401 - where do we start here?
Florian
Hi Florian
As I can see you already have the customerID, I suppose it is the available companies you are looking for?
Try this:
{
availableCompanies(customerNo: 3466752) {
totalCount
items {
name
vismaNetCompanyId
}
}
}
It should return at least one companyID, which you then should be able to proceed with - useCompany(no: xx) - where xx equals the companyID.
Also, if you want to use client credentials, you need to use the service-API, as Ole points out. Otherwise, you are running in a user context.
Thank you Øyvind and Ole,
It's working now. I did not recognize that we used the wrong endpoint-address.
Florian
Great. You can also fetch the correct endpoint from the Visma Connect token.
https://github.com/omelhus/VBNXT.Console/blob/master/src/VBNXT.Console/Program.cs#L35-L46
AH okay, I see that the Visma Business NXT GraphQL API is missing in the Application Setup in addition the Visma Business NXT GraphQL Service API. But I can't choose it either.
FLorian
Does not work either when I create a new application. I'm also missing the following fields due to the documentation
You'll have to use a user context to fetch the correct customer number using the availableCustomers query, and then use the availableCompanies query to find what companies are available for that customer.
Use https://business.visma.net/api/graphql-service.
fragment VismaCompany on VbcCompany {
name
vismaNetCompanyId
}
query GetAvailableCompanies($customerNo: Long!) {
availableCompanies(customerNo: $customerNo) {
totalCount
items {
...VismaCompany
}
}
}
Copyright © 2022 Visma.com. All rights reserved.