Add documentation for GET /api/v1/instance/terms_of_service (#1634)

This commit is contained in:
Eugen Rochko 2025-04-16 08:39:58 +02:00 committed by GitHub
parent 764ed11fc5
commit 6addd5cf52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 115 additions and 1 deletions

View file

@ -0,0 +1,62 @@
---
title: TermsOfService
description: Represents the terms of service of the instance.
menu:
docs:
parent: entities
aliases: [
"/entities/termsofservice",
"/entities/TermsOfService",
"/api/entities/termsofservice",
"/api/entities/TermsOfService",
]
---
## Example
```json
{
"effective_date": "2025-04-15",
"effective": true,
"content": "<p>Foo bar newer</p>\n",
"succeeded_by": null
}
```
## Attributes
### `effective_date` {#effective_date}
**Description:** The date these terms of service are coming or have come in effect.\
**Type:** String ([Date](/api/datetime-format#date))\
**Version history:**\
4.4.0 - added
### `effective` {#effective}
**Description:** Whether these terms of service are currently in effect.\
**Type:** Boolean\
**Version history:**\
4.4.0 - added
### `content` {#content}
**Description:** The rendered HTML content of the terms of service.\
**Type:** String (HTML)\
**Version history:**\
4.4.0 - added
### `succeeded_by` {#succeeded_by}
**Description:** If there are newer terms of service, their effective date.\
**Type:** {{<nullable>}} String ([Date](/api/datetime-format#date))\
**Version history:**\
4.4.0 - added
## See also
{{< page-relref ref="methods/instance#terms_of_service" caption="GET /api/v1/instance/terms_of_service" >}}
{{< page-relref ref="methods/instance#terms_of_service_date" caption="GET /api/v1/instance/terms_of_service/:date" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/serializers/rest/terms_of_service_serializer.rb" caption="app/serializers/rest/terms_of_service_serializer.rb" >}}

View file

@ -549,7 +549,7 @@ GET /api/v1/instance/terms_of_service HTTP/1.1
Obtain the contents of this server's terms of service, if configured. Obtain the contents of this server's terms of service, if configured.
**Returns:** [PrivacyPolicy]({{< relref "entities/PrivacyPolicy" >}})\ **Returns:** [TermsOfService]({{< relref "entities/TermsOfService" >}})\
**OAuth:** Public\ **OAuth:** Public\
**Version history:**\ **Version history:**\
4.4.0 - added 4.4.0 - added
@ -558,7 +558,59 @@ Obtain the contents of this server's terms of service, if configured.
##### 200: OK ##### 200: OK
```json
{
"effective_date": "2025-04-15",
"effective": true,
"content": "<p>Foo bar newer</p>\n",
"succeeded_by": null
}
```
##### 404: Not Found
No terms of service have been configured for this instance.
```json
{
"error": "Record not found"
}
```
---
## View a specific version of the terms of service {#terms_of_service_date}
```http
GET /api/v1/instance/terms_of_service/:date HTTP/1.1
```
Obtain the contents of this server's terms of service, for a specified date, if configured.
**Returns:** [TermsOfService]({{< relref "entities/TermsOfService" >}})\
**OAuth:** Public\
**Version history:**\
4.4.0 - added
#### Request
##### Path parameters
:date
: {{<required>}} String. The effective date of the terms of service.
#### Response
##### 200: OK
```json
{
"effective_date": "2025-04-15",
"effective": true,
"content": "<p>Foo bar newer</p>\n",
"succeeded_by": null
}
```
##### 404: Not Found ##### 404: Not Found