Customer Search - End Point - REST API CALL

I’m trying to use an endpoint REST API Call to customer to get customer profile by referenceId.

I’m using this post

curl \
  -X POST \
  -H 'Square-Version: 2023-03-15' \
  -H 'Authorization: Bearer ****************\
  -H 'Content-Type: application/json' \
  -d '{
    "query": {
      "filter": {
        "reference_id": {
          "exact": "******"

Which returns the correct customer profile as needed on PostMan and on the API Explorer …
but when I call the API from my application using

plsql_rest_sender_API.Call_Rest_EndPoint_Json_Sync(rest_service_        => ,
                                                   json_                => ,
                                                   url_params_          => ,
                                                   callback_func_       => ,
                                                   http_method_         => ,
                                                   http_req_headers_    => ,
                                                   query_parameters_    => ,
                                                   header_params_       => ,
                                                   incld_resp_info_     => ,
                                                   fnd_user_            => ,
                                                   key_ref_             => ,
                                                   sender_              => ,
                                                   receiver_            => ,
                                                   message_type_        => ,
                                                   subject_             => ,
                                                   in_order_            => ,
                                                   fail_notify_         => ,
                                                   failed_callback_fun_ => ,
                                                   accepted_res_codes_  => ,
                                                   auth_params_         => )

IT either gives error if passed the query in the query_parameters_ or returns the 1st customer always if passed it in the url_params_

Any advice?

please, I do really appreciate if someone used this apis in Oracle PL/SQL packages to give any examples.

Thank you

What is the error message your getting? :slightly_smiling_face:

@Bryan-Square Thanks for your prompt reply and your concerns

The final error is “Syntax Error” when trying to parse the returning CLOB into a jason variable.

extracted the returning CLOB to get the response was :
json_clob_ =

Error 400 Bad Request

HTTP ERROR 400 Bad Request

URI: /v2/customers/search
MESSAGE: Bad Request
SERVLET: org.eclipse.jetty.servlet.DefaultServlet-633a0b65

So, I tried to get more details of the sent request by plsql_rest_sender_API.Call_Rest_EndPoint_Json_Sync

and I got to something wrong with the Query Parameter :




<HTTP_REQ_HEADERS>Authorization: Bearer **********</HTTP_REQ_HEADERS>

<QUERY_PARAMS><qry_params_><QueryParameters>{&quot;query&quot;:{&quot;filter&quot;:{&quot;reference_id&quot;:{&quot;exact&quot;: &quot;************&quot;}}}}</QueryParameters></qry_params_></QUERY_PARAMS>





the ****** for confid. data.

Is the request reaching Square? If so are there any logs in the API Logs with more details? It would look something like:

  "errors": [
      "category": "INVALID_REQUEST_ERROR",
      "code": "BAD_REQUEST",
      "detail": "Expected \":\" (line 5, character 16)"


The request is def. reaching to Square … as the returning CLOB object is not null
and it contains the 400 Error as show from the streaming the CLOB object
But no API Log Generated for this request. And yes if I remove the Query Parameter it logs.

Uploading: 2023-04-08_1-52-17.png…
Uploading: 2023-04-08_1-55-21.png…

I found the reason it was giving the error.

In this PL/SQL function call the query needs to be passed in the in/out CLOB parameter json_ not into the query_parameters_ one which is wired but it worked well for now.

If I got any new findings about using Square API calls in PL/SQL then will keep this post updated as it seems it is the only post related to the subject.

Thank you

Glad to hear you were able to figure it out. :slightly_smiling_face: