You are viewing limited content. For full access, please sign in.

Question

Question

on-prem API search syntax

asked on September 19, 2024 Show version history

Hello Everyone. I'm trying to do a very simple search with my API server in the swagger playground. I'm totally confused by the error I'm getting. This is what I'm trying to do. 

 

curl -X 'POST' \
  'http://localhost/LFRepositoryAPI/v1/Repositories/devaccountingdev/Searches' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer HIDDEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "searchCommand": "({[Purchase Orders]:[Purchase Order Number] = "12-1299936"})",
  "fuzzyType": "Percentage",
  "fuzzyFactor": 80
}'

I keep getting Error: Bad Request. 

{
  "type": "invalidRequest",
  "title": "After parsing a value an unexpected character was encountered: 1. Path 'searchCommand', line 2, position 67.",
  "status": 400,
  "instance": "/v1/Repositories/devaccountingdev/Searches",
  "operationId": "71f21f8ea89746c0bf21a54fcc9d4be0",
  "errorSource": "Api Server",
  "errorCode": 216,
  "traceId": "00-d3bba560dba98a1087700ee7bca39298-5d9b545de28a3610-00"
}

Any idea what is wrong with my search command? It has a problem with something in it, I don't understand why it doesn't like my search syntax. 

Thanks. 

 

0 0

Answer

SELECTED ANSWER
replied on September 19, 2024

It's a simple fix, you just need to properly escape the double quotes.  Try this...

 

"searchCommand": "({[Purchase Orders]:[Purchase Order Number] = \"12-1299936\"})"

 

Notice how I escaped the double quotes with the \ character.

 

Good luck!

Andrew

1 0
replied on September 19, 2024

That was it, Andrew. I use search syntax with workflow, and web client and haven't needed to escape the double quotes. 
I now see it in the example too. 
Glad it was an easy fix. 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.