POST Audio/Video Files
Learn how to upload Audio/Video Files and URL
Now that you have generated the accessToken this page will guide you upload Audio/Video Files or URLs to get a unique Transaction ID txnId.

What is a Transaction ID txnID?

A Transaction ID txnId is a unique ID given to each conversation file that has been uploaded. A conversation can be an audio or a video file or downloable URL.
Upon submitting an audio/video file a unique Transaction ID txnId is returned. This can be used to refer to this particular Conversation to invoke other API calls in the Speech Analytics API.

Uploading a conversation

The source of the audio/video file can be either a local file or a URL. Depending on the source there are two different endpoints given below.
Supported Format: .mp4 .m4a .avi .mp3 .wav
post
https://api.marsview.ai
/cb/v1/conversation/save_file
Uploading a Local File
post
https://api.marsview.ai
/cb/v1/conversation/save_file_link
Uploading via URL

Deleting a conversation

Use this API to permanently delete a conversation along with all of its metadata from the Marsview Cloud.
delete
https://api.marsview.ai
/cb/v1/conversation/delete_file/:txnId
Delete Conversation
NOTE: Once deleted the conversation and its metadata will be permanently deleted and cannot be recovered.

Example: How to upload a local Audio/Video File?

Step 1: Get the authentication token accessToken.

Using yourapiKeyand apiSecretyou can generate the accessToken as shown below.
Curl
Python
curl --location --request POST 'https://api.marsview.ai/cb/v1/auth/create_access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"apiKey": "{{Insert API Key}}",
"apiSecret": "{{Insert API Secret}}",
"userId": "[email protected]"
}'
import requests
url = "https://api.marsview.ai/cb/v1/auth/get_access_token"
payload={"apiKey":"Insert API Key",
"apiSecret":"Insert API Secret",
"userId":"[email protected]"}
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, json=payload)
#This request will give you a JWT token that needs to be provided in further requests
# For user authentication.
print(response.text)

Step 2: Upload a local audio/video file.

Upload a local audio/video file as shown below. Fill in the FILE_PATH , TITLE and DESCRIPTION for the audio/video file.
Curl
Python
curl --location --request POST 'https://api.marsview.ai/cb/v1/conversation/save_file' \
--header 'Content-Type: multipart/form-data' \
--header 'authorization: {{Insert authToken with type}}' \
--form '[email protected]"/Videos/test_api/ppt_tips.mp3"' \
--form 'title="Sample Meeting"' \
--form 'description="A Sample local file"' \
import requests
import magic
mime = magic.Magic(mime=True)
auth_token = "Bearer <API TOKEN>"
def upload_file():
# Give the path to your file here, the path should be realtive to where
#you are running this code snipper from.
FILE_PATH = "./files/sample.mp4"
TITLE = "Sample Title"
DESCRIPTION = "Sample Description"
file_name = FILE_PATH.split("/")[-1]
url = "https://api.marsview.ai/cb/v1/conversation/save_file"
payload={
'title': TITLE,
'description': DESCRIPTION }
files=[
('file',(file_name, open(FILE_PATH,'rb'), mime.from_file(FILE_PATH)))
]
print(files)
headers = {
'authorization': auth_token
}
print(url)
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
if __name__ == "__main__":
upload_file()

Example: How to upload a public URL or an s3 Presigned URL?

Step 1: Get the authentication token.

Using your apiKey and apiSecretyou can generate the accessToken as shown below.
Curl
Python
curl --location --request POST 'https://api.marsview.ai/cb/v1/auth/create_access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"apiKey": "{{Insert API Key}}",
"apiSecret": "{{Insert API Secret}}",
"userId": "[email protected]"
}'
import requests
userId = 'Paste the user ID here'
apiKey = 'Paste the API key here'
apiSecret = 'Paste the API secret here'
def get_token():
url = "https://api.marsview.ai/cb/v1/auth/create_access_token"
payload={"apiKey":apiKey,
"apiSecret":apiSecret,
"userId":userId}
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)
if __name__ == "__main__":
get_token()

Step 2: Create an s3 pre-signed URL or use a public URL.

In this example, we will use a public URL and upload it to Marsview Conversation intelligence APIs
For more information on how to create an s3 pre-signed URL refer to AWS Documentation
Please keep a minimum 20 minutes expiry on the pre-signed URL for ensuring a higher success rate of processing. In case the URL has already expired by the time Marsview picks up the request the compute API will return a Failure status with status code AIRDOW002
Curl
Python
curl --location --request POST 'https://api.marsview.ai/cb/v1/conversation/save_file_link' \
--header 'Content-Type: application/json' \
--header 'authorization: {{Authentication Token}}' \
--data-raw '{
"title":"Recruitment Meeting",
"description":"A sample interview meeting",
"link": "https://d1sv72xa22bi8g.cloudfront.net/api-samples/Recruitment+Meeting.mp4"
}'
import requests
userId = "replace this with your user ID"
auth_token = "Bearer <API TOKEN>"
def upload_file():
url = "https://api.marsview.ai/cb/v1/conversation/save_file_link"
payload= {
"title":"Recruitment Meeting",
"description":"A sample interview meeting",
"link":"https://d1sv72xa22bi8g.cloudfront.net/api-samples/Recruitment+Meeting.mp4"
}
headers = {
'Content-Type': 'application/json',
'authorization': auth_token
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)
if __name__ == "__main__":
upload_file()