-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi-docs.txt
243 lines (173 loc) · 4.66 KB
/
api-docs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Goshort.in-apis
Api description for goshort.in
######################################
1. Create a short url without alias:
######################################
Alias is alternate name of short url.By default there will a unique hash generated to url. If you want your custom name then use this query param in request.
GET /api/v1/create?url=type_your_url_here HTTP/1.1
Host: goshort.in
Content-Type: application/json
Parameter :
url : weblink which you want to make short.
datatype: string
example: https://github.com/
----------------
Sample request:-
----------------
GET /api/v1/create?url=https://web.whatsapp.com/ HTTP/1.1
Host: goshort.in
Content-Type: application/json
----------------
Sample response:-
----------------
{
"hash": "T5h5li",
"message": "Short Url generated.",
"ori_url": "https://web.whatsapp.com/",
"short_url": "goshort.in/T5h5li",
"status": "success"
}
#####################################
2. Create a short url with alias:
####################################
Alias is alternate name of short url.If you want your own custom hash then use this parameter with query string in request.
GET /api/v1/create?url=type_your_url_here&alias=your_custom_name HTTP/1.1
Host: goshort.in
Content-Type: application/json
Parameter
url : weblink which you want to make short.
datatype: string
example: https://github.com/
alias: your custom name of random hash.
datatype: contain letters, numbers, and dashes.
example: github, myhash
----------------
Sample request:-
----------------
GET /api/v1/create?url=https://github.com&alias=GITHUB HTTP/1.1
Host: goshort.in
Content-Type: application/json
----------------
Sample response:-
----------------
{
"hash": "GITHUB",
"message": "Short Url generated.",
"ori_url": "https://github.com",
"short_url": "goshort.in/GITHUB",
"status": "success"
}
-------------------------
Error: Create Short Url
-------------------------
1. when query parameter url is empty:-
request:
GET /api/v1/create?url= HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"message": "Request param url is empty.",
"status": "error"
}
2. when query param url is wrong:-
request:
GET /api/v1/create?url=https://gi HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"message": "Invalid weblink in request param url.",
"status": "error"
}
3. when query param url is not passed:-
request:
GET /api/v1/create HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"message": "Request param url is missing.",
"status": "error"
}
4. when alias is duplicate or used in other url shorten.
request:
GET /api/v1/create?url=https://github.com/&alias=FRIENDS HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"alias": "FRIENDS",
"message": "Alias is already used.",
"ori_url": "https://github.com/",
"short_url": "goshort.in/FRIENDS",
"status": "error"
}
##########################
3. Track the shorten url
##########################
This api used to track the shorten url and also gives the information like click_count, original url , shorten url and a message for status.
GET /api/v1/track?hash=random_hash/alias HTTP/1.1
Host: goshort.in
Content-Type: application/json
Parameter
hash : random hash / alias for url.
datatype: string
example: FRIEND, Github
----------------
Sample request:-
----------------
GET /api/v1/track?hash=FRIEND HTTP/1.1
Host: goshort.in
Content-Type: application/json
----------------
Sample response:-
----------------
{
"click_count": 10,
"hash": "FRIEND",
"message": "Url clicked 10 times.",
"ori_url": "https://www.youtube.com/watch?v=CY8E6N5Nzec",
"short_url": "goshort.in/FRIEND",
"status": "success"
}
------------------------
Error: Track Short Url
------------------------
1. when request param hash is missing.
request:
GET /api/v1/track HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"message": "Request parameter(s) [hash] is blank or wrong.",
"status": "error"
}
2. when request param hash is blank.
request:
GET /api/v1/track?hash=blank HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"message": "Request parameter(s) [hash] is blank or wrong.",
"status": "error"
}
3. when wrong hash is passed in query param.
request:
GET /api/v1/track?hash=Randomhash HTTP/1.1
Host: goshort.in
Content-Type: application/json
response:
{
"hash": "Randomhash",
"message": "Url not found.",
"status": "error"
}
For more support:
Email:- cruzedeveloper@gmail.com
Request for new feature:
Website:- http://pinmyblogs.com/support
Email 1 :- cruzedeveloper@gmail.com
Email 2 :- pinmyblogs@gmail.com