| GET,POST | /url_shortener |
|---|
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
public static class url_shortener
{
/**
* operation type
*/
@ApiMember(DataType="string", Description="operation type", IsRequired=true, Name="operation", ParameterType="body")
public operationType operation = null;
/**
* url
*/
@ApiMember(DataType="string", Description="url", IsRequired=true, Name="url", ParameterType="body")
public String url = null;
/**
* days to expire
*/
@ApiMember(DataType="string", Description="days to expire", Name="days", ParameterType="body")
public Double days = null;
public operationType getOperation() { return operation; }
public url_shortener setOperation(operationType value) { this.operation = value; return this; }
public String getUrl() { return url; }
public url_shortener setUrl(String value) { this.url = value; return this; }
public Double getDays() { return days; }
public url_shortener setDays(Double value) { this.days = value; return this; }
}
public static enum operationType
{
NoOperation,
ShortenUrl,
GetOriginalUrl,
RedirectUrl;
}
public static class url_shortenerResponse
{
public String tiny_url = null;
public String original_url = null;
public Date created_date = null;
public Date expiry_date = null;
public Integer collision = null;
public String getTinyUrl() { return tiny_url; }
public url_shortenerResponse setTinyUrl(String value) { this.tiny_url = value; return this; }
public String getOriginalUrl() { return original_url; }
public url_shortenerResponse setOriginalUrl(String value) { this.original_url = value; return this; }
public Date getCreatedDate() { return created_date; }
public url_shortenerResponse setCreatedDate(Date value) { this.created_date = value; return this; }
public Date getExpiryDate() { return expiry_date; }
public url_shortenerResponse setExpiryDate(Date value) { this.expiry_date = value; return this; }
public Integer getCollision() { return collision; }
public url_shortenerResponse setCollision(Integer value) { this.collision = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /url_shortener HTTP/1.1
Host: milliet.io
Accept: application/json
Content-Type: application/json
Content-Length: length
{"operation":"0x4E71","url":"String","days":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"tiny_url":"String","original_url":"String","created_date":"0001-01-01T00:00:00.0000000","expiry_date":"0001-01-01T00:00:00.0000000","collision":0}