Conscent.ai Developer Documentation
  • Version 2.0
    • Using Conscent.ai
    • Web SDK
    • Login
    • Logout
    • User Details Drawer
    • Google One Tap
    • Mobile SDK
      • iOS(Swift)
        • In-App Purchases with Conscent
      • Android SDK
      • React Native SDK
      • Google In-App Purchases with Conscent
      • Apple In-App Purchases with Conscent
    • Facebook SSO Integration Guide
    • Landing Page API v 2.0
    • AMP Integration
    • Integrating APIs(v2)
      • Purchase Details
      • User Registered Or Not
      • User Registrations
      • Subscription Plans Details
      • Get User Details
      • Add Subscription If User Registered
      • Update UserDetails
      • Update SubscriptionDetails
      • Get All Transaction Details
    • IAM System API Documentation
  • Version 1.0
    • Getting Started
    • On Board
    • Using Conscent.ai
    • Authentication
    • Web SDK
    • Login
    • Logout
    • Amp Documentation
    • Mobile SDK
      • Android
      • Flutter
      • iOS(Swift)
      • React Native SDK
    • Auto Login
    • Creating External Purchases
    • Landing Page API
  • Login Screen Customization
  • Integrating Client Payment Gateway
  • Integrating with APIs
    • User Details and Subscriptions Information
    • Purchased Subscriptions
    • User and Purchase Details
    • Client Purchases
    • Client Micropayments
    • Client Passes
    • Cancel Active Subscriptions
    • Delete User
  • Events API Docs
    • Different Types of Events
    • SSO Login Flow
  • Discount Coupon
    • Dynamic Coupon API Generation:
  • New Webhooks
    • Meter Banner Webhook
    • Paywall Webhook
    • SignUp Webhook
    • Refund Webhook
    • Purchase Webhook
    • Subscription Landing Page Webhook
    • Popup Webhook
    • User Update Webhook
    • Payment Gateway Webhook
    • Review Page Webhook
    • Transaction Webhook
    • Login Webhook
    • Cancel Subscription Webhook
  • Old Webhooks
    • Sign Up Webhook
    • Login Webhook
    • Subscription Payment Webhook
    • Subscription Cancelled Webhook
    • Pass Payment Webhook
    • Subscription Bundle Payment Webhook
    • Review Subscription Webhook
    • Micro Payment Webhook
    • How to validate Webhooks?
  • Registering The Content
    • Create Content
    • Edit Content
    • View Content
  • Country Code List
  • Supported Currencies and Payment Gateways
    • Stripe Supported Country with Currency
    • Razorpay Supported Country with Currency
    • Paypal Supported Country with Currency
  • Errors
  • Loyalty System
    • Web SDK
    • iOS SDK
    • Android SDK
    • Flutter SDK
    • API from server
Powered by GitBook
On this page
  1. Registering The Content

Edit Content

This section lets you edit the content.

Authorization

PATCH {API_URL}/content/{contentId}

Client API Key and API Secret must be passed in Authorization Headers using Basic Auth. With API Key as the Username and API Secret as the password.

Path Parameters

Name
Type
Description

contentId*

String

The ID of the Content you wish to edit

Request Body

Name
Type
Description

title

String

Title of the content

contentId

String

contentId of the content

duration

Integer

duration of the content

priv

price of the content

url

String

URL of the content

curl -X PATCH '{API_URL}/api/v1/content/{contentId}' \
-H 'Authorization: Basic RDZXN1Y4US1NTkc0V1lDLVFYOUJQMkItOEU3QjZLRzpUNFNHSjlISDQ3TVpRWkdTWkVGVjZYUk5TS1E4RDZXN1Y4UU1ORzRXWUNRWDlCUDJCOEU3QjZLRw==' \
-H 'Content-Type: application/json' \
-d '{
    "contentId" : "testingID For Client Content",
    "duration" : 30,
    "title" : "Test content for API functionality Edited",
    "price" : 90,
    "currency": "INR",
    "categories": ["category1", "category2"],
    "tags": ["free", "premium", "metered"],
    "sections": ["EDITORIAL"],
    "authorId": "7589",
    "url": "www.google.com",
    "contentType": "PREMIUM CONTENT",
    "priceOverrides": {
        "country": [
            {
                "name": "GL",
                "price": 2
            },
            {
                "name": "IN",
                "price": 1
            },
            {
                "name": "US",
                "price": 0
            }
        ]
    },
    "download": {
      "url": "https://yourdownloadurl.com",
      "fileName": "Download File - Edited Name",
      "fileType": "PDF"
    },
    "pixels": {
        "facebook": {
            "pixelId": "98357934724994",
            "events": [
                {
                    "eventType": "VIEW",
                    "name": "PageView"
                },
                {
                    "eventType": "CONVERSION",
                    "name": "Purchase",
                    "data": {
                        "value": "dataValue"
                    }
                }
            ]
        },
        "google": {
            "trackingId": "G-RJDY8493"
        }
    }
}'

The above command returns JSON structured like this:

{
    "message": "Content Edited Successfully",
    "editedContent": {
        "title": "Test content for API functionality",
        "contentId": "898",
        "price": 90,
        "currency": "INR",
        "duration": 30,
        "url": "www.google.com",
        "contentType": "STORY",
        "authorId": "7589",
        "priceOverrides": {
            "country": [
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b4",
                    "name": "GL",
                    "price": 3
                },
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b5",
                    "name": "IN",
                    "price": 5
                },
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b6",
                    "name": "US",
                    "price": 7
                }
            ]
        },
        "download": {
            "url": "https://www.google.com",
            "fileName": "Download File - Name",
            "fileType": "PDF",
            "s3Key": "stage/Demo Client/Download File - Name-898.pdf"
        },
        "pixels": {
            "facebook": {
                "pixelId": "98357934724994",
                "events": [
                    {
                        "eventType": "VIEW",
                        "name": "PageView"
                    },
                    {
                        "eventType": "CONVERSION",
                        "name": "Purchase",
                        "data": {
                            "value": "dataValue"
                        }
                    }
                ]
            },
            "google": {
                "trackingId": "G-RJDY8493"
            }
        },
        "categories": [
            "category1",
            "category2"
        ],
        "tags": [
            "free",
            "premium",
            "metered"
        ],
        "sections": [
            "EDITORIAL"
        ],
        "publicationDate": null
    }
}
var axios = require("axios");
var data = JSON.stringify({
  contentId: "testingID For Client Content",
  duration: 30,
  title: "Test content for API functionality Edited",
  price: 90,
  currency: "INR",
  categories: ["category1", "category2"],
  tags: ["entertainment", "sports"],
  sections: ["EDITORIAL"],
  authorId: "7589",
  url: "www.google.com",
  contentType: "PREMIUM CONTENT",
  priceOverrides: {
    country: [
      { name: "GL", price: 2 },
      { name: "IN", price: 1 },
      { name: "US", price: 0 },
    ],
  },
  download: {
    url: "https://yourdownloadurl.com",
    fileName: "Download File - Edited Name",
    fileType: "PDF",
  },
  pixels: {
    facebook: {
      pixelId: "98357934724994",
      events: [
        {
          eventType: "VIEW",
          name: "PageView",
        },
        {
          eventType: "CONVERSION",
          name: "Purchase",
          data: {
            value: "dataValue",
          },
        },
      ],
    },
     google: {
      trackingId: "G-RJDY8493",
    },
  },
});

var config = {
  method: "patch",
  url: "{API_URL}/api/v1/content/{contentId}",
  headers: {
    Authorization:
      "Basic RDZXN1Y4US1NTkc0V1lDLVFYOUJQMkItOEU3QjZLRzpUNFNHSjlISDQ3TVpRWjnJL877NJSjnkHSk5TS1E4RDZXN1Y4UU1ORzRXWUNRWDlCUDJCOEU3QjZLRw==",
    "Content-Type": "application/json",
  },
  data: data,
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

The above command returns JSON structured like this:

{
    "message": "Content Edited Successfully",
    "editedContent": {
        "title": "Test content for API functionality",
        "contentId": "898",
        "price": 90,
        "currency": "INR",
        "duration": 30,
        "url": "www.google.com",
        "contentType": "STORY",
        "authorId": "7589",
        "priceOverrides": {
            "country": [
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b4",
                    "name": "GL",
                    "price": 3
                },
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b5",
                    "name": "IN",
                    "price": 5
                },
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b6",
                    "name": "US",
                    "price": 7
                }
            ]
        },
        "download": {
            "url": "https://www.google.com",
            "fileName": "Download File - Name",
            "fileType": "PDF",
            "s3Key": "stage/Demo Client/Download File - Name-898.pdf"
        },
        "pixels": {
            "facebook": {
                "pixelId": "98357934724994",
                "events": [
                    {
                        "eventType": "VIEW",
                        "name": "PageView"
                    },
                    {
                        "eventType": "CONVERSION",
                        "name": "Purchase",
                        "data": {
                            "value": "dataValue"
                        }
                    }
                ]
            },
            "google": {
                "trackingId": "G-RJDY8493"
            }
        },
        "categories": [
            "category1",
            "category2"
        ],
        "tags": [
            "free",
            "premium",
            "metered"
        ],
        "sections": [
            "EDITORIAL"
        ],
        "publishedAt": null
    }
}
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "{API_URL}/api/v1/content/Client%20Content%20Id%2011",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
   CURLOPT_POSTFIELDS =>'{
    "contentId" : "testingID For Client Content",
    "duration": 30,
    "title": "Test content for API functionality Edited",
    "price" : 90,
    "currency": "INR",
    "url": "www.google.com",
    "contentType": "PREMIUM CONTENT",
    "categories": ["category3"],
    "priceOverrides": {
        "country": [
            {
                "name": "GL",
                "price": 2
            },
            {
                "name": "IN",
                "price": 1
            },
            {
                "name": "US",
                "price": 0
            }
        ]
    },
    "download": {
      "url": "https://yourdownloadurl.com",
      "fileName": "Download File - Edited Name",
      "fileType": "PDF"
    },
    "pixels": {
    "facebook": {
            "pixelId": "98357934724994",
            "events": [
                {
                    "eventType": "VIEW",
                    "name": "PageView"
                },
                {
                    "eventType": "CONVERSION",
                    "name": "Purchase",
                    "data": {
                        "value": "dataValue"
                    }
                }
            ]
        },
        "google": {
            "trackingId": "G-RJDY8493"
        }
    }
}',
  CURLOPT_HTTPHEADER => array(
    "Authorization: Basic RDZXN1Y4US1NTkc0V1lDLVFYOUJQMkItOEU3QjZLRzpUNFNHSjlISDQ3TVpRWkdTWkVGVjZYUk5TS1E4RDZXN1Y4UU1ORzRXWUNRWDlCUDJCOEU3QjZLRw==",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

The above command returns JSON structured like this:

{
    "message": "Content Edited Successfully",
    "editedContent": {
        "title": "Test content for API functionality",
        "contentId": "898",
        "price": 90,
        "currency": "INR",
        "duration": 30,
        "url": "www.google.com",
        "contentType": "STORY",
        "authorId": "7589",
        "priceOverrides": {
            "country": [
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b4",
                    "name": "GL",
                    "price": 3
                },
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b5",
                    "name": "IN",
                    "price": 5
                },
                {
                    "currency": "INR",
                    "_id": "605b25824646e9233aef61b6",
                    "name": "US",
                    "price": 7
                }
            ]
        },
        "download": {
            "url": "https://www.google.com",
            "fileName": "Download File - Name",
            "fileType": "PDF",
            "s3Key": "stage/Demo Client/Download File - Name-898.pdf"
        },
        "pixels": {
            "facebook": {
                "pixelId": "98357934724994",
                "events": [
                    {
                        "eventType": "VIEW",
                        "name": "PageView"
                    },
                    {
                        "eventType": "CONVERSION",
                        "name": "Purchase",
                        "data": {
                            "value": "dataValue"
                        }
                    }
                ]
            },
            "google": {
                "trackingId": "G-RJDY8493"
            }
        },
        "categories": [
            "category1",
            "category2"
        ],
        "tags": [
            "free",
            "premium",
            "metered"
        ],
        "sections": [
            "EDITORIAL"
        ],
        "publishedAt": null
    }
}

PreviousCreate ContentNextView Content

Last updated 1 year ago