Writing API requests
Learn to write requests to the TwicPics media transformation API.
TwicPics is powered by a URL-based API that can be used to transform and manipulate images. When using the script or the components, the API request is generated using your browser context. But in some cases, you might want to write the API requests yourself.
In order to perform an API call to TwicPics you need to provide:
- the image or video to manipulate
- the list of transformations to be applied
The URL for an API request has the following format:
https://<sub>.twic.pics/<path_to_image>is the image path
?twic=v1/<manipulation>is a list of one or more transformations
For instance, provided the root (
/) of subdomain
<sub> points to
https://<sub>.twic.pics/myImage.png?twic=v1/resize=450 will redimension
http://mydomain.com/myimage.png to a width of 450 pixels while preserving its aspect ratio.
If you wish to pass query parameters to the server delivering the source image, just add it to the query string before or after the manipulation using the usual query string separator
Going back to the previous example but, this time, wanting to manipulate
http://mydomain.com/myimage.png?param=value you could use one of these two options: