| GET,POST | /url_shortener |
|---|
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports WS_RESTRICTED_API
Namespace Global
Namespace WS_RESTRICTED_API
Public Enum operationType
<EnumMember(Value:="0x4E71")>
NoOperation
<EnumMember(Value:="ShortenUrl")>
ShortenUrl
<EnumMember(Value:="GetOriginalUrl")>
GetOriginalUrl
<EnumMember(Value:="RedirectUrl")>
RedirectUrl
End Enum
Public Partial Class url_shortener
'''<Summary>
'''operation type
'''</Summary>
<ApiMember(DataType:="string", Description:="operation type", IsRequired:=true, Name:="operation", ParameterType:="body")>
Public Overridable Property operation As operationType?
'''<Summary>
'''url
'''</Summary>
<ApiMember(DataType:="string", Description:="url", IsRequired:=true, Name:="url", ParameterType:="body")>
Public Overridable Property url As String
'''<Summary>
'''days to expire
'''</Summary>
<ApiMember(DataType:="string", Description:="days to expire", Name:="days", ParameterType:="body")>
Public Overridable Property days As Double?
End Class
Public Partial Class url_shortenerResponse
Public Overridable Property tiny_url As String
Public Overridable Property original_url As String
Public Overridable Property created_date As Date
Public Overridable Property expiry_date As Date?
Public Overridable Property collision As Integer?
End Class
End Namespace
End Namespace
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}