DataFlex / Salesforce Platform APIs / Search for Records Suggested by Autocomplete and Instant Results
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vQueryParams
Handle hoQueryParams
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "q" "" To iSuccess
Get ComUpdateString Of hoQueryParams "sobject" "" To iSuccess
// Adds the "Authorization: Bearer <access_token>" header.
Set ComAuthToken Of hoHttp To "<access_token>"
Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoQueryParams to vQueryParams
Get pvComObject of hoResp to vResp
Get ComHttpParams Of hoHttp "GET" "https://domain.com/services/data/v{{version}}/search/suggestions" vQueryParams vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln iTemp1
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
End_Procedure
Curl Command
curl -G -d "q="
-d "sobject="
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
https://domain.com/services/data/v{{version}}/search/suggestions
Postman Collection Item JSON
{
"name": "Search for Records Suggested by Autocomplete and Instant Results",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/search/suggestions?q&sobject",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"search",
"suggestions"
],
"query": [
{
"key": "type",
"value": "",
"description": "Required when the sobject value is feedItem. Including this parameter for all other sobject values doesn’t affect the query. Specifies that the type of Feed is questions. Valid value: question.",
"disabled": true
},
{
"key": "fields",
"value": "",
"description": "Optional. Used for creating lookup queries. Specify multiple fields using a comma-separated list. Specifies which lookup fields to be returned in the response.",
"disabled": true
},
{
"key": "dynamicFields",
"value": "",
"description": "Optional. Available in API version 48.0 and later. Used to return additional dynamic fields. Specify multiple options using a comma-separated list. For example, if dynamicFields=secondaryField then each suggested record in the results contains an additional field besides Id and Name (or Title) based on the next eligible field in the search layout.",
"disabled": true
},
{
"key": "groupId",
"value": "",
"description": "Optional. Specifies one or more unique identifiers of one or more groups that the question to return was posted to. Specify multiple groups using a comma-separated list. This parameter is only applicable when the parameter type equals question. Don’t use with the userId.",
"disabled": true
},
{
"key": "ignoreUnsupportedSObjects",
"value": "",
"description": "Optional. Specifies what to do if unsupported objects are included in the request. If false and an unsupported object is included, an error is returned. If true and an unsupported object is included, the object is ignored and no error is returned. See the Unsupported Objects section for reference. The default is false.",
"disabled": true
},
{
"key": "limit",
"value": "",
"description": "Optional. Specifies the maximum number of suggested records to return. If a limit isn’t specified, 5 records are returned by default. If there are more suggested records than the limit specified, the response body’s hasMoreResults property is true.",
"disabled": true
},
{
"key": "networkId",
"value": "",
"description": "Optional. Specifies one or more unique identifiers for the community(ies) that the question to return is associated to. Specify multiple communities using a comma-separated list. This parameter is only applicable when the parameter type equals question or parameter sobject equals user.",
"disabled": true
},
{
"key": "topicId",
"value": "",
"description": "Optional. Specifies the unique identifier of the single topic that the question to return was tagged as. This parameter is only applicable when the parameter type equals question.",
"disabled": true
},
{
"key": "userId",
"value": "",
"description": "Optional. Specifies one or more unique identifiers of one or more users who authored the question to return. Specify multiple users using a comma-separated list. This parameter is only applicable when the parameter type equals question. Don’t use with the groupId.",
"disabled": true
},
{
"key": "useSearchScope",
"value": "",
"description": "Optional. Available in API version 40.0 and later. The default value is false. If false, the objects specified in the request are used to suggest records. If true, in addition to the objects specified in the request, the user's search scope is used to suggest records. The search scope is the list of objects a user uses most frequently.\nIf the request doesn’t specify an object, use useSearchScope=true.\nIf useSearchScope=true and the user's search scope is empty, the default search scope is used to suggest records.\nOnly the first 10 objects are used to suggest records.\nObjects specified in the sobject parameter are prioritized over objects in the user's search scope.\nValues for the ignoreUnsupportedSObjects parameter aren’t applied to the objects in the search scope.",
"disabled": true
},
{
"key": "where",
"value": "",
"description": "Optional. A filter that follows the same syntax as the SOQL WHERE clause. URLs encode the expression.\nUse the clause for an object, or globally for all compatible objects. An example of an object-specific clause is: account.where=name%20LIKE%20%27Smith%25%27. An example of a global clause is: where=name%20LIKE%20%27Smith%25%27. The parameter must be lower case. Any object-specific where clauses override the global where clause. You can’t use this parameter for the Question object.",
"disabled": true
},
{
"key": "q",
"value": null
},
{
"key": "sobject",
"value": null
}
]
},
"description": "Returns a list of suggested records whose names match the user’s search string. The suggestions resource provides autocomplete results and instant results for users to navigate directly to likely relevant records, before performing a full search.\n\nhttps://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_suggest_records.htm"
},
"response": [
]
}