Content Publishing Service
The Content Publishing Service allows users to create, post, and manage content on the Frequency network. It supports various content types such as text, images, and videos.
API Reference
Path Table
Method | Path | Description |
---|---|---|
PUT | /v1/asset/upload | Upload asset files |
POST | /v1/content/{userDsnpId}/broadcast | Create DSNP Broadcast for user |
POST | /v1/content/{userDsnpId}/reply | Create DSNP Reply for user |
POST | /v1/content/{userDsnpId}/reaction | Create DSNP Reaction for user |
PUT | /v1/content/{userDsnpId} | Update DSNP Content for user |
DELETE | /v1/content/{userDsnpId} | Delete DSNP Content for user |
PUT | /v1/profile/{userDsnpId} | Update a user's Profile |
GET | /healthz | Check the health status of the service |
GET | /livez | Check the live status of the service |
GET | /readyz | Check the ready status of the service |
GET | /dev/request/{jobId} | Get a Job given a jobId |
GET | /dev/asset/{assetId} | Get an Asset given an assetId |
POST | /dev/dummy/announcement/{queueType}/{count} | Create dummy announcement data |
Reference Table
Name | Path | Description |
---|---|---|
FilesUploadDto | #/components/schemas/FilesUploadDto | |
UploadResponseDto | #/components/schemas/UploadResponseDto | |
AssetReferenceDto | #/components/schemas/AssetReferenceDto | |
AssetDto | #/components/schemas/AssetDto | |
TagDto | #/components/schemas/TagDto | |
LocationDto | #/components/schemas/LocationDto | |
NoteActivityDto | #/components/schemas/NoteActivityDto | |
BroadcastDto | #/components/schemas/BroadcastDto | |
AnnouncementResponseDto | #/components/schemas/AnnouncementResponseDto | |
ReplyDto | #/components/schemas/ReplyDto | |
ReactionDto | #/components/schemas/ReactionDto | |
UpdateDto | #/components/schemas/UpdateDto | |
TombstoneDto | #/components/schemas/TombstoneDto | |
ProfileActivityDto | #/components/schemas/ProfileActivityDto | |
ProfileDto | #/components/schemas/ProfileDto |
Path Details
[PUT]/v1/asset/upload
- Summary
Upload asset files
RequestBody
- multipart/form-data
{
files?: string[]
}
Responses
- 2XX
application/json
{
assetIds?: string[]
}
[POST]/v1/content/{userDsnpId}/broadcast
- Summary
Create DSNP Broadcast for user
RequestBody
- application/json
{
content: {
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
Responses
- 2XX
application/json
{
referenceId: string
}
[POST]/v1/content/{userDsnpId}/reply
- Summary
Create DSNP Reply for user
RequestBody
- application/json
{
inReplyTo: string
content: {
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
Responses
- 2XX
application/json
{
referenceId: string
}
[POST]/v1/content/{userDsnpId}/reaction
- Summary
Create DSNP Reaction for user
RequestBody
- application/json
{
emoji: string
apply: number
inReplyTo: string
}
Responses
- 2XX
application/json
{
referenceId: string
}
[PUT]/v1/content/{userDsnpId}
- Summary
Update DSNP Content for user
RequestBody
- application/json
{
targetContentHash: string
targetAnnouncementType: enum[broadcast, reply]
content: {
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
Responses
- 2XX
application/json
{
referenceId: string
}
[DELETE]/v1/content/{userDsnpId}
- Summary
Delete DSNP Content for user
RequestBody
- application/json
{
targetContentHash: string
targetAnnouncementType: enum[broadcast, reply]
}
Responses
- 2XX
application/json
{
referenceId: string
}
[PUT]/v1/profile/{userDsnpId}
- Summary
Update a user's Profile
RequestBody
- application/json
{
profile: {
icon: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
summary?: string
published?: string
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
Responses
- 2XX
application/json
{
referenceId: string
}
[GET]/healthz
- Summary
Check the health status of the service
Responses
- 200 Service is healthy
[GET]/livez
- Summary
Check the live status of the service
Responses
- 200 Service is live
[GET]/readyz
- Summary
Check the ready status of the service
Responses
- 200 Service is ready
[GET]/dev/request/{jobId}
-
Summary
Get a Job given a jobId -
Description
ONLY enabled when ENVIRONMENT="dev".
Responses
- 200
[GET]/dev/asset/{assetId}
-
Summary
Get an Asset given an assetId -
Description
ONLY enabled when ENVIRONMENT="dev".
Responses
- 2XX
application/octet-stream
{
"type": "string",
"format": "binary"
}
[POST]/dev/dummy/announcement/{queueType}/{count}
-
Summary
Create dummy announcement data -
Description
ONLY enabled when ENVIRONMENT="dev".
Responses
- 201
References
#/components/schemas/FilesUploadDto
{
files?: string[]
}
#/components/schemas/UploadResponseDto
{
assetIds?: string[]
}
#/components/schemas/AssetReferenceDto
{
referenceId: string
height?: number
width?: number
duration?: string
}
#/components/schemas/AssetDto
{
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}
#/components/schemas/TagDto
{
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}
#/components/schemas/LocationDto
{
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
#/components/schemas/NoteActivityDto
{
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
#/components/schemas/BroadcastDto
{
content: {
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
#/components/schemas/AnnouncementResponseDto
{
referenceId: string
}
#/components/schemas/ReplyDto
{
inReplyTo: string
content: {
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
#/components/schemas/ReactionDto
{
emoji: string
apply: number
inReplyTo: string
}
#/components/schemas/UpdateDto
{
targetContentHash: string
targetAnnouncementType: enum[broadcast, reply]
content: {
content: string
published: string
assets: {
references: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
name?: string
href?: string
}[]
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
#/components/schemas/TombstoneDto
{
targetContentHash: string
targetAnnouncementType: enum[broadcast, reply]
}
#/components/schemas/ProfileActivityDto
{
icon: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
summary?: string
published?: string
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
#/components/schemas/ProfileDto
{
profile: {
icon: {
referenceId: string
height?: number
width?: number
duration?: string
}[]
summary?: string
published?: string
name?: string
tag: {
type: enum[mention, hashtag]
name?: string
mentionedId?: string
}[]
location: {
name: string
accuracy?: number
altitude?: number
latitude?: number
longitude?: number
radius?: number
units?: enum[cm, m, km, inches, feet, miles]
}
}
}
Configuration
ℹ️ Feel free to adjust your environment variables to taste. This application recognizes the following environment variables:
Name | Description | Range/Type | Required? | Default |
---|---|---|---|---|
API_PORT | HTTP port that the application listens on | 1025 - 65535 | 3000 | |
ASSET_EXPIRATION_INTERVAL_SECONDS | Number of seconds to keep completed asset entries in the cache before expiring them | > 0 | Y | |
ASSET_UPLOAD_VERIFICATION_DELAY_SECONDS | Base delay in seconds used for exponential backoff while waiting for uploaded assets to be verified available before publishing a content notice | >= 0 | Y | |
BATCH_INTERVAL_SECONDS | Number of seconds between publishing batches. This is so that the service waits a reasonable amount of time for additional content to publish before submitting a batch--it represents a trade-off between maximum batch fullness and minimal wait time for content | > 0 | Y | |
BATCH_MAX_COUNT | Maximum number of items that can be submitted in a single batch | > 0 | Y | |
CACHE_KEY_PREFIX | Prefix to use for Redis cache keys | string | content-publishing-service: | |
CAPACITY_LIMIT | Maximum amount of provider capacity this app is allowed to use (per epoch) type: 'percentage' 'amount' value: number (may be percentage, ie '80', or absolute amount of capacity) | JSON (example) | Y | |
FILE_UPLOAD_MAX_SIZE_IN_BYTES | Max file size (in bytes) allowed for asset upload | > 0 | Y | |
FREQUENCY_URL | Blockchain node address | http(s): or ws(s): URL | Y | |
IPFS_BASIC_AUTH_SECRET | If using Infura, put auth token here, or leave blank for Kubo RPC | string | blank | |
IPFS_BASIC_AUTH_USER | If using Infura, put Project ID here, or leave blank for Kubo RPC | string | blank | |
IPFS_ENDPOINT | URL to IPFS endpoint | URL | Y | |
IPFS_GATEWAY_URL | IPFS gateway URL '[CID]' is a token that will be replaced with an actual content ID | URL template | Y | |
PROVIDER_ACCOUNT_SEED_PHRASE | Seed phrase for provider MSA control key | string | Y | |
PROVIDER_ID | Provider MSA Id | integer | Y | |
REDIS_URL | Connection URL for Redis | URL | Y |
Best Practices
- Metadata Management: Always ensure metadata is correctly associated with content to maintain data integrity.
- Content Validation: Validate content to prevent the submission of inappropriate or harmful material.