dev.to
Module dev.to
API
Definitions
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_dev.to_1.5.0.png)
ballerinax/dev.to Ballerina library
Overview
This is a generated connector for DEV API v0.9.7 OpenAPI specification.
This API provides a access to forem articles, users and other resources. For a real-world example of Forem in action, check out DEV. All endpoints that don't require authentication are CORS enabled.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create DEV.to Account
- Obtaining tokens by following this link and in the "DEV API Keys" section create a new key by adding a description and clicking on "Generate API Key".
Clients![](/images/permalink.svg)
dev.to: Client![](/images/permalink.svg)
This is a generated connector for DEV API v0.9.7 OpenAPI specification. Access Forem articles, users and other resources via API. For a real-world example of Forem in action, check out DEV. All endpoints that don't require authentication are CORS enabled. Dates and date times, unless otherwise specified, must be inthe RFC 3339 format.
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create an DEVto Account and obtain tokens by log into DEV Account.
init (ApiKeysConfig apiKeyConfig, ConnectionConfig config, string serviceUrl)
- apiKeyConfig ApiKeysConfig - API keys for authorization
- config ConnectionConfig {} - The configurations to be used when initializing the
connector
- serviceUrl string "https://dev.to/api" - URL of the target service
getArticles![](/images/permalink.svg)
function getArticles(int page, int perPage, string? tag, string? tags, string? tagsExclude, string? username, string? state, int? top, int? collectionId) returns ArticleIndex[]|error
Published articles
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
- tag string? (default ()) - Using this parameter will retrieve articles that contain the requested tag. Articles will be ordered by descending popularity. This parameter can be used in conjuction with
top
.
- tags string? (default ()) - Using this parameter will retrieve articles with any of the comma-separated tags. Articles will be ordered by descending popularity.
- tagsExclude string? (default ()) - Using this parameter will retrieve articles that do not contain any of comma-separated tags. Articles will be ordered by descending popularity.
- username string? (default ()) - Using this parameter will retrieve articles belonging to a User or Organization ordered by descending publication date. If
state=all
the number of items returned will be1000
instead of the default30
. This parameter can be used in conjuction withstate
.
- state string? (default ()) - Using this parameter will allow the client to check which articles are fresh or rising. If
state=fresh
the server will return fresh articles. Ifstate=rising
the server will return rising articles. This param can be used in conjuction withusername
, only if set toall
.
- top int? (default ()) - Using this parameter will allow the client to return the most popular articles in the last
N
days.top
indicates the number of days since publication of the articles returned. This param can be used in conjuction withtag
.
- collectionId int? (default ()) - Adding this will allow the client to return the list of articles belonging to the requested collection, ordered by ascending publication date.
Return Type
- ArticleIndex[]|error - A list of articles
createArticle![](/images/permalink.svg)
function createArticle(ArticleCreate payload) returns ArticleShow|error
Create a new article
Parameters
- payload ArticleCreate - Article to create
Return Type
- ArticleShow|error - A newly created article
getLatestArticles![](/images/permalink.svg)
function getLatestArticles(int page, int perPage) returns ArticleIndex[]|error
Published articles sorted by publish date
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
Return Type
- ArticleIndex[]|error - A list of articles sorted by descending publish date
getUserArticles![](/images/permalink.svg)
User's articles
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
getUserAllArticles![](/images/permalink.svg)
User's all articles
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
getUserPublishedArticles![](/images/permalink.svg)
User's published articles
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
getUserUnpublishedArticles![](/images/permalink.svg)
User's unpublished articles
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
getArticleById![](/images/permalink.svg)
function getArticleById(int id) returns ArticleShow|error
A published article by ID
Parameters
- id int - Id of the article
Return Type
- ArticleShow|error - An article
updateArticle![](/images/permalink.svg)
function updateArticle(int id, ArticleUpdate payload) returns ArticleShow|error
Update an article
Return Type
- ArticleShow|error - The updated article
getArticleByPath![](/images/permalink.svg)
function getArticleByPath(string username, string slug) returns ArticleShow|error
A published article by path
Return Type
- ArticleShow|error - An article
getCommentsByArticleId![](/images/permalink.svg)
Comments
Parameters
- aId int? (default ()) - Article identifier.
- pId int? (default ()) - Podcast Episode identifier.
getCommentById![](/images/permalink.svg)
Comment
Parameters
- id string - Comment identifier.
getFollowers![](/images/permalink.svg)
Followers
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 80) - Page size (the number of items to return per page).
- sort string (default "created_at") - Specifies the sort order for the
created_at
param of the follow relationship. To sort by newest followers first (descending order) specify?sort=-created_at
.
getFollowedTags![](/images/permalink.svg)
function getFollowedTags() returns FollowedTag[]|error
Followed tags
Return Type
- FollowedTag[]|error - A list of followed tags
getListings![](/images/permalink.svg)
Published listings
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
- category string? (default ()) - Using this parameter will return listings belonging to the requested category.
createListing![](/images/permalink.svg)
function createListing(ListingCreate payload) returns Listing|error
Create a new listing
Parameters
- payload ListingCreate - Listing to create
getListingsByCategory![](/images/permalink.svg)
function getListingsByCategory(ListingCategory category, int page, int perPage) returns Listing[]|error
Published listings by category
Parameters
- category ListingCategory - The category of the listing
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
getListingById![](/images/permalink.svg)
A listing
Parameters
- id int - Id of the listing
updateListing![](/images/permalink.svg)
function updateListing(int id, ListingUpdate payload) returns ArticleShow|error
Update a listing
Return Type
- ArticleShow|error - The updated article
getOrganization![](/images/permalink.svg)
function getOrganization(string username) returns Organization|error
An organization
Parameters
- username string - Username of the organization
Return Type
- Organization|error - An organization
getOrgArticles![](/images/permalink.svg)
function getOrgArticles(string username, int page, int perPage) returns ArticleIndex[]|error
Organization's Articles
Parameters
- username string - Username of the organization
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
Return Type
- ArticleIndex[]|error - A list of users belonging to the organization
getOrgListings![](/images/permalink.svg)
function getOrgListings(string username, int page, int perPage, string? category) returns json[]|error
Organization's listings
Parameters
- username string - Username of the organization
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
- category string? (default ()) - Using this parameter will return listings belonging to the requested category.
Return Type
- json[]|error - A list of listings belonging to the organization
getOrgUsers![](/images/permalink.svg)
Organization's users
Parameters
- username string - Username of the organization
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
getPodcastEpisodes![](/images/permalink.svg)
function getPodcastEpisodes(int page, int perPage, string? username) returns PodcastEpisode[]|error
Published podcast episodes
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
- username string? (default ()) - Using this parameter will retrieve episodes belonging to a specific podcast.
Return Type
- PodcastEpisode[]|error - A list of podcast episodes
getProfileImage![](/images/permalink.svg)
function getProfileImage(string username) returns ProfileImage|error
User or organization profile picture
Parameters
- username string - Username of the user or organization
Return Type
- ProfileImage|error - The profile image
getReadinglist![](/images/permalink.svg)
function getReadinglist(int page, int perPage) returns ReadingList[]|error
User's reading list
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 30) - Page size (the number of items to return per page).
Return Type
- ReadingList[]|error - The reading list with a overwiew of the article
getTags![](/images/permalink.svg)
Tags
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 10) - Page size (the number of items to return per page).
getUserMe![](/images/permalink.svg)
The authenticated user
getUser![](/images/permalink.svg)
A user
Parameters
- id string - Id of the user. It can be either of the following two values: - an integer representing the id of the user - the string
by_username
(needs to be used in conjuction with the paramurl
)
- url string? (default ()) - Username of the user
getArticlesWithVideo![](/images/permalink.svg)
function getArticlesWithVideo(int page, int perPage) returns ArticleVideo[]|error
Articles with a video
Parameters
- page int (default 1) - Pagination page.
- perPage int (default 24) - Page size (the number of items to return per page).
Return Type
- ArticleVideo[]|error - A list of video articles
getWebhooks![](/images/permalink.svg)
function getWebhooks() returns WebhookIndex[]|error
Webhooks
Return Type
- WebhookIndex[]|error - A list of webhooks
createWebhook![](/images/permalink.svg)
function createWebhook(WebhookCreate payload) returns WebhookShow|error
Create a new webhook
Parameters
- payload WebhookCreate - Webhook to create
Return Type
- WebhookShow|error - A newly created webhook
getWebhookById![](/images/permalink.svg)
function getWebhookById(int id) returns WebhookShow|error
A webhook endpoint
Parameters
- id int - Id of the webhook
Return Type
- WebhookShow|error - A webhook endpoint
deleteWebhook![](/images/permalink.svg)
A webhook endpoint
Parameters
- id int - Id of the webhook
Records![](/images/permalink.svg)
dev.to: APIError![](/images/permalink.svg)
Fields
- 'error string -
- status int -
dev.to: ApiKeysConfig![](/images/permalink.svg)
Provides API key configurations needed when communicating with a remote HTTP endpoint.
Fields
- apiKey string - All requests on this API needs to include an API key. The API key can be provided as part of the query string or as a request header. The name of the API key needs to be
api-key
Authentication for some endpoints, like write operations on the Articles API require a DEV API key.Getting an API key
To obtain one, please follow these steps:- visit https://dev.to/settings/account
- in the "DEV API Keys" section create a new key by adding a description and clicking on "Generate API Key"
- You'll see the newly generated key in the same view
dev.to: ArticleCreate![](/images/permalink.svg)
Fields
- article ArticlecreateArticle? -
dev.to: ArticlecreateArticle![](/images/permalink.svg)
Fields
- body_markdown string? - The body of the article.
It can contain an optional front matter. For example
--- title: Hello, World! published: true tags: discuss, help date: 20190701T10:00Z series: Hello series canonical_url: https://example.com/blog/hello cover_image: article_published_cover_image ---
date
,series
andcanonical_url
are optional.date
is the publication date-timeseries
is the name of the series the article belongs tocanonical_url
is the canonical URL of the articlecover_image
is the main image of the article If the markdown contains a front matter, it will take precedence on the equivalent params given in the payload.
- canonical_url string? -
- description string? -
- main_image string? -
- organization_id int? - Only users belonging to an organization can assign the article to it
- published boolean? - True to create a published article, false otherwise. Defaults to false
- series string? - Article series name. All articles belonging to the same series need to have the same name in this parameter.
- tags string[]? -
- title string? -
dev.to: ArticleFlareTag![](/images/permalink.svg)
Flare tag of the article
Fields
- bg_color_hex string? - Background color (hexadecimal)
- name string? -
- text_color_hex string? - Text color (hexadecimal)
dev.to: ArticleIndex![](/images/permalink.svg)
Fields
- canonical_url string -
- comments_count int -
- cover_image string -
- created_at string -
- crossposted_at string -
- description string -
- edited_at string -
- flare_tag ArticleFlareTag? - Flare tag of the article
- id int -
- last_comment_at string -
- organization SharedOrganization? - The organization the resource belongs to
- path string -
- positive_reactions_count int -
- public_reactions_count int -
- published_at string -
- published_timestamp string - Crossposting or published date time
- readable_publish_date string -
- reading_time_minutes int - Reading time, in minutes
- slug string -
- social_image string -
- tag_list string[] -
- tags string -
- title string -
- type_of string -
- url string -
- user SharedUser - The resource creator
dev.to: ArticleMe![](/images/permalink.svg)
Fields
- body_markdown string - The body of the article in Markdown format
- canonical_url string -
- comments_count int -
- cover_image string -
- description string -
- flare_tag ArticleFlareTag? - Flare tag of the article
- id int -
- organization SharedOrganization? - The organization the resource belongs to
- page_views_count int -
- path string -
- positive_reactions_count int -
- public_reactions_count int -
- published boolean -
- published_at string -
- published_timestamp string - Crossposting or published date time
- reading_time_minutes int - Reading time, in minutes
- slug string -
- tag_list string[] -
- title string -
- type_of string -
- url string -
- user SharedUser - The resource creator
dev.to: ArticleShow![](/images/permalink.svg)
Fields
- body_html string -
- body_markdown string -
- canonical_url string -
- comments_count int -
- cover_image string -
- created_at string -
- crossposted_at string -
- description string -
- edited_at string -
- flare_tag ArticleFlareTag? - Flare tag of the article
- id int -
- last_comment_at string -
- organization SharedOrganization? - The organization the resource belongs to
- path string -
- positive_reactions_count int -
- public_reactions_count int -
- published_at string -
- published_timestamp string - Crossposting or published date time
- readable_publish_date string -
- reading_time_minutes int - Reading time, in minutes
- slug string -
- social_image string -
- tag_list string -
- tags string[] -
- title string -
- type_of string -
- url string -
- user SharedUser - The resource creator
dev.to: ArticleUpdate![](/images/permalink.svg)
Fields
- article ArticleupdateArticle? -
dev.to: ArticleupdateArticle![](/images/permalink.svg)
Fields
- body_markdown string? - The body of the article.
It can contain an optional front matter. For example
--- title: Hello, World! published: true tags: discuss, help date: 20190701T10:00Z series: Hello series canonical_url: https://example.com/blog/hello cover_image: article_published_cover_image ---
date
,series
andcanonical_url
are optional.date
is the publication date-timeseries
is the name of the series the article belongs tocanonical_url
is the canonical URL of the articlecover_image
is the main image of the article If the markdown contains a front matter, it will take precedence on the equivalent params given in the payload.
- canonical_url string? -
- description string? -
- main_image string? -
- organization_id int? - Only users belonging to an organization can assign the article to it
- published boolean? - True to create a published article, false otherwise. Defaults to false
- series string? - Article series name.
All articles belonging to the same series need to have the same name
in this parameter.
To remove an article from a series, the
null
value can be used.
- tags string[]? -
- title string? -
dev.to: ArticleVideo![](/images/permalink.svg)
Fields
- cloudinary_video_url string - The preview image of the video
- id int -
- path string -
- title string -
- type_of string -
- user ArticlevideoUser -
- user_id int -
- video_duration_in_minutes string - The duration of the video.
If the video duration is below 1 hour, the format will be
mm:ss
, if it's 1 hour or above the format will beh:mm:ss
.
- video_source_url string -
dev.to: ArticlevideoUser![](/images/permalink.svg)
Fields
- name string? - The user's name
dev.to: ClientHttp1Settings![](/images/permalink.svg)
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
dev.to: Comment![](/images/permalink.svg)
Fields
- body_html string - HTML formatted comment
- children Comment[] -
- created_at string -
- id_code string -
- type_of string -
- user SharedUser - The resource creator
dev.to: ConnectionConfig![](/images/permalink.svg)
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
dev.to: FollowedTag![](/images/permalink.svg)
Fields
- id int - Tag id
- name string -
- points float -
dev.to: Follower![](/images/permalink.svg)
Fields
- created_at string - Date the user became a follower
- id int - Follow id
- name string -
- path string -
- profile_image string - Profile image (60x60)
- type_of string -
- username string -
dev.to: Listing![](/images/permalink.svg)
Fields
- body_markdown string -
- category ListingCategory -
- id int -
- organization SharedOrganization? - The organization the resource belongs to
- processed_html string -
- published boolean -
- slug string -
- tag_list string -
- tags string[] -
- title string -
- type_of string -
- user SharedUser - The resource creator
dev.to: ListingCreate![](/images/permalink.svg)
Fields
- listing ListingcreateListing? -
dev.to: ListingcreateListing![](/images/permalink.svg)
Fields
- action string? - Set it to "draft" to create an unpublished listing
- body_markdown string - The body of the listing in Markdown format.
- category ListingCategory -
- contact_via_connect boolean? - True if users are allowed to contact the listing's owner via DEV connect, false otherwise. Defaults to false.
- expires_at string? - Date and time of expiration.
- location string? - Geographical area or city for the listing.
- organization_id int? - The id of the organization the user is creating the listing for. Only users belonging to an organization can assign the listing to it.
- tag_list string? - Comma separated list of tags. A maximum of 8 tags are allowed.
- tags string[]? - Tags related to the listing.
A maximum of 8 tags are allowed and it takes precedence over
tag_list
.
- title string -
dev.to: ListingUpdate![](/images/permalink.svg)
Fields
- listing ListingupdateListing? -
dev.to: ListingupdateListing![](/images/permalink.svg)
Fields
- action string? - This param can be provided by itself to invoke some actions:
bump
bumps the listing and charge either the organization or the userpublish
publishes a draft listingunpublish
unpublishes a published listing
- body_markdown string? - The body of the listing in Markdown format.
- category ListingCategory? -
- contact_via_connect boolean? - True if users are allowed to contact the listing's owner via DEV connect, false otherwise. Defaults to false.
- expires_at string? - Date and time of expiration.
- location string? - Geographical area or city for the listing.
- tag_list string? - Comma separated list of tags. A maximum of 8 tags are allowed.
- tags string[]? - Tags related to the listing.
A maximum of 8 tags are allowed and it takes precedence over
tag_list
.
- title string? -
dev.to: Organization![](/images/permalink.svg)
Organization
Fields
- github_username string? -
- joined_at string? - Date of joining
- location string? -
- name string? -
- profile_image string? - Profile image (640x640)
- story string? -
- summary string? -
- tag_line string? -
- tech_stack string? -
- twitter_username string? -
- type_of string? -
- url string? -
- username string? -
dev.to: PodcastEpisode![](/images/permalink.svg)
Fields
- id int -
- image_url string -
- path string -
- podcast PodcastepisodePodcast -
- title string -
- type_of string -
dev.to: PodcastepisodePodcast![](/images/permalink.svg)
Fields
- image_url string? -
- slug string? -
- title string? -
dev.to: ProfileImage![](/images/permalink.svg)
Profile image
Fields
- image_of string? - Discriminates what is the type of the profile image owner (user or organization)
- profile_image string? - Profile image (640x640)
- profile_image_90 string? - Profile image (90x90)
- type_of string? -
dev.to: ProxyConfig![](/images/permalink.svg)
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
dev.to: ReadingList![](/images/permalink.svg)
Fields
- article ArticleIndex -
- created_at string -
- id int - Follow id
- status string -
- type_of string -
dev.to: SharedOrganization![](/images/permalink.svg)
The organization the resource belongs to
Fields
- name string? -
- profile_image string? - Profile image (640x640)
- profile_image_90 string? - Profile image (90x90)
- slug string? -
- username string? -
dev.to: SharedUser![](/images/permalink.svg)
The resource creator
Fields
- github_username string? -
- name string? -
- profile_image string? - Profile image (640x640)
- profile_image_90 string? - Profile image (90x90)
- twitter_username string? -
- username string? -
- website_url string? -
dev.to: Tag![](/images/permalink.svg)
Fields
- bg_color_hex string - Background color (hexadecimal)
- id int -
- name string -
- text_color_hex string - Text color (hexadecimal)
dev.to: User![](/images/permalink.svg)
Fields
- github_username string -
- id int -
- joined_at string - Date of joining (formatted with strftime
"%b %e, %Y"
)
- location string -
- name string -
- profile_image string - Profile image (320x320)
- summary string -
- twitter_username string -
- type_of string -
- username string -
- website_url string -
dev.to: WebhookCreate![](/images/permalink.svg)
Webhook creation payload
Fields
- webhook_endpoint WebhookcreateWebhookEndpoint? -
dev.to: WebhookcreateWebhookEndpoint![](/images/permalink.svg)
Fields
- events string[] - An array of events identifiers
- 'source string - The name of the requester, eg. "DEV"
- target_url string -
dev.to: WebhookIndex![](/images/permalink.svg)
Webhook
Fields
- created_at string? -
- events string[]? - An array of events identifiers
- id int? -
- 'source string? - The name of the requester, eg. "DEV"
- target_url string? -
- type_of string? -
dev.to: WebhookShow![](/images/permalink.svg)
Webhook
Fields
- created_at string? -
- events string[]? - An array of events identifiers
- id int? -
- 'source string? - The name of the requester, eg. "DEV"
- target_url string? -
- type_of string? -
- user SharedUser? - The resource creator
String types![](/images/permalink.svg)
dev.to: ListingCategory![](/images/permalink.svg)
ListingCategory
Import
import ballerinax/dev.to;
Metadata
Released date: over 1 year ago
Version: 1.5.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 0
Current verison: 0
Weekly downloads
Keywords
Marketing/Social Media Accounts
Cost/Freemium
Contributors
Dependencies