Intermittent problem with bulk-upsert endpoint

I spent the last 3 hours trying to set custom names and values with customer definitions and attributes.

I got the definitions part working (setting them, deleting them, etc) but now when I try to programmatically add a set of values (one unique value per key), I’m receiving unusual errors.

So I narrowed the problem down to the endpoint itself.

So I did a raw curl request with no special headers other than -X POST to this URL:

https://connect.squareupsandbox.com/v2/customers/custom-attributes/bulk-upsert

I expect some sort of unauthorized response as a return, but most times when I execute that endpoint, I receive error 404 with this response:

 "errors": [
    {
      "category": "INVALID_REQUEST_ERROR",
      "code": "NOT_FOUND",
      "detail": "Resource not found."
    }
  ]

Is there something curently wrong with that endpoint?

P.S: as I’m typing this, I saw a “drafts offline” with a warning symbol. Makes me thing something is currently going on with square.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Custom Attributes for Customers
Use Custom Attributes for Orders
https://developer.squareup.com/docs/build-basics/using-rest-api

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To The AI bot that answered: That did not help. I’m receiving abnormal responses even without providing my key. If I can’t get an unauthorized response then there’s something else going on.

What’s your application ID and the request body your passing in? :slightly_smiling_face:

For the test to see if I get an unauthorized message instead of the invalid request error, I just executed the following from a command-line:

curl https://connect.squareupsandbox.com/v2/customers/custom-attributes/bulk-upsert -X POST

I passed in no other HTTP parameters. No application ID, nothing.

That’s not a valid request because there isn’t an access token configured. A valid request looks like:

curl https://connect.squareupsandbox.com/v2/customers/custom-attributes/bulk-upsert \
  -X POST \
  -H 'Square-Version: 2024-07-17' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{ 
REQUEST_BODY
}

:slightly_smiling_face:

Apparently I’m too “new” to put two images in one post showing my results from trying to execute the end point so I 'll have to do 2 separate posts.

(attachments)

thers the other one. Same request, different responses.

Thanks.
Mike.

(attachments)

What’s your application ID? :slightly_smiling_face:

These are the ID’s I use for sandbox mode

For the web SDK Application ID: sandbox-sq0idb-SMAihd3-mYYoPABJNDQU8Q

This particular endpoint does work but the bulk-upsert still has issues:

curl https://connect.squareupsandbox.com/v2/customers/customer_id/custom-attributes/key

The only thing is if I need to store 20 entries per customer after they complete their order, then Id have to make a ton of calls to your server per customer.

1 call to retrieve customer data,
1 call for tokenization,
1 call for verify buyer,
1 call for each entry = 20 calls (19 would be avoided if bulk-upsert would work)
1 call for process payment
= 24 calls total.

I could use this endpoint as a temporary solution, but what would be the limit on requests in a production environment before receiving a HTTP 429 error?

Please never ever share your access token. Those are extremely secret even if they’re sandbox tokens. :slightly_smiling_face:

The unique values that your passing in are they the values that you want on the customer profile? :slightly_smiling_face:

yes
The values apply to the customer.

Had the “note” property for the customer record accepted a large string array instead of a string, I would just populate all my data in that but I think the note property now is limited to 512 characters. had the string limit be something like 20,000 characters or more, I would use that to store all customer data and not have to deal with the customer definitions and attributes endpoints plus I could then do everything in one call instead of 20+ calls.