-
Notifications
You must be signed in to change notification settings - Fork 0
Post API Add Post Example Employee Recognition
Dominik Magdaleński edited this page Jul 3, 2019
·
1 revision
-
Add
MediaUploadRequest
:Request:
http --follow POST https://dive-networks.com/api/rpc/34/add_media_upload_request \ Authorization:"Token your-api-token-here" \ media_type=image
Response:
HTTP/1.1 201 Created (...headers...) { "result": { "created_at": "2019-06-26T06:29:44.624574-04:00", "data": {}, "expires_at": "2019-06-26T06:39:44.159989-04:00", "id": 36, "media_type": "image", "presigned_s3_post": { "fields": { "key": "images/3e4cedec-9f3e-4bed-8ffd-50fd59aa9c95", "policy": "eyJleHBpcmF0aW9uIjogIjIwMTktMDYtMjZUMTA6Mzk6NDRaIiwgImNvbmRpdGlvbnMiOiBbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDAsIDIwOTcxNTIwXSwgeyJidWNrZXQiOiAiZGl2ZS1tZWRpYS11cGxvYWQtdGVzdC0yMjA0MjAxOSJ9LCB7ImtleSI6ICJpbWFnZXMvM2U0Y2VkZWMtOWYzZS00YmVkLThmZmQtNTBmZDU5YWE5Yzk1In0sIHsieC1hbXotYWxnb3JpdGhtIjogIkFXUzQtSE1BQy1TSEEyNTYifSwgeyJ4LWFtei1jcmVkZW50aWFsIjogIkFLSUFYTDdFQUdEUVFHRUhXUVFJLzIwMTkwNjI2L2V1LWNlbnRyYWwtMS9zMy9hd3M0X3JlcXVlc3QifSwgeyJ4LWFtei1kYXRlIjogIjIwMTkwNjI2VDEwMjk0NFoifV19", "x-amz-algorithm": "AWS4-HMAC-SHA256", "x-amz-credential": "AKIAXL7EAGDQQGEHWQQI/20190626/eu-central-1/s3/aws4_request", "x-amz-date": "20190626T102944Z", "x-amz-signature": "aa18c32f819f5b02f5e54a8030b3c7602834edab286620da5676face90fdb71f" }, "url": "https://dive-media-upload-test-22042019.s3.amazonaws.com/" }, "status": "init", "updated_at": "2019-06-26T06:29:44.624628-04:00" } }
-
Upload image (copy URL and form field values from the
MediaUploadRequest
):Request:
http --follow --form POST https://dive-media-upload-test-22042019.s3.amazonaws.com/ \ key="images/3e4cedec-9f3e-4bed-8ffd-50fd59aa9c95" \ policy="eyJleHBpcmF0aW9uIjogIjIwMTktMDYtMjZUMTA6Mzk6NDRaIiwgImNvbmRpdGlvbnMiOiBbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDAsIDIwOTcxNTIwXSwgeyJidWNrZXQiOiAiZGl2ZS1tZWRpYS11cGxvYWQtdGVzdC0yMjA0MjAxOSJ9LCB7ImtleSI6ICJpbWFnZXMvM2U0Y2VkZWMtOWYzZS00YmVkLThmZmQtNTBmZDU5YWE5Yzk1In0sIHsieC1hbXotYWxnb3JpdGhtIjogIkFXUzQtSE1BQy1TSEEyNTYifSwgeyJ4LWFtei1jcmVkZW50aWFsIjogIkFLSUFYTDdFQUdEUVFHRUhXUVFJLzIwMTkwNjI2L2V1LWNlbnRyYWwtMS9zMy9hd3M0X3JlcXVlc3QifSwgeyJ4LWFtei1kYXRlIjogIjIwMTkwNjI2VDEwMjk0NFoifV19" \ x-amz-algorithm="AWS4-HMAC-SHA256" \ x-amz-credential="AKIAXL7EAGDQQGEHWQQI/20190626/eu-central-1/s3/aws4_request" \ x-amz-date="20190626T102944Z" \ x-amz-signature="aa18c32f819f5b02f5e54a8030b3c7602834edab286620da5676face90fdb71f" \ file@~/Pictures/sample.jpg
Response:
HTTP/1.1 204 No Content (...headers...)
-
Get
"data"
from theMediaUploadRequest
(it should be ready after a short while):Request:
http --follow https://dive-networks.com/api/rpc/34/get_media_upload_request?id=36 \ Authorization:"Token your-api-token-here"
Response:
HTTP/1.1 200 OK (...headers...) { "result": { "created_at": "2019-06-26T06:29:44.624574-04:00", "data": { "image_height": 720, "image_url": "https://cdn.filestackcontent.com/6q65AcEETimNf6LpsLeC", "image_width": 480, "uploaded_file_s3_bucket": "dive-cms-media", "uploaded_file_s3_key": "s/i/dGaDLPWSvaFt3soQAucw_convert.jpg", "uploaded_file_size_bytes": 74718 }, "expires_at": "2019-06-26T06:39:44.159989-04:00", "id": 36, "media_type": "image", "presigned_s3_post": { "fields": { "key": "images/3e4cedec-9f3e-4bed-8ffd-50fd59aa9c95", "policy": "eyJleHBpcmF0aW9uIjogIjIwMTktMDYtMjZUMTA6NDE6NDhaIiwgImNvbmRpdGlvbnMiOiBbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDAsIDIwOTcxNTIwXSwgeyJidWNrZXQiOiAiZGl2ZS1tZWRpYS11cGxvYWQtdGVzdC0yMjA0MjAxOSJ9LCB7ImtleSI6ICJpbWFnZXMvM2U0Y2VkZWMtOWYzZS00YmVkLThmZmQtNTBmZDU5YWE5Yzk1In0sIHsieC1hbXotYWxnb3JpdGhtIjogIkFXUzQtSE1BQy1TSEEyNTYifSwgeyJ4LWFtei1jcmVkZW50aWFsIjogIkFLSUFYTDdFQUdEUVFHRUhXUVFJLzIwMTkwNjI2L2V1LWNlbnRyYWwtMS9zMy9hd3M0X3JlcXVlc3QifSwgeyJ4LWFtei1kYXRlIjogIjIwMTkwNjI2VDEwMzE0OFoifV19", "x-amz-algorithm": "AWS4-HMAC-SHA256", "x-amz-credential": "AKIAXL7EAGDQQGEHWQQI/20190626/eu-central-1/s3/aws4_request", "x-amz-date": "20190626T103148Z", "x-amz-signature": "be74ce5970d2ff738eeeb2106c2d5eb9a199b78e765e2fc405b69606d350aa17" }, "url": "https://dive-media-upload-test-22042019.s3.amazonaws.com/" }, "status": "succeeded", "updated_at": "2019-06-26T06:31:48.142323-04:00" } }
-
Add Post:
body.json
:{ "template": "employee-recognition", "title": "Let's all recognize Janey!", "subtitle": "She is awesome!", "media_type": "image", "content_zones": [ 15 ], "image_height": 720, "image_url": "https://cdn.filestackcontent.com/6q65AcEETimNf6LpsLeC", "image_width": 480, "uploaded_file_s3_bucket": "dive-cms-media", "uploaded_file_s3_key": "s/i/dGaDLPWSvaFt3soQAucw_convert.jpg", "uploaded_file_size_bytes": 74718 }
Request:
http --follow POST https://dive-networks.com/api/rpc/34/add_post \ Authorization:"Token your-api-token-here" \ < body.json
Response:
HTTP/1.1 201 Created (...headers...) { "result": { "background_color": "ffffff", "body": null, "content_zones": [ 15 ], "duration": null, "frequency": 300, "fullscreen_playback": false, "id": 13367, "iframe_url": null, "image_height": 720, "image_layout": "auto", "image_url": "https://cdn.filestackcontent.com/6q65AcEETimNf6LpsLeC", "image_width": 480, "intro_background_color": "6d4fc3", "intro_text_color": "ffffff", "is_published": true, "media_type": "image", "override_end": null, "override_start": null, "pdf_height": null, "pdf_numpages": null, "pdf_thumbnail_url": null, "pdf_url": null, "pdf_width": null, "priority": "low", "schedule_end": "2019-07-03T06:40:15.076926-04:00", "schedule_start": "2019-06-26T06:40:15.076874-04:00", "show_data_source_in_player": true, "show_post_in_player_window": true, "show_publication_time": false, "show_text_in_ticker": false, "show_title_in_player": true, "subtitle": "She is awesome!", "template": "employee-recognition", "text_color": "000000", "text_layout": "auto", "title": "Let's all recognize Janey!", "uploaded_file_s3_bucket": "dive-cms-media", "uploaded_file_s3_key": "s/i/dGaDLPWSvaFt3soQAucw_convert.jpg", "uploaded_file_size_bytes": 74718, "video_filename": null, "video_url": null, "youtube_url": null } }