Get Media File

GET https://restapi.actonsoftware.com/api/1/media/{id}

This endpoint allows you to pull a specific media file from the account.

Parameters

Name Parameter
Type
Allow
Multiple
Required/
Optional
Data Type Description
Authorization: Header false Required String Insert your generated access token.
(Bearer {access token})
id Path False Required String Specify the ID of the media file.

Response

{
  "id": "u-805c570d-d877-4105-899b-bae5f132b57f",
  "name": "Act-ON",
  "url": "http://ci87.actonsoftware.com/cdnr/87/acton/attachment/42152/u-805c570d-d877-4105-899b-bae5f132b57f/1/-/-/-/-/",
  "target_url": "https://www.act-on.com",
  "creation_time": 1569537233128,
  "last_modified": 1569537233128
}

 

Code Examples

curl -X GET https://restapi.actonsoftware.com/api/1/media/u-805c570d-d877-4105-899b-bae5f132b57f -H "Authorization: Bearer 12345678-9abc-defg-hijk-lmnopqrs"
package content;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import org.json.JSONObject;
import util.Utility;

public class GetMediaExample
{
	static String BASE_URL         = "https://restapi.actonsoftware.com/api/1/";
	public static void main(String[] args)
		{
				getMedia();
				getMediaById();
		}

	public static void getMedia()
		{
		try
			{
			String accessToken  = Utility.getAccessToken();
			Unirest.setHttpClient(Utility.makeClient());
			Unirest.setDefaultHeader("Authorization", "Bearer " + accessToken);
			HttpResponse jsonResponse = Unirest.get(BASE_URL+"media")
					.header("accept", "application/json")
					.asString();

			if(jsonResponse.getCode()==200){
				String jsonResponseBody = jsonResponse.getBody();
				System.out.println("The response body is : "+jsonResponseBody );
			}else {
				System.out.println("The response is : "+ jsonResponse);
			}

			}
		catch (UnirestException e)
			{
			e.printStackTrace();
			}
		}

	public static void getMediaById()
		{
		try
			{
			String accessToken  = Utility.getAccessToken();
			String id = "";
			Unirest.setHttpClient(Utility.makeClient());
			Unirest.setDefaultHeader("Authorization", "Bearer " + accessToken);
			HttpResponse jsonResponse = Unirest.get(BASE_URL+"media/"+id)
					.header("accept", "application/json")
					.asString();

			if(jsonResponse.getCode()==200){
				String jsonResponseBody = jsonResponse.getBody();
				System.out.println("The response body is : "+jsonResponseBody );
			}else {
				System.out.println("The response is : "+ jsonResponse);
			}

			}
		catch (UnirestException e)
			{
			e.printStackTrace();
			}
		}
}