Upload or Replace Media
Uploads a file the normal HTTP way. You may add headers to the request in order to provide some control to your media-file.
Request URL
PUT
https://api.catapult.inetwork.com/v1/users/{userId}/media/{mediaName}
Properties
Header | Description | Mandatory |
---|---|---|
Content-Length | Indicates the size of the entity-body. | Yes |
Cache-Control | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | No |
Content-Type | The media type of the entity-body. | No |
Example 1 of 1: Upload an MP3 File
curl -v -X PUT https://api.catapult.inetwork.com/v1/users/{your_user_id}/media/{file.mp3} -H "Content-Type: audio/mpeg" -u {{token}}:{{secret}} --data-binary "@{/filepath/file.mp3}"
client.Media.upload("file.mp3").
then(function (media) {
console.log(media);
});
await client.Media.UploadAsync(new UploadMediaData{
MediaName = "file.mp3",
Path = "/path/to/file.mp3",
ContentType = "audio/mp3"
}
);
Media.upload(client, "file.mp3", File.open("/path/to/file.mp3"), "audio/mp3")
The above command returns an HTTP 200 response