x

API bug when creating locations with the same name

I'm facing weird behavior with creating locations. Sometimes when i try to create a new location with the same name (already existing on my seller account) i get an error that name already exists, but sometimes i just get the existing location back in the successful response.

These two outcomes don't happen randomly, they happen in batches. So it seem like they depend on something and I'm trying to understand what is it they depend on, but fruitless so far. 

Any suggestions? What am i missing here?

1,611 Views
Message 1 of 8
Report
7 REPLIES 7

Some more details:

Today if i try to create a new location with the same name as the location i created yesterday, i get: 

{
"code": "BAD_REQUEST",
"detail": "Location names must be unique within a merchant account",
"category": "INVALID_REQUEST_ERROR"
}


But if i do the same for the location i created 10 minutes ago, i get just this very location in response.


1,541 Views
Message 2 of 8
Report

This behavior seems very confusing to me (unless I'm missing something) because it allows the following to happen:

- A Seller has a Location with the name "My Restaurant" which is used by some Square Service (and merchant account)
- The Seller decides to use another service and expects its Square Merchant account to create a new Location for it
- The Merchant also expects the same behavior when calls the POST Location endpoint upon the Seller Square Account connection. It names the location by the Seller's restaurant name (i.e. "My Restaurant") and successfully "creates" it. But in fact no new location was created: the existing one was returned instead. But the Merchant (and the Seller) have no idea about it. The response from the POST Location endpoint is just the same as if the location was successfully created

In result: the same Square Location is used by two Merchants and nobody knows about it

Is it possible or am i missing something?

1,533 Views
Message 3 of 8
Report

any help on this one?

1,495 Views
Message 4 of 8
Report
Square Community Moderator

Hey @Mikhail - I will be sending you a private message to ask further questions related to your case. 

 

Please be on the lookout. Have a great day! 

Sayra
Community Moderator, Square // Moderadora de la Comunidad, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Inicie seción y haga clic en Marcar como "Mejor Respuesta" si mi respuesta contesta su pregunta.
1,488 Views
Message 5 of 8
Report

Hello. It's been a while and still no clarification on the subject.
1,465 Views
Message 6 of 8
Report

I'm getting some replies to this topic in private. But I don't think they are supposed to be private as there is nothing private in it. To the contrary, it should be public imo because it seems like a problem in the API that can lead to some bad consequences I've described earlier. Also the support person I'm talking in private with doesn't seem to really understand the issue. So I'm hoping somebody else here might help us to get to the point.

So here is the message I've got in private:

Hello! Sorry for the delay, we had to escalate your case. We've tested your location issue on our end and determined that this is the expected behavior. Nicknames are unique and we use them as an idempotency key shortly after being created. If it's allowing you to make multiple locations with the same name, that is not its intent.

 

We also opened a ticket for our engineering team to look into the idempotency window because you will notice that this occurrence only happens if you create a location twice within a short amount of time. If you were to wait, say a day or so, you would notice you get that 400 error. 

 

I don't have a date or time for when this will be resolved but will keep an eye on the open ticket to provide any further updates. 

 

Thank you. 

And here will be my reply:

I don't think you understand the problem I'm facing. The problem is that I'm calling the POST endpoint with the existing location name and instead of getting an error saying that the location with this name already exists, I'm getting this very location in response like if it was successfully created. And then I can easily start using the existing location while being sure that it's a new one. That's the problem. 

1,419 Views
Message 7 of 8
Report
Square Community Moderator

@Mikhail - Feel free to ask further questions related to your case in our Square Developers board. One of our team experts will be happy to provide more insight into this. 

 

Thank you!

Sayra
Community Moderator, Square // Moderadora de la Comunidad, Square
Sign in and click Mark as Best Answer if my reply answers your question.
Inicie seción y haga clic en Marcar como "Mejor Respuesta" si mi respuesta contesta su pregunta.
1,350 Views
Message 8 of 8
Report