---
schema_version: "1"
id: b2799d0927710ad5001eadee605ea6d10dd1e07a6494c31e9c3694774022b19c
title: Search for a String
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/api-rest/guides/do-me/dome-search.md
canonical_url: https://developer.salesforce.com/docs/platform/api-rest/guide/dome-search.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7e671c3f039ed3b2f8e09d567084b08033053856a407520b221bade3819a7aae
products:
  - REST API Developer Guide
  - Platform Developer Content
---

# Search for a String

Use the Search resource to execute a SOSL search or use the Parameterized Search resource to execute a simple RESTful search without SOSL.

## Example SOSL Search Using the GET Method

The following example executes a SOSL search for `Acme`. The search string in this example must be URL-encoded.

**Example usage**

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/search/?q=FIND+%7BAcme%7D -H "Authorization: Bearer token"
```

**Example request body:** None required

**Example response body**

```nolang
{
  "searchRecords" : [ {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001D000000IqhSLIAZ"
    },
    "Id" : "001D000000IqhSLIAZ",
  }, {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001D000000IomazIAB"
    },
    "Id" : "001D000000IomazIAB",
  } ]
}
```

## Example Parameterized Search Using the GET Method

The following example executes a parameterized search for `Acme`. The search string in this example must be URL-encoded.

**Example usages**

**Global search for all results containing *Acme*** **Account search for results containing *Acme*, returning the id and name fields**

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/parameterizedSearch/?q=Acme -H "Authorization: Bearer token"
```

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/parameterizedSearch/?q=Acme&sobject=Account&Account.fields=id,name&Account.limit=10 -H "Authorization: Bearer token"
```

**Example request body:** None required

**Example response body**

```nolang
{
  "searchRecords" : [ {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001D000000IqhSLIAZ"
    },
    "Id" : "001D000000IqhSLIAZ"
  }, {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001D000000IomazIAB"
    },
    "Id" : "001D000000IomazIAB"
  } ]
}
```

**Example response body with `metadata` parameter**

**note:** The `metadata` parameter is only returned if the request specified `metadata=LABELS`.

```nolang
{
  "searchRecords" : [ {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001D000000IqhSLIAZ"
    },
    "Id" : "001D000000IqhSLIAZ",
  }, {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001D000000IomazIAB"
    },
    "Id" : "001D000000IomazIAB",
  } ],
  "metadata" : {
    "entityetadata" : [ {
      "entityName" : "Account",
      "fieldMetadata" : [ {

        "name" : "Name",
        "label" : "Account Name"
       } ]
    } ]
  }
}
```

## Example Parameterized Search Using the POST Method

Execute a parameterized search using the POST method to access all search features available.

**Example usage**

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/parameterizedSearch "Authorization: Bearer token" -H "Content-Type: application/json” -d "@search.json”
```

**Example request body:** None required

**Example JSON file**

```nolang

{
    "q":"Smith",
    "fields" : ["id", "firstName", "lastName"],
    "sobjects":[{"fields":["id", "NumberOfEmployees"],
	          "name": "Account", 
	          "limit":20},
	         {"name": "Contact"}],
    "in":"ALL",
    "overallLimit":100,
    "defaultLimit":10
}
```

**Example response body**

```nolang
{
  "searchRecords" : [ {
    "attributes" : {
      "type" : "Contact",
      "url" : "/services/data/v68.0/sobjects/Contact/003xx000004TraiAAC"
    },
    "Id" : "003xx000004TraiAAC",
    "FirstName" : "Smith",
    "LastName" : "Johnson"
  }, {
    "attributes" : {
      "type" : "Account",
      "url" : "/services/data/v68.0/sobjects/Account/001xx000003DHXnAAO"
    },
    "Id" : "001xx000003DHXnAAO",
    "NumberOfEmployees" : 100
  } ]
}
```

**See Also**  


-   [Search](https://developer.salesforce.com/docs/platform/api-rest/resources/resources-search.md)
-   [Parameterized Search](https://developer.salesforce.com/docs/platform/api-rest/resources/resources-search-parameterized.md)

