How it works?
In order to create an advertisement using api, you need to know how it works in the backend.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Description of how the system works when creating an advertisement, that is (Image / Video) ads.
- 1. First you upload media files (Video/Images)
- 2. Then just publish the advertisement using the endpoints described below
Unpublished advertisement check
Please use this (https://blkem.com/mobile_api/ads_unpublish_check) API to access unpublished advertisement endpoint.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
Success response
{
"code": 200,
"message": "Advertisement found successfully",
"data": {
"id": 164,
"user_id": 8715,
"cover": "",
"cover_type": null,
"company": "",
"target_url": "",
"status": "orphan",
"approved": "N",
"audience": "[]",
"description": "",
"cta": "",
"clicks": 0,
"views": 0,
"budget": "'0.00'",
"cost_type": "on_view",
"time": "1676017460",
"published_time": "0",
"start_date": "0",
"end_date": "0"
}
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Insufficient wallet balance",
"data": []
}
Advertisement media upload
Please use this (https://blkem.com/mobile_api/ads_media_upload) API endpoint for uploading advertisement multimedia file.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
ad_id | Advertisement int ID | E.g. 134 |
type | Media file type (image/video) | E.g. `image` |
file | Media file (Image/Video) | E.g. some-ads-picture.jpg / some-ads-video.mp4 |
Success response
{
"code": 200,
"message": "Media file uploaded successfully",
"data": {
"url": "An absolute URL of new uploded media file",
"type": "Image/Video"
}
}
Error responses
{
"code": 401,
"message": "Unauthorized Access",
"data": []
}
{
"code": 400,
"message": "Advertising ID is missing or invalid",
"data": []
}
{
"code": 400,
"message": "Media file type is missing or invalid",
"data": []
}
{
"code": 500,
"message": "Media file is missing or invalid",
"data": []
}
{
"code": 400,
"message": "Something went wrong while saving a uploaded media file. Please check your details and try again",
"data": []
}
Advertisement publishing
Please use this (https://blkem.com/mobile_api/ads_publish) API to access advertisement publishing endpoint.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
ad_id | Advertisement int ID | E.g. 134 |
company | Advertisement campaign title text (Min length: 1, Max length: 115) |
E.g. `My campaign xyz` |
target_url | Advertisement sponsored weburl | E.g. `https://www.yahoo.com` (It's only needed when cost_type is selected as `on_click`) |
status | Advertisement status (pending/active/inactive/reject) | E.g. `pending` |
audience | Advertisement audience | Json array with target audience objects. E.g. ["1","2","3","4",...] atleast 1 option |
description | Advertisement description (Min length: 1, Max length: 550) |
E.g. `Hi this is my ad` |
cta | Advertisement cta | E.g. `Click ad` (It's only needed when cost_type is selected as `on_click`) |
cost_type | Advertisement cost type (on_view/on_click) | E.g. `on_click` |
start_date | Advertisement Start date (in sec) | E.g. 1675946880 (It's only needed if "ad_campaign_limit" is `on` from admin cpanel) |
end_date | Advertisement End date (in sec) | E.g. 1676033280 (It's only needed if "ad_campaign_limit" is `on` from admin cpanel) |
Success response
{
"code": 200,
"message": "Advertising published successfully",
"data": {
"id": 164,
"user_id": 8715,
"cover": "upload\/covers\/2023\/02\/k2318I3A2DFnAz329yIB_10_540610a045427371268c103d767dce50_image_cover.png",
"cover_type": "image",
"company": "Web Blkem",
"target_url": "https:\/\/google.com",
"status": "pending",
"approved": "N",
"audience": "[\n \"1\",\n \"2\"\n]",
"description": "This is my new ads api",
"cta": "Click me",
"clicks": 0,
"views": 0,
"budget": "'0.00'",
"cost_type": "on_click",
"time": "1676017460",
"published_time": "1676030660",
"start_date": "1676025360",
"end_date": "1676111760"
}
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Advertising ID is missing or invalid",
"data": []
}
{
"code": 400,
"message": "You are not authorized to save or edit information of this advertisement",
"data": []
}
{
"code": 400,
"err_code": "invalid_cover or invalid_company or invalid_target_url or invalid_status or invalid_audience
or invalid_cta or invalid_description or invalid_start_date or invalid_end_date",
"message": "Invalid data for publication. Please check your details",
"data": []
}
Advertisement fetching
Please use this (https://blkem.com/mobile_api/ads_fetch) API to access advertisement fetching endpoint.
GET parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
type | Advertisement type (active/archive/pending) | E.g. `active` |
offset | Last ads offset ID | This is only needed when loading posts of the pagination system. |
page_size | Total ads limit for each request | Recommended: 10 |
Success response
{
"code": 200,
"message": "Advertisement fetched successfully",
"data": {
"count": 38,
"archive": [
{
"id": 151,
"user_id": 8715,
"cover": "https://blkem.s3.amazonaws.com/upload/covers/2023/02/fOND9FFQW6CMmedctc8U_08_8688ddf1aa90be30b75abaf5cab025a9_video_cover.mp4",
"cover_type": "video",
"company": "Big bunny",
"target_url": "https://big.bunny.com",
"status": "inactive",
"approved": "Y",
"audience": "[\n \"1\",\n \"2\"]",
"description": "Test description",
"cta": "Click to see",
"clicks": "10",
"views": "10",
"budget": "$7",
"cost_type": "on_click",
"time": "2 days ago",
"published_time": "1675831164",
"start_date": "1675832880",
"end_date": "1675833060",
"edit": "http://localhost/blkemweb-v6/ads/edit/151",
"published_time_str": "2 days ago",
"created_time": "1675831093",
"is_owner": true,
"show_stats": true,
"domain": "big.bunny.com",
"owner": {
"avatar": "https://blkem.s3.amazonaws.com/upload/avatars/2022/07/imGY9Y4KKZKOEqbmyo2o_22_73fd2781886fc20b561510f2f63d1e62_thumbnail_512x512.jpg",
"name": "user1 test",
"username": "user1test",
"verified": "1",
"assigned_badge": "brown",
"url": "http://localhost/blkemweb-v6/user1test"
}
},
{
"id": 135,
"user_id": 8715,
"cover": "https://blkem.s3.amazonaws.com/upload/covers/2023/02/omr8GM3g8b7HO1RVKrCM_02_53907ccfe8ca837b708cff4889e2364f_video_cover.mp4",
"cover_type": "video",
"company": "Test CPC",
"target_url": "https://google.com",
"status": "inactive",
"approved": "Y",
"audience": "[\n \"1\",\n \"2\",\n \"3\",\n \"4\"]",
"description": "Description",
"cta": "Click me",
"clicks": "8",
"views": "4",
"budget": "$4.40",
"cost_type": "on_click",
"time": "8 days ago",
"published_time": "1675339554",
"start_date": "1675339500",
"end_date": "1675425900",
"edit": "http://localhost/blkemweb-v6/ads/edit/135",
"published_time_str": "8 days ago",
"created_time": "1675339459",
"is_owner": true,
"show_stats": true,
"domain": "google.com",
"owner": {
"avatar": "https://blkem.s3.amazonaws.com/upload/avatars/2022/07/imGY9Y4KKZKOEqbmyo2o_22_73fd2781886fc20b561510f2f63d1e62_thumbnail_512x512.jpg",
"name": "user1 test",
"username": "user1test",
"verified": "1",
"assigned_badge": "brown",
"url": "http://localhost/blkemweb-v6/user1test"
}
},
....
]
}
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Advertising type is missing or invalid",
"data": []
}
Advertisement conversion
Please use this (https://blkem.com/mobile_api/ads_conversion) API to access advertisement conversion endpoint.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
type | Advertisement coversion type (view/click) | E.g. `view` |
ad_id | Advertisement int ID | E.g. 134 |
Success response
{
"code": 200,
"message": "Advertisement conversion applied successfully",
"data": {
"id": 134,
"user_id": 8715,
"cover": "upload/covers/2023/02/czKldVTuulbkJCEXQjw4_02_dae2e62888ea0aacadcad5754e6be579_image_cover.jpg",
"cover_type": "image",
"company": "Test CPV",
"target_url": "",
"status": "active",
"approved": "Y",
"audience": "[\n\"1\",\n\"2\", \"242\"\n]",
"description": "Description",
"cta": "",
"clicks": 0,
"views": 13,
"budget": "3.9",
"cost_type": "on_view",
"time": "1675335214",
"published_time": "1675338803",
"start_date": "1675338780",
"end_date": "1675425180"
}
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Advertising ID is missing or invalid",
"data": []
}
{
"code": 400,
"message": "Coversion type is missing or invalid",
"data": []
}
Advertisement delete / media delete
Please use this (https://blkem.com/mobile_api/ads_delete) API to access advertisement delete or advertisement media delete endpoint.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
type | Advertisement delete type (ads/media) | E.g. `media` |
ad_id | Advertisement int ID | E.g. 134 |
Success response
{
"code": 200,
"message": "Advertisement deleted successfully",
"data": []
}
OR
{
"code": 200,
"message": "Advertisement media deleted successfully",
"data": []
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Advertising ID is missing or invalid",
"data": []
}
{
"code": 400,
"message": "Deletion type is missing or invalid",
"data": []
}
{
"code": 400,
"message": "You are not authorized to delete",
"data": []
}