DEV Community reactions API
The reactions API from DEV Community — 4 operation(s) for reactions.
The reactions API from DEV Community — 4 operation(s) for reactions.
openapi: 3.0.3
info:
title: Forem API V1 agent_sessions reactions API
version: 1.0.0
description: "Access Forem articles, users and other resources via API.\n For a real-world example of Forem in action, check out [DEV](https://www.dev.to).\n All endpoints can be accessed with the 'api-key' header and a accept header, but\n some of them are accessible publicly without authentication.\n\n Dates and date times, unless otherwise specified, must be in\n the [RFC 3339](https://tools.ietf.org/html/rfc3339) format."
servers:
- url: https://dev.to/api
description: Production server
security:
- api-key: []
tags:
- name: reactions
paths:
/api/reactions/toggle:
post:
summary: toggle reaction
tags:
- reactions
description: "This endpoint allows the client to toggle the user's reaction to a specified reactable (eg, Article, Comment, or User). For examples:\n * \"Like\"ing an Article will create a new \"like\" Reaction from the user for that Articles\n * \"Like\"ing that Article a second time will remove the \"like\" from the user"
parameters:
- name: category
in: query
required: true
schema:
type: string
enum:
- like
- unicorn
- exploding_head
- raised_hands
- fire
- name: reactable_id
in: query
required: true
schema:
type: integer
format: int32
- name: reactable_type
in: query
required: true
schema:
type: string
enum:
- Comment
- Article
- User
responses:
'200':
description: successful
content:
application/json:
example:
result: create
category: like
id: 161
reactable_id: 2260
reactable_type: Article
'401':
description: unauthorized
content:
application/json:
example:
error: unauthorized
status: 401
/api/reactions:
post:
summary: create reaction
tags:
- reactions
description: "This endpoint allows the client to create a reaction to a specified reactable (eg, Article, Comment, or User). For examples:\n * \"Like\"ing an Article will create a new \"like\" Reaction from the user for that Articles\n * \"Like\"ing that Article a second time will return the previous \"like\""
parameters:
- name: category
in: query
required: true
schema:
type: string
enum:
- like
- unicorn
- exploding_head
- raised_hands
- fire
- name: reactable_id
in: query
required: true
schema:
type: integer
format: int32
- name: reactable_type
in: query
required: true
schema:
type: string
enum:
- Comment
- Article
- User
responses:
'200':
description: successful
content:
application/json:
example:
result: none
category: like
id: 163
reactable_id: 2262
reactable_type: Article
'401':
description: unauthorized
content:
application/json:
example:
error: unauthorized
status: 401
/reactions/toggle:
post:
summary: toggle reaction
tags:
- reactions
description: "This endpoint allows the client to toggle the user's reaction to a specified reactable (eg, Article, Comment, or User). For examples:\n * \"Like\"ing an Article will create a new \"like\" Reaction from the user for that Articles\n * \"Like\"ing that Article a second time will remove the \"like\" from the user"
parameters:
- name: category
in: query
required: true
schema:
type: string
enum:
- like
- unicorn
- exploding_head
- raised_hands
- fire
- name: reactable_id
in: query
required: true
schema:
type: integer
format: int32
- name: reactable_type
in: query
required: true
schema:
type: string
enum:
- Comment
- Article
- User
responses:
'200':
description: successful
content:
application/json:
example:
result: create
category: like
id: 13
reactable_id: 283
reactable_type: Article
'401':
description: unauthorized
content:
application/json:
example:
error: unauthorized
status: 401
/reactions:
post:
summary: create reaction
tags:
- reactions
description: "This endpoint allows the client to create a reaction to a specified reactable (eg, Article, Comment, or User). For examples:\n * \"Like\"ing an Article will create a new \"like\" Reaction from the user for that Articles\n * \"Like\"ing that Article a second time will return the previous \"like\""
parameters:
- name: category
in: query
required: true
schema:
type: string
enum:
- like
- unicorn
- exploding_head
- raised_hands
- fire
- name: reactable_id
in: query
required: true
schema:
type: integer
format: int32
- name: reactable_type
in: query
required: true
schema:
type: string
enum:
- Comment
- Article
- User
responses:
'200':
description: successful
content:
application/json:
example:
result: none
category: like
id: 15
reactable_id: 285
reactable_type: Article
'401':
description: unauthorized
content:
application/json:
example:
error: unauthorized
status: 401
components:
securitySchemes:
api-key:
type: apiKey
name: api-key
in: header
description: "API Key authentication.\n\nAuthentication for some endpoints, like write operations on the\nArticles API require a DEV API key.\n\nAll authenticated endpoints are CORS disabled, the API key is intended for non-browser scripts.\n\n### Getting an API key\n\nTo obtain one, please follow these steps:\n\n - visit https://dev.to/settings/extensions\n - in the \"DEV API Keys\" section create a new key by adding a\n description and clicking on \"Generate API Key\"\n\n \n\n - You'll see the newly generated key in the same view\n "