# Get collections (getcollections)

### Request

Use the shared HTTP API endpoint and request formats.

See [HTTP API Overview](/v6.12.0/api-reference/overview.md).

#### Parameters

| Parameter    | Type   | Required | Default          | Notes                                                                |
| ------------ | ------ | -------- | ---------------- | -------------------------------------------------------------------- |
| `cmd`        | string | Yes      | `style_guide`    | Command name.                                                        |
| `action`     | string | Yes      | `getcollections` | Action name.                                                         |
| `lang`       | string | No       | `common`         | Language scope to get the collections in (example: `en_US` or `en`). |
| `collection` | string | No       |                  | The name of the collection to be retrieved.                          |

### Behavior

* Retrives a list of collections in the target lang scope.
* Returns the retrieved collections info in `result`.

### Response

Single result object containing retrieved `collection`(s) with it's `category` and `lang` .

See [Response schema](/v6.12.0/api-reference/style-guide-api/response-schema.md).

### Errors

See

* [Errors](/v6.12.0/api-reference/style-guide-api/errors.md#getcollections-errors).
* [Validation & limits](/v6.12.0/api-reference/style-guide-api/validation-and-limits.md)

### Examples

#### 1) Get all the collections

{% tabs %}
{% tab title="Example (JSON body)" %}

<details>

<summary>Request URL (on-premises)</summary>

{% code overflow="wrap" %}

```
http(s)://server_entry_point/?cmd=style_guide&access_key=<your-access-key>&action=getcollections
```

{% endcode %}

</details>

<details>

<summary>Request URL (Cloud)</summary>

{% code overflow="wrap" %}

```
https://svc.webspellchecker.net/api?cmd=style_guide&access_key=<your-access-key>&serviceid=<your-service-id>&action=getcollections
```

{% endcode %}

</details>

<details>

<summary>Request CURL (on-premises)</summary>

{% code overflow="wrap" %}

```bash
curl -G "http(s)://server_entry_point" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'action=getcollections'
```

{% endcode %}

</details>

<details>

<summary>Request CURL (Cloud)</summary>

{% code overflow="wrap" %}

```bash
curl -G "https://svc.webspellchecker.net/api" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'serviceid=<your-service-id>' \
  --data-urlencode 'action=getcollections'
```

{% endcode %}

</details>

***

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json
{
    "message": "Collection(s) retrieved.",
    "result": [
        {
            "language": "",
            "collection": "A common collection",
            "category": "A_COMMON_COLLECTION"
        },
        {
            "language": "",
            "collection": "style guide",
            "category": "STYLE_GUIDE"
        },
        {
            "language": "en_US",
            "collection": "A test-collection",
            "category": "A_TEST-COLLECTION"
        },
        {
            "language": "en_US",
            "collection": "style guide",
            "category": "STYLE_GUIDE"
        }
    ]
}

```

{% endcode %}

</details>
{% endtab %}

{% tab title="Example (XML body)" %}

<details>

<summary>Request URL (on-premises)</summary>

{% code overflow="wrap" %}

```
http(s)://server_entry_point/?cmd=style_guide&access_key=<your-access-key>&action=getcollections&format=xml
```

{% endcode %}

</details>

<details>

<summary>Request URL (Cloud)</summary>

{% code overflow="wrap" %}

```
https://svc.webspellchecker.net/api?cmd=style_guide&access_key=<your-access-key>&serviceid=<your-service-id>&action=getcollections&format=xml
```

{% endcode %}

</details>

<details>

<summary>Request CURL (on-premises)</summary>

{% code overflow="wrap" %}

```bash
curl -G "http(s)://server_entry_point" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'format=xml'
```

{% endcode %}

</details>

<details>

<summary>Request CURL (Cloud)</summary>

{% code overflow="wrap" %}

```bash
curl -G "https://svc.webspellchecker.net/api" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'serviceid=<your-service-id>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'format=xml'
```

{% endcode %}

</details>

***

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```xml
<result>
	<category>
		<language/>
		<collection>A common collection</collection>
		<category>A_COMMON_COLLECTION</category>
	</category>
	<category>
		<language/>
		<collection>style guide</collection>
		<category>STYLE_GUIDE</category>
	</category>
	<category>
		<language>en_US</language>
		<collection>A test-collection</collection>
		<category>A_TEST-COLLECTION</category>
	</category>
	<category>
		<language>en_US</language>
		<collection>style guide</collection>
		<category>STYLE_GUIDE</category>
	</category>
</result>
```

{% endcode %}

</details>
{% endtab %}
{% endtabs %}

#### 2) Get all the collections for a specific language

{% tabs %}
{% tab title="Example (JSON body)" %}

<details>

<summary>Request URL (on-premises)</summary>

{% code overflow="wrap" %}

```
http(s)://server_entry_point/?cmd=style_guide&access_key=<your-access-key>&action=getcollections&lang=en_US
```

{% endcode %}

</details>

<details>

<summary>Request URL (Cloud)</summary>

{% code overflow="wrap" %}

```
https://svc.webspellchecker.net/api?cmd=style_guide&access_key=<your-access-key>&serviceid=<your-service-id>&action=getcollections&lang=en_US
```

{% endcode %}

</details>

<details>

<summary>Request CURL (on-premises)</summary>

{% code overflow="wrap" %}

```bash
curl -G "http(s)://server_entry_point" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'lang=en_US'
```

{% endcode %}

</details>

<details>

<summary>Request CURL (Cloud)</summary>

{% code overflow="wrap" %}

```bash
curl -G "https://svc.webspellchecker.net/api" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'serviceid=<your-service-id>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'lang=en_US'
```

{% endcode %}

</details>

***

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json
{
    "message": "Collection(s) retrieved.",
    "result": [
        {
            "language": "en_US",
            "collection": "A test-collection",
            "category": "A_TEST-COLLECTION"
        },
        {
            "language": "en_US",
            "collection": "style guide",
            "category": "STYLE_GUIDE"
        }
    ]
}
```

{% endcode %}

</details>
{% endtab %}

{% tab title="Example (XML body)" %}

<details>

<summary>Request URL (on-premises)</summary>

{% code overflow="wrap" %}

```
http(s)://server_entry_point/?cmd=style_guide&access_key=<your-access-key>&action=getcollections&lang=en_US&format=xml
```

{% endcode %}

</details>

<details>

<summary>Request URL (Cloud)</summary>

{% code overflow="wrap" %}

```
https://svc.webspellchecker.net/api?cmd=style_guide&access_key=<your-access-key>&serviceid=<your-service-id>&action=getcollections&lang=en_US&format=xml
```

{% endcode %}

</details>

<details>

<summary>Request CURL (on-premises)</summary>

{% code overflow="wrap" %}

```bash
curl -G "http(s)://server_entry_point" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'lang=en_US' \
  --data-urlencode 'format=xml'
```

{% endcode %}

</details>

<details>

<summary>Request CURL (Cloud)</summary>

{% code overflow="wrap" %}

```bash
curl -G "https://svc.webspellchecker.net/api" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'serviceid=<your-service-id>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'lang=en_US' \
  --data-urlencode 'format=xml'
```

{% endcode %}

</details>

***

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```xml
<message>Collection(s) retrieved.</message>

<result>
	<category>
		<language>en_US</language>
		<collection>A test-collection</collection>
		<category>A_TEST-COLLECTION</category>
	</category>
	<category>
		<language>en_US</language>
		<collection>style guide</collection>
		<category>STYLE_GUIDE</category>
	</category>
</result>
```

{% endcode %}

</details>
{% endtab %}
{% endtabs %}

#### 3) Get a specific collection for a specific language

{% tabs %}
{% tab title="Example (JSON body)" %}

<details>

<summary>Request URL (on-premises)</summary>

{% code overflow="wrap" %}

```
http(s)://server_entry_point/?cmd=style_guide&access_key=<your-access-key>&action=getcollections&collection=A test-collection&lang=en_US
```

{% endcode %}

</details>

<details>

<summary>Request URL (Cloud)</summary>

{% code overflow="wrap" %}

```
https://svc.webspellchecker.net/api?cmd=style_guide&access_key=<your-access-key>&serviceid=<your-service-id>&action=getcollections&collection=A test-collection&lang=en_US
```

{% endcode %}

</details>

<details>

<summary>Request CURL (on-premises)</summary>

{% code overflow="wrap" %}

```bash
curl -G "http(s)://server_entry_point" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'collection=A test-collection' \
  --data-urlencode 'lang=en_US'
```

{% endcode %}

</details>

<details>

<summary>Request CURL (Cloud)</summary>

{% code overflow="wrap" %}

```bash
curl -G "https://svc.webspellchecker.net/api" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'serviceid=<your-service-id>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'collection=A test-collection' \
  --data-urlencode 'lang=en_US'
```

{% endcode %}

</details>

***

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json
{
    "message": "Collection(s) retrieved.",
    "result": [
        {
            "language": "en_US",
            "collection": "A test-collection",
            "category": "A_TEST-COLLECTION"
        }
    ]
}
```

{% endcode %}

</details>
{% endtab %}

{% tab title="Example (XML body)" %}

<details>

<summary>Request URL (on-premises)</summary>

{% code overflow="wrap" %}

```
http(s)://server_entry_point/?cmd=style_guide&access_key=<your-access-key>&action=getcollections&collection=A test-collection&lang=en_US&format=xml
```

{% endcode %}

</details>

<details>

<summary>Request URL (Cloud)</summary>

{% code overflow="wrap" %}

```
https://svc.webspellchecker.net/api?cmd=style_guide&access_key=<your-access-key>&serviceid=<your-service-id>&action=getcollections&collection=A test-collection&lang=en_US&format=xml
```

{% endcode %}

</details>

<details>

<summary>Request CURL (on-premises)</summary>

{% code overflow="wrap" %}

```bash
curl -G "http(s)://server_entry_point" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'collection=A test-collection' \
  --data-urlencode 'lang=en_US' \
  --data-urlencode 'format=xml'
```

{% endcode %}

</details>

<details>

<summary>Request CURL (Cloud)</summary>

{% code overflow="wrap" %}

```bash
curl -G "https://svc.webspellchecker.net/api" \
  --data-urlencode 'cmd=style_guide' \
  --data-urlencode 'access_key=<your-access-key>' \
  --data-urlencode 'serviceid=<your-service-id>' \
  --data-urlencode 'action=getcollections' \
  --data-urlencode 'collection=A test-collection' \
  --data-urlencode 'lang=en_US' \
  --data-urlencode 'format=xml'
```

{% endcode %}

</details>

***

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```xml
<message>Collection(s) retrieved.</message>

<result>
	<category>
		<language>en_US</language>
		<collection>A test-collection</collection>
		<category>A_TEST-COLLECTION</category>
	</category>
</result>
```

{% endcode %}

</details>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wproofreader.com/v6.12.0/api-reference/style-guide-api/actions/get-collections-getcollections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
