# MammothWP Acceptance Logs: REST routes and abilities

Read from admin-terms-acceptance at main.

## REST routes

### GET /wp-json/mmwp/v1/public/version

Permission: Public: no authentication.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/PublicRestController.php#L72

### GET /wp-json/mmwp/v1/public/versions

Permission: Public: no authentication.

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| per_page | integer |  | 20 |  |
| offset | integer |  | 0 |  |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/PublicRestController.php#L82

### GET /wp-json/mmwp/v1/public/versions/(?P<id>\d+)

Permission: Public: no authentication.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/PublicRestController.php#L105

### GET /wp-json/mmwp/v1/terms/version

Show the active terms version

Permission: Capability: edit_posts.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### GET /wp-json/mmwp/v1/terms/versions

List archived terms versions

Permission: Capability: edit_posts.

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| limit | integer |  | 20 | Rows to return. |
| offset | integer |  | 0 | Rows to skip. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### GET /wp-json/mmwp/v1/terms/versions/(?P<id>\d+)

Get one archived terms version

Permission: Capability: edit_posts.

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| id | integer | yes |  | Version ID. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### POST /wp-json/mmwp/v1/terms/version

Publish a new terms version

Permission: Set by the resource default (not overridden on this operation).

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| content | string | yes |  | The terms text. HTML is filtered through wp_kses_post(). |
| version_number | string |  |  | Human version number, e.g. 2.1. Derived if omitted. |
| effective_date | string |  |  | Effective date, Y-m-d. |
| change_summary | string |  |  | Shown to returning users above the terms. |
| only_if_changed | boolean |  | false | Do nothing if the text matches the active version. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### POST /wp-json/mmwp/v1/terms/refresh

Re-read the terms content source

Permission: Set by the resource default (not overridden on this operation).

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### GET /wp-json/mmwp/v1/terms/acceptances

List acceptance log entries

Permission: Callback can_read_log().

| Argument | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| user_id | integer |  | 0 | Only this user. 0 for everyone. |
| version_id | integer |  | 0 | Only this terms version. 0 for all. |
| date_from | string |  |  | First day, Y-m-d (UTC). |
| date_to | string |  |  | Last day, Y-m-d (UTC). |
| limit | integer |  | 50 | Rows to return. |
| offset | integer |  | 0 | Rows to skip. |

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

## Abilities

### mmwp-acceptance-logs/get-active-version

Show the active terms version: Returns the terms version users must currently have accepted.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### mmwp-acceptance-logs/list-versions

List archived terms versions: Lists every archived terms version, newest first.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### mmwp-acceptance-logs/get-version

Get one archived terms version: Returns one archived terms version, including its full text.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### mmwp-acceptance-logs/publish-version

Publish a new terms version: Publishes the text as the active version. Everyone in scope is asked to accept it again.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### mmwp-acceptance-logs/refresh-content

Re-read the terms content source: Re-reads the terms content source now instead of waiting for the daily check, and publishes a new version if it changed.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1

### mmwp-acceptance-logs/list-acceptances

List acceptance log entries: Read-only, redacted export of the acceptance log. Restricted to the plugin managers.

Source: https://github.com/mammothwp/admin-terms-acceptance/blob/36f6f145beb885d95f3852dfb0faf4d902510f75/src/Api/TermsResource.php#L1
