Media - Update
- 04 Jan 2024
- 1 Minute to read
- Print
- DarkLight
Media - Update
- Updated on 04 Jan 2024
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Update Media
Endpoint
POST /1/media/{media_id}
Host: https://api.cogniac.io
#!/bin/bash
curl -X POST https://api.cogniac.io/1/media/QBCYGH2LACG4IDFQLRXJVIE1BWWH \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-f '{
"media_src":"twitter"
}' | json_pp
import requests
import json
from pprint import pprint
url_prefix = 'https://api.cogniac.io'
api_version = "1"
media_id = 'QBCYGH2LACG4IDFQLRXJVIE1BWWH'
token = 'abcdefg.hijklmnop.qrstuvwxyz' # add your token here
headers = {'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'} # Fixed the headers
media_data = {
"media_src":"twitter again",
}
url = f'{url_prefix}/{api_version}/media/{media_id}'
res = requests.post(url, json=media_data, headers=headers)
# Check if the request was successful
if res.status_code == 200:
response_data = json.loads(res.content)
pprint(response_data)
else:
print(f"Error: {res.status_code}, {res.text}")
Example Response
{
"media_id":"952jkasdf",
"media_format":"jpg",
"media_src":"twitter",
"media_url":"https://www.api.cogniac.io/1/media/fullsize/952jkasdf.jpg",
"media_timestamp":"240242525", //user-specified
"public":true,
"video": False,
"meta_tags": [
"test@cogniac.co",
"mobile",
"iPhone 6+",
"9.2",
"v2.1"
],
"created_at": 1455044755, //time media was saved in table, auto-generated
"uploaded_by_user":"test@cogniac.co", //user that uploaded public media
"uploaded_by_tenant":"5968u3hsdf" //tenant that uploaded public media
}
Was this article helpful?