| GET,POST | /url_shortener |
|---|
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using WS_RESTRICTED_API;
namespace WS_RESTRICTED_API
{
public enum operationType
{
[EnumMember(Value="0x4E71")]
NoOperation,
[EnumMember(Value="ShortenUrl")]
ShortenUrl,
[EnumMember(Value="GetOriginalUrl")]
GetOriginalUrl,
[EnumMember(Value="RedirectUrl")]
RedirectUrl,
}
public partial class url_shortener
{
///<summary>
///operation type
///</summary>
[ApiMember(DataType="string", Description="operation type", IsRequired=true, Name="operation", ParameterType="body")]
public virtual operationType? operation { get; set; }
///<summary>
///url
///</summary>
[ApiMember(DataType="string", Description="url", IsRequired=true, Name="url", ParameterType="body")]
public virtual string url { get; set; }
///<summary>
///days to expire
///</summary>
[ApiMember(DataType="string", Description="days to expire", Name="days", ParameterType="body")]
public virtual double? days { get; set; }
}
public partial class url_shortenerResponse
{
public virtual string tiny_url { get; set; }
public virtual string original_url { get; set; }
public virtual DateTime created_date { get; set; }
public virtual DateTime? expiry_date { get; set; }
public virtual int? collision { get; set; }
}
}
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}