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
Uploading a Local File

https://api.marsview.ai/cb/v1/conversation/save_file
Request
Response
Request
Headers
Content-Type
required
string
application/json
Authorization
required
string
API token with type(Bearer)
Form Data Parameters
file
required
string
The Bitstream of the audio/video file.
title
required
string
Title of the conversation.
description
required
string
Description of the conversation.
Response
200: OK
When the API responds with a status code:200 and status is true in the JSON response body. txnId can be obtained under data.txnId
{
"status": true,
"data": {
"txnId": "txn-1c6q61s0kpidmxy9-1622814136928"
}
}
403: Forbidden
When the JWT token is not valid or has expired the API responds with a status code:403 and the JSON response body will have the error message.
{
"status": false,
"error": {
"name": "JsonWebTokenError",
"message": "jwt malformed"
},
"message": "Error validating token"
}

post
Uploading via URL

https://api.marsview.ai/cb/v1/conversation/save_file_link
Request
Response
Request
Headers
Authorization
required
string
API token with type(Bearer)
application-type
required
string
application/json
Body Parameters
title
required
string
Title of the conversation
description
required
string
Description of the conversation
link
required
string
Publicly accessible URL link to the conversation
Response
200: OK
When API responds with status code:200 and status is true. txnId can be obtained under data.txnId in the JSON response body.
{
"status": true,
"data": {
"txnId": "txn-1c6q61s0kpidmxy9-1622814136928"
}
}
403: Forbidden
When the JWT token is not valid or has expired the API responds with a status code:403and the JSON response body will have the error message.
{
"status": false,
"error": {
"name": "JsonWebTokenError",
"message": "jwt malformed"
},
"message": "Error validating token"
}

Deleting a conversation

Use this API to permanently delete a conversation along with all of its metadata from the Marsview Cloud.

delete
Delete Conversation

https://api.marsview.ai/cb/v1/conversation/delete_file/:txnId
Request
Response
Request
Path Parameters
txnId
required
string
Transaction Id
Headers
Content-Type
optional
string
application-json
Authorization
required
string
API token with type(bearer)
Response
200: OK
{
"status": true,
"data": "Delete Successful"
}
403: Forbidden
{
"status": false,
"error": {
"name":"JsonWebTokenError",
"message":"jwt malformed"
},
"message":"Error validating token"
}

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
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]"
}'
Python
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
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"' \
Python
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
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]"
}'
Python
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
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"
}'
Python
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()