Get List of Assets
GET https://restapi.actonsoftware.com/api/1/list
This endpoint allows you to pull a list of assets that include data such as the name and ID associated with the asset.
Parameters
Name | Parameter Type |
Allow Multiple |
Required/ Optional |
Data Type | Description |
---|---|---|---|---|---|
Authorization: | Header | False | Required | String | Insert your generated access token. (Bearer {access token}) |
listingtype | Query | false | Optional | String | Specify the type of assets to pull using one of the following values. ("contact_list", "header", "footer", "sender", "media", "pages", "custom_events", "template_message", "draft_message", "landing_page", "sent_message", "triggered_message", "test_message", "failed_message", "scheduled_message") |
count | Query | false | Optional | String | Specify the number of elements to fetch. (Maximum=1000) |
offset | Query | False | Optional | String | Specify the element offset to begin the fetch. (Default=0) |
Response
[ { "entries": [ { "creation_time": "1570517373000", "modified": "1570517373000", "id": "p-0002", "title": "Exampletest", "url": "https://ci61.actonservice.com/acton/fs/blocks/showLandingPage/a/42415/p/p-0002/t/page/fm/0", "tags": "[]" } ], "folder": "Default Folder" } ]
Code Examples
cURLPythonJava
curl -X GET https://restapi.actonsoftware.com/api/1/list?listingtype=CONTACT_LIST -H "Authorization: Bearer 12345678-9abc-defg-hijk-lmnopqrs"
import requests url = "https://restapi.actonsoftware.com/api/1/list?listingtype=CONTACT_LIST" payload = {} headers = { 'Authorization': 'Bearer 12345678-9abc-defg-hijk-lmnopqrs' } response = requests.request("GET", url, headers=headers, data = payload) print(response.text.encode('utf8'))
package com.acton.api.client.endpoint; 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; public class ListExample { static String BASE_URL = "https://restapi.actonsoftware.com/"; static String ACTON_USERNAME = ""; static String ACTON_PASSWORD = ""; static String CLIENT_ID = ""; static String CLIENT_SECRET = ""; public static void main(String[] args) { try { String access_token = getAccessToken(); Unirest.setDefaultHeader("Authorization", "Bearer " + access_token); printListCount(); } catch (UnirestException e) { e.printStackTrace(); } } /* * This method used GET list listing api, and prints the total number of lists. */ private static void printListCount() throws UnirestException { HttpResponse listResponse = Unirest.get(BASE_URL + "/api/1/list").asJson(); System.out.println("Total number of lists : " + listResponse.getBody().getObject().getInt("totalCount")); } /* * This is a utilty method to get access token */ private static String getAccessToken() throws UnirestException { //POST to token url with password grant_type to get token. HttpResponse jsonResponse = Unirest.post(BASE_URL + "token") .header("accept", "application/json") .field("grant_type", "password") .field("username", ACTON_USERNAME) .field("password", ACTON_PASSWORD) .field("client_id", CLIENT_ID) .field("client_secret", CLIENT_SECRET) .asJson(); //Strip access_token from response and return it. return jsonResponse.getBody().getObject().getString("access_token"); } }