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
1
curl --location --request POST 'https://api.marsview.ai/cb/v1/auth/create_access_token' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"apiKey": "{{Insert API Key}}",
5
"apiSecret": "{{Insert API Secret}}",
6
"userId": "[email protected]"
7
}'
Copied!
1
import requests
2
​
3
url = "https://api.marsview.ai/cb/v1/auth/get_access_token"
4
​
5
payload={"apiKey":"Insert API Key",
6
"apiSecret":"Insert API Secret",
7
"userId":"[email protected]"}
8
headers = {
9
'Content-Type': 'application/json'
10
}
11
​
12
response = requests.request("POST", url, headers=headers, json=payload)
13
#This request will give you a JWT token that needs to be provided in further requests
14
# For user authentication.
15
print(response.text)
Copied!

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
1
curl --location --request POST 'https://api.marsview.ai/cb/v1/conversation/save_file' \
2
--header 'Content-Type: multipart/form-data' \
3
--header 'authorization: {{Insert authToken with type}}' \
4
--form '[email protected]"/Videos/test_api/ppt_tips.mp3"' \
5
--form 'title="Sample Meeting"' \
6
--form 'description="A Sample local file"' \
Copied!
1
import requests
2
import magic
3
​
4
mime = magic.Magic(mime=True)
5
​
6
​
7
auth_token = "Bearer <API TOKEN>"
8
​
9
def upload_file():
10
​
11
​
12
​
13
# Give the path to your file here, the path should be realtive to where
14
#you are running this code snipper from.
15
FILE_PATH = "./files/sample.mp4"
16
TITLE = "Sample Title"
17
DESCRIPTION = "Sample Description"
18
​
19
file_name = FILE_PATH.split("/")[-1]
20
url = "https://api.marsview.ai/cb/v1/conversation/save_file"
21
payload={
22
'title': TITLE,
23
'description': DESCRIPTION }
24
​
25
files=[
26
('file',(file_name, open(FILE_PATH,'rb'), mime.from_file(FILE_PATH)))
27
]
28
print(files)
29
headers = {
30
'authorization': auth_token
31
}
32
print(url)
33
response = requests.request("POST", url, headers=headers, data=payload, files=files)
34
print(response.text)
35
36
if __name__ == "__main__":
37
upload_file()
Copied!

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
1
curl --location --request POST 'https://api.marsview.ai/cb/v1/auth/create_access_token' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"apiKey": "{{Insert API Key}}",
5
"apiSecret": "{{Insert API Secret}}",
6
"userId": "[email protected]"
7
}'
Copied!
1
import requests
2
​
3
userId = 'Paste the user ID here'
4
apiKey = 'Paste the API key here'
5
apiSecret = 'Paste the API secret here'
6
​
7
def get_token():
8
​
9
url = "https://api.marsview.ai/cb/v1/auth/create_access_token"
10
​
11
payload={"apiKey":apiKey,
12
"apiSecret":apiSecret,
13
"userId":userId}
14
headers = {
15
'Content-Type': 'application/json'
16
}
17
​
18
response = requests.request("POST", url, headers=headers, json=payload)
19
print(response.text)
20
21
if __name__ == "__main__":
22
get_token()
Copied!

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
1
curl --location --request POST 'https://api.marsview.ai/cb/v1/conversation/save_file_link' \
2
--header 'Content-Type: application/json' \
3
--header 'authorization: {{Authentication Token}}' \
4
--data-raw '{
5
"title":"Recruitment Meeting",
6
"description":"A sample interview meeting",
7
"link": "https://d1sv72xa22bi8g.cloudfront.net/api-samples/Recruitment+Meeting.mp4"
8
}'
Copied!
1
import requests
2
​
3
userId = "replace this with your user ID"
4
auth_token = "Bearer <API TOKEN>"
5
​
6
​
7
def upload_file():
8
url = "https://api.marsview.ai/cb/v1/conversation/save_file_link"
9
​
10
payload= {
11
"title":"Recruitment Meeting",
12
"description":"A sample interview meeting",
13
"link":"https://d1sv72xa22bi8g.cloudfront.net/api-samples/Recruitment+Meeting.mp4"
14
}
15
​
16
headers = {
17
'Content-Type': 'application/json',
18
'authorization': auth_token
19
}
20
​
21
response = requests.request("POST", url, headers=headers, json=payload)
22
​
23
print(response.text)
24
25
if __name__ == "__main__":
26
upload_file()
Copied!