Request headers

Only registered user can perform this action
  Authentication - string - required
    Example of Authentication header : "Bearer TOKEN_FETCHED_FROM_SERVER_DURING_REGISTRATION"

Request body examples

{
  "social_media_post_wrapper": {
    "publication_date": "PUBLICATION DATE",
    "social_media_posts_attributes": [
      # for update
      {
        "id": 12,
        "message": "MESSAGE",
        "alt_text": "ALT TEXT",
      },
      # for destroy
      {
        "id": 13,
        "_destroy": true
      },
      # for add new social network
      {
        "message": "MESSAGE",
        "alt_text": "ALT TEXT",
        "social_media": "facebook",
        "account_id": 1
      }
      # you can combine hashes in one request
    ],
    "social_attachments_attributes": [
      # for update position
      {
        "id": 1,
        "position": 1
      },
      # for create new attachment
      {
        "mediable_id": 1121,
        "mediable_type": "TemplateVideo",
        "position": 0
      },
      # for destroy attachment
      {
        "id": 2,
        "_destroy": true
      }
    ]
  }
}

Success response body

{
  "id": 3865,
  "publication_date": "2024-05-20T12:59:00.000Z",
  "publication_date_format": {
    "day": "Mon",
    "date": "20 May",
    "time": "12:59 PM",
    "year": "2024"
  },
  "message": "nknknknkj",
  "social_attachments": [
    {
      "id": 2,
      "link_for_media": "https://d2tyu887lcxnka.cloudfront.net/018BB18539AC943DDC1EF709F55E8553.jpeg",
      "status": "created",
      "mediable_id": 24925,
      "mediable_type": "Picture",
      "mediable_size": null,
      "video": false
    },
    ...
  ],
  "twitter_social_media_posts": [
    {
      "id": 21481,
      "account_id": 2018,
      "message": "nknknknkj",
      "alt_text": "",
      "publication_error": null
    }
  ],
  "facebook_social_media_posts": [
    {
      "id": 21482,
      "account_id": 5937,
      "message": "nknknknkj",
      "alt_text": "",
      "publication_error": null
    }
  ],
  "instagram_social_media_posts": []
}

Status 422 error message

{
  "social_media_posts.publication_date": [
    "This post cannot be edited because it has already been published to social media."
  ]
}

Params

Param name Description
id
required

Validations:

  • Must be a Integer

social_media_post_wrapper
required

Validations:

  • Must be a Hash

social_media_post_wrapper[publication_date]
required

DateTime of publications

Validations:

  • Must be a String

social_media_post_wrapper[social_media_posts_attributes]
optional

Validations:

  • Must be an Array of nested elements

social_media_post_wrapper[social_media_posts_attributes][id]
optional

if you want create new post DONT SEND ID else MUST BE

Validations:

  • Must be a Integer

social_media_post_wrapper[social_media_posts_attributes][message]
required

Validations:

  • Must be a String

social_media_post_wrapper[social_media_posts_attributes][alt_text]
optional

Validations:

  • Must be a String

social_media_post_wrapper[social_media_posts_attributes][social_media]
optional

MUST BE if you want add new social network

Validations:

  • Must be one of: twitter, facebook, instagram.

social_media_post_wrapper[social_media_posts_attributes][account_id]
optional

ID of account; MUST BE if you want add new social network

Validations:

  • Must be a Integer

social_media_post_wrapper[social_media_posts_attributes][_destroy]
optional

Validations:

  • Must be one of: true, false, 1, 0.

social_media_post_wrapper[social_attachments_attributes]
optional

Validations:

  • Must be an Array of nested elements

social_media_post_wrapper[social_attachments_attributes][id]
optional

if you want create new post attachment DONT SEND ID else MUST BE

Validations:

  • Must be a Integer

social_media_post_wrapper[social_attachments_attributes][mediable_id]
optional

ID of media; MUST BE if you want add new social network

Validations:

  • Must be a Integer

social_media_post_wrapper[social_attachments_attributes][mediable_type]
optional

Type of media; MUST BE if you want add new social network

Validations:

  • Must be one of: Picture, TemplateVideo, MediaFile, GipperLearn::CustomerAction.

social_media_post_wrapper[social_attachments_attributes][position]
required , nil allowed

Validations:

  • Must be a Integer

social_media_post_wrapper[social_attachments_attributes][_destroy]
optional

Validations:

  • Must be one of: true, false, 1, 0.