Readme API option

James Peret 10 年之前
父节点
当前提交
ecc3a52787
共有 1 个文件被更改,包括 46 次插入16 次删除
  1. 46 16
      README.md

+ 46 - 16
README.md

@@ -3,30 +3,53 @@ J1X Whois API
3 3
 
4 4
 A simple WHOIS lookup API.
5 5
 
6
-Based on the [Whoiz](https://github.com/okor/whoiz) by [Jason Ormand](http://jasonormand.com/2012/06/10/a-free-whois-api/) application and usging the [Ruby Whois](http://whoisrb.org/) gem.
6
+Based on the [Whoiz](https://github.com/okor/whoiz) application by [Jason Ormand](http://jasonormand.com/2012/06/10/a-free-whois-api/) and using the [Ruby Whois](http://whoisrb.org/) gem.
7 7
 
8
-How it works
9
-======
8
+## Example Domain Lookup
10 9
 
11
-Access the J1X Whois API and get a JSON response back.
10
+    {
11
+      "domain": "jamesperet.com",
12
+      "owner": "James Peret",
13
+      "registrar": "eNom Inc.",
14
+      "expires_on": "2016-06-07T16:01:00.00Z",
15
+      "update_on": "2015-05-13 00:00:00 -0300",
16
+      "registered?": true,
17
+      "available?": false
18
+    }
12 19
 
13
-Browser
20
+## Accessing the API
21
+
22
+Provide a **url** for the API and get a nicely formatted *JSON* response with the domain information.
23
+
24
+#### Browser
14 25
 
15 26
     http://whois.j1x.co
16
-    http://whois.j1x.co/lookup?url=google.com
27
+    http://whois.j1x.co/lookup.json?url=jamesperet.com
28
+
29
+#### curl
30
+
31
+    curl http://whois.j1x.co/lookup.json?url=jamesperet.com
32
+
33
+## Query Options
34
+
35
+This are the options for querying the API:
17 36
 
18
-curl
37
+* ```url``` - The domain url that will be queried. Omit the ```http://www.```.
38
+* ```raw=true``` - the *JSON* response will include a *raw* version of the data received by the **registrar**
39
+* ```dev=true``` - Only basic information and the *raw* version will be included in the *JSON* response. No parsing will be done with the data. This is useful for **debugging**.
19 40
 
20
-    curl http://whois.j1x.co/lookup.json?url=google.com
41
+Example:
21 42
 
43
+    http://whois.j1x.co/lookup.json?url=google.com&raw=true
22 44
 
23
-# Install
24 45
 
25
-### Clone
46
+## Install
47
+
48
+#### Clone
26 49
 
27 50
     git clone git://gitlab.j1x.co/j1x/whois-server.git
28 51
 
29
-### Restrict It
52
+#### Restrict It
30 53
 
31 54
 Edit ```main.rb```:
32 55
 
@@ -37,20 +60,27 @@ Edit ```main.rb```:
37 60
 Or use ```*``` to allow any website to access the API.
38 61
 
39 62
 
40
-### Deploy It
63
+#### Deploy It
41 64
 
42 65
     heroku create
43 66
     git push heroku master
44 67
     heroku open
45 68
 
46
-Development Resources
47
-=========
69
+## Domain Support
70
+
71
+For now the supported domains are: ```.com```, ```.net```, ```.com.br``` and ```.network```. Support for more domains will come in the future.
72
+
73
+The queries for ```.com.br``` domains usually come with limited information because of the registrar's API call allowance.
74
+
75
+There is also a bug where some ```.com``` domains return an error (ex: google.com).
76
+
77
+## Development Resources
48 78
 
49
-### Tools
79
+#### Tools
50 80
 
51 81
 * [Rubular](http://rubular.com/) - a Ruby regular expression editor
52 82
 
53
-### Articles
83
+#### Articles
54 84
 
55 85
 * [CORS with Angular.js and Sinatra](http://samurails.com/tutorial/cors-with-angular-js-and-sinatra/)
56 86
 * [Introducing rack-cors](http://blog.sourcebender.com/2010/06/09/introducin-rack-cors.html)