# 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](/docs/platform/api-rest/guide/resources-search.md)
- [Parameterized Search](/docs/platform/api-rest/guide/resources-search-parameterized.md)
