SetScreenshot
Description
The SetScreenshot method specifies the current screenshot to use for the current page.
Parameters
- Image (required): the image data to use for the screenshot. Any supported format can be used: BMP, JPG, PNG, JPEG, WBMP, GIF, etc.
- ApiKey (optional): To authenticate the command. Required if enabled on the Controller.
REST example
Binary images have to be encoded using Base64 format.
POST http://localhost:7400/Design/v1/Service.svc/SetScreenshot HTTP/1.1Accept: application/jsonContent-Type:application/jsonCache-Control:nocachePragma: nocacheUser-Agent:Java/1.7.0_10Host: localhost:7400Connection: keepaliveContent-Length:207{"d": {"Image": "iVBORw0KGgoAAAANSUhEUgAAAHgAAAAbCAIAAAA4ZtxxAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACMBJREFUeNrsWX9wFNUd3729zV2Sy10wkAAhyRkCJWMgWNQqOPLDaZzQTklwOsYpQmwdix1b4yD+5UDofxU70mkppXVsLHa0fxRibWWgmtJCGHEkAmYwkIAXKJCLkHiXu9zt7b63fnZfsrfc7V0uCbT+cS8vN3u7b9++93mf9/l+vnu8qqpcBuXsuQFO5dCWqirqfG+RK9/BZUvGhU8P9Pm+wQ/+0/vx2SuEqgqhMiGSTCMKichkpstRv3xBU8PdBa4s4tMGOhKRf/PasUv+ANVQpjEFQCtRmYyixpRQTMkRbB/++Wme57NQpi82y7PXAj3sIDdXfPapB8uK3bkOe57Dnptjd4p2h11wCDat2oWwTHr7rlNKs1CmL/bkU/1Dp84PHJ3jWWRgvemxe3f/8RhEQ98BHIFMUxDcJhIq2vhQSFI5XlGoINgmZPaR05fZgXe221visWxz6sLglyFp6fziQpeDHafqDQ3QjB2jGRrr7aPjV524yvoxPzpNwajQD2qa4bEH4cAYoW8gwM6wsqq2PPn2RKB9N7q6Lr8z111tPllSUlD30Df+efS8OgaxIAvUrlXebuM5/PFapIxFgqLI2UR3mpmsfuFtdlBbWXxq7ybLNi2/7fj3mcv/eqVpVW0ZO07V28olZUd+2cRu+dWBk6mabX9ieevGFcaj0xS0xOeOfcc9+Q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zjQY4kJUM6Z2VR038tZlNOUlL+CQ6MlSZEVQq53jnZv1OOhjrIeEuP3O6oLFm51z1+fhXKKQJvhDnSuU0LHEy6JRU3OuXWeLMS3BGjTm6VA9EYPa2p3uCeb+2XLVwIMAD8HSVqGuof+AAAAAElFTkSuQmCC"}}Use case with Command Line Designer
- Note: The Image argument is the absolute path of the image.
java -cp "api/Common/java/*;api/Design API Client/java/*" com.neotys.rest.design.client.CommandLineDesigner -designAPIURL http://localhost:7400/Design/v1/Service.svc/ -command SetScreenshot -Image C:\tmp\image.jpgUse case with Java Client Designer
import java.io.File;import javax.imageio.ImageIO;import com.neotys.rest.design.client.DesignAPIClient;import com.neotys.rest.design.client.DesignAPIClientFactory;import com.neotys.rest.design.model.SetScreenshotParams;public class Main {public static void main(String[] args) throws Exception {final String url = "http://localhost:7400/Design/v1/Service.svc";final DesignAPIClient client = DesignAPIClientFactory.newClient(url);final String imagePath = "imagePath";final File imageFile = new File(imagePath);final SetScreenshotParams setScreenshot = new SetScreenshotParams(ImageIO.read(imageFile));client.setScreenshot(setScreenshot);}}Use case with C#Client
using Neotys.DesignAPI.Client;using Neotys.DesignAPI.Model;using System.Drawing;using System.IO;namespace Design{class SetScreenshot{static void Main(string[] args){string url = "http://localhost:7400/Design/v1/Service.svc/";IDesignAPIClient client = DesignAPIClientFactory.NewClient(url);Image img = Image.FromFile(@"imagePath");byte[] array;using (MemoryStream ms = new MemoryStream()){img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);array = ms.ToArray();}client.SetScreenshot(new SetScreenshotParams(array));}}}
Home