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

Open Full API Reference Page

Path Table

MethodPathDescription
PUT/v1/asset/uploadUpload asset files
POST/v1/content/{userDsnpId}/broadcastCreate DSNP Broadcast for user
POST/v1/content/{userDsnpId}/replyCreate DSNP Reply for user
POST/v1/content/{userDsnpId}/reactionCreate 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/healthzCheck the health status of the service
GET/livezCheck the live status of the service
GET/readyzCheck 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

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:

NameDescriptionRange/TypeRequired?Default
API_PORTHTTP port that the application listens on1025 - 655353000
ASSET_EXPIRATION_INTERVAL_SECONDSNumber of seconds to keep completed asset entries in the cache before expiring them> 0Y
ASSET_UPLOAD_VERIFICATION_DELAY_SECONDSBase delay in seconds used for exponential backoff while waiting for uploaded assets to be verified available before publishing a content notice>= 0Y
BATCH_INTERVAL_SECONDSNumber 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> 0Y
BATCH_MAX_COUNTMaximum number of items that can be submitted in a single batch> 0Y
CACHE_KEY_PREFIXPrefix to use for Redis cache keysstringcontent-publishing-service:
CAPACITY_LIMITMaximum 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_BYTESMax file size (in bytes) allowed for asset upload> 0Y
FREQUENCY_URLBlockchain node addresshttp(s): or ws(s): URLY
IPFS_BASIC_AUTH_SECRETIf using Infura, put auth token here, or leave blank for Kubo RPCstringblank
IPFS_BASIC_AUTH_USERIf using Infura, put Project ID here, or leave blank for Kubo RPCstringblank
IPFS_ENDPOINTURL to IPFS endpointURLY
IPFS_GATEWAY_URLIPFS gateway URL '[CID]' is a token that will be replaced with an actual content IDURL templateY
PROVIDER_ACCOUNT_SEED_PHRASESeed phrase for provider MSA control keystringY
PROVIDER_IDProvider MSA IdintegerY
REDIS_URLConnection URL for RedisURLY

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.