Add a Logo

POST https://restapi.actonsoftware.com/api/1/logo

This endpoint allows you to add a logo to 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}")
name Form False Required String Specify a name for the image.
alttext Form False Optional String Specify the alternative text for the image.
tooltip Form False Optional String Specify the text to display when hovering over the image.
targeturl Form False Optional String Specify the target URL for the image.
Body False Required File Attach the image file.
imagelink Form False Required String Specify the link to the image file.

Parameter Notes

You can attach a file or you can use a link (imagelink) to add an image but you can use both in the same request.

Response

{
  "status": "success",
  "message": "The logo has been uploaded",
  "id": "i-5"
}

 

Code Examples

cURLPythonJava

curl -X POST https://restapi.actonsoftware.com/api/1/logo -H "Authorization: Bearer 12345678-9abc-defg-hijk-lmnopqrs" -H "Content-Type: multipart/form-data;" -F "name=test-logo" -F file=@/Users/john.doe/Documents/logo.png

import requests
 
url = "https://restapi.actonsoftware.com/api/1/logo"
 
headers = {
'Authorization': "Bearer 12345678-9abc-defg-hijk-lmnopqrs",
}
 
data = {'name': 'test'}
 
files = {'file':('logo.jpeg', open('logo.jpeg', 'rb'))}
 
response = requests.request("POST", url, headers=headers, data = data, files = files)
 
print(response.text.encode('utf8'))

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;

import java.io.File;

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

    public static void postLogoUsingFile()
        {

        try
            {
            File file = new File("<Provide Logo image>");
            String accessToken  = Utility.getAccessToken();
            Unirest.setHttpClient(Utility.makeClient());
            Unirest.setDefaultHeader("Authorization", "Bearer " + accessToken);
            HttpResponse<String> jsonResponse = Unirest.post(BASE_URL + "logo")
                    .header("accept", "application/json")
                    .field("name", "testapipostlogo")
                    .field("alttext", "testapialttext")
                    .field("tooltip", "testapitooltip")
                    .field("targeturl", "https://www.google.com/")
                    .field("file", file)
                    .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.toString());
            }
            }
        catch (UnirestException e)
            {
            e.printStackTrace();
            }
        }

    public static void postLogoUsingImageUrl()
        {

        try
            {
            String imagelink = "<Provide image link url>";
            String accessToken  = Utility.getAccessToken();
            Unirest.setHttpClient(Utility.makeClient());
            Unirest.setDefaultHeader("Authorization", "Bearer " + accessToken);
            HttpResponse<String> jsonResponse = Unirest.post(BASE_URL + "logo")
                    .header("accept", "application/json")
                    .field("name", "testapipostlogo2")
                    .field("imagelink", imagelink)
                    .field("alttext", "testapialttext2")
                    .field("tooltip", "testapitooltip2")
                    .field("targeturl", "https://www.google.com/")
                    .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();
            }
        }

}