Add a Logo
1 |
POST https://restapi.actonsoftware.com/api/1/logo |
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
1 2 3 4 5 |
{ "status": "success", "message": "The logo has been uploaded", "id": "i-5" } |
Code Examples
1 |
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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
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(); } } } |