My Products
Help
Florian Haase
PARTNER

API Updates

by Florian Haase

Hi

 

to avoid to hit the Quota limitations at once, I try to find out how to update several rows in a table with one API-call, but I don't get that work:

 

Example:

mutation {
useCompany(no: 13245678) {
a1: associate_update(value: {bankAccount: ""}, filter:{_and: [{associateNo: {_eq:4016}}]})
{
items
{
associateNo
bankAccount
}
}

a2: associate_update(value: {bankAccount: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}, filter:{_and: [{associateNo: {_eq:4017}}]})
{
items
{
associateNo
bankAccount
}
}

}
}

 

 

Results in:

{
"errors": [
{
"message": "Error: Illegal IBAN \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\".",
"extensions": {
"data": {
"status": 0
}
}
}
],
"data": {
"useCompany": {
"a1": {
"items": [
{
"associateNo": 4016,
"bankAccount": ""
}
]
},
"a2": {
"items": [
{
"associateNo": 4017,
"bankAccount": ""
}
]
}
}
},
"extensions": {
"vbnxt-trace-id": "00000000000000005f852d7e603273db"
}
}

 

And this here:

mutation {
useCompany(no: 13245678) {
a1: associate_update(value: {bankAccount: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}, filter:{_and: [{associateNo: {_eq:4016}}]})
{
items
{
associateNo
bankAccount
}
}

a2: associate_update(value: {bankAccount: ""}, filter:{_and: [{associateNo: {_eq:4017}}]})
{
items
{
associateNo
bankAccount
}
}

}
}

 Results in:

{
"errors": [
{
"message": "Error: Illegal IBAN \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\".",
"extensions": {
"data": {
"status": 0
}
}
}
],
"data": {
"useCompany": {
"a1": {
"items": [
{
"associateNo": 4016,
"bankAccount": ""
}
]
},
"a2": {
"items": [
{
"associateNo": 4017,
"bankAccount": ""
}
]
}
}
},
"extensions": {
"vbnxt-trace-id": "00000000000000004f26c5c4ae15cf18"
}
}

 Thats means that I get exact the same error-message without a reference to the right query. 

The result in both queries is the same too.

 

1. Bundling the row-updates to 1 Graphql complicates things a lot on our site

2. The error-handling does not work as it is

 

What is the best suggestion?

 

Florian

6 REPLIES 6

by Marius Bancila

Batching requests is now available. See the documentation here: https://docs.business.visma.net/docs/features/batches

omelhus
PARTNER

by omelhus

Would be cool if batch operations were executed in parallel, since they won’t share any data between them. And if you need something executed sequentially you could use the “inline batch”.

omelhus
PARTNER

by omelhus

Awesome!

AllanEgebjerg
CONTRIBUTOR ***

by AllanEgebjerg

Is there any plans from Vismas side to enable GraphQL batching? 

omelhus
PARTNER

by omelhus

This should be possible using GraphQL batching, but I don't think it's enabled from Visma's side.

 

omelhus_0-1685457682356.png

 

This will create a request like the one below, and the API returns a 500 error. 

 

omelhus_1-1685457766204.png

 

 

Florian Haase
PARTNER

by Florian Haase

Hi Ole,

 

okay - one thing is that this is not working, but why do you think the errorhandling would work better than in my solution? What would the result be?

 

Florian