diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3eefbecc6c6..c7c058cab40 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,9 @@ name: Deploy on: push: - branches: [ 'main' ] + branches: + - 'main' + - 'master' jobs: deploy: @@ -15,6 +17,20 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 2.7 + + - name: Set up s3cmd + run: | + python -m pip install --upgrade pip + pip install s3cmd + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -36,9 +52,13 @@ jobs: - run: bundle exec middleman build - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build - keep_files: true + - name: sync folder with cdn + env: + AWS_ACCESS_KEY_ID: ${{ secrets.CDN_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_SECRET_ACCESS_KEY }} + run: | + s3cmd -c ./do/.s3cfg sync --acl-public ./build/ --delete-removed s3://api-docs --no-preserve --no-mime-magic --guess-mime-type -v + - name: purge cdn cache + run: | + doctl compute cdn flush 0375d09b-1263-4413-a455-dea4f028a3d2 + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 6c511807b22..00000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Publish Docker image - -on: - release: - types: [published] - -jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: all - - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: slatedocs/slate - tags: | - type=ref,event=tag - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_ACCESS_KEY }} - - - name: Push to Docker Hub - uses: docker/build-push-action@v2 - with: - builder: ${{ steps.buildx.outputs.name }} - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64,linux/ppc64le - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/Gemfile.lock b/Gemfile.lock index bd60f7f66e1..a9e5082428e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -94,7 +94,7 @@ GEM parslet (2.0.0) public_suffix (4.0.6) racc (1.6.0) - rack (2.2.3) + rack (2.2.3.1) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) diff --git a/do/.s3cfg b/do/.s3cfg new file mode 100644 index 00000000000..259f3afdc2f --- /dev/null +++ b/do/.s3cfg @@ -0,0 +1,83 @@ +[default] +access_key = +access_token = +add_encoding_exts = +add_headers = +bucket_location = US +ca_certs_file = +cache_file = +check_ssl_certificate = True +check_ssl_hostname = True +cloudfront_host = cloudfront.amazonaws.com +connection_pooling = True +content_disposition = +content_type = +default_mime_type = binary/octet-stream +delay_updates = False +delete_after = False +delete_after_fetch = False +delete_removed = False +dry_run = False +enable_multipart = True +encoding = UTF-8 +encrypt = False +expiry_date = +expiry_days = +expiry_prefix = +follow_symlinks = False +force = False +get_continue = False +gpg_command = None +gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s +gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s +gpg_passphrase = +guess_mime_type = True +host_base = nyc3.digitaloceanspaces.com +host_bucket = %(bucket)s.nyc3.digitaloceanspaces.com +human_readable_sizes = False +invalidate_default_index_on_cf = False +invalidate_default_index_root_on_cf = True +invalidate_on_cf = False +kms_key = +limit = -1 +limitrate = 0 +list_md5 = False +log_target_prefix = +long_listing = False +max_delete = -1 +mime_type = +multipart_chunk_size_mb = 15 +multipart_max_chunks = 10000 +preserve_attrs = True +progress_meter = True +proxy_host = +proxy_port = 0 +public_url_use_https = False +put_continue = False +recursive = False +recv_chunk = 65536 +reduced_redundancy = False +requester_pays = False +restore_days = 1 +restore_priority = Standard +secret_key = +send_chunk = 65536 +server_side_encryption = False +signature_v2 = False +signurl_use_https = False +simpledb_host = sdb.amazonaws.com +skip_existing = False +socket_timeout = 300 +stats = False +stop_on_error = False +storage_class = +throttle_max = 100 +upload_id = +urlencoding_mode = normal +use_http_expect = False +use_https = True +use_mime_magic = True +verbosity = WARNING +website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/ +website_error = +website_index = index.html diff --git a/source/index.html.md b/source/index.html.md index db246274bba..1a4aa8cb753 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -19,85 +19,147 @@ search: true code_clipboard: true meta: - - name: description - content: Documentation for the Kittn API + - name: Lix's Real Time API + content: Documentation for the Lix API --- # Introduction -Welcome to the Kittn API! You can use our API to access Kittn API endpoints, which can get information on various cats, kittens, and breeds in our database. +Welcome to Lix's API! You can use this API to access all our API endpoints, such as the Person API to look up email addresses, or the Company API to look up company information related to a domain name. -We have language bindings in Shell, Ruby, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. +The API is organized around REST. All requests should be made over SSL. All request and response bodies, including errors, are encoded in JSON. -This example API documentation page was created with [Slate](https://github.com/slatedocs/slate). Feel free to edit it and use it as a base for your own API's documentation. +We also have some specific language bindings to make integration easier. You can switch the programming language of the examples with the tabs in the top right. + +Currently we support the following official client bindings: + +- Node +- Python +- Go +- Javascript +- Java + +Should you have further questions, feel free to contact our tech team via help@lix-it.com. # Authentication > To authorize, use this code: ```ruby -require 'kittn' +require 'lix' -api = Kittn::APIClient.authorize!('meowmeowmeow') +api = Lix::APIClient.authorize!('lixApiKey') ``` ```python -import kittn +import lix -api = kittn.authorize('meowmeowmeow') +api = lix.authorize('lixApiKey') ``` ```shell # With shell, you can just pass the correct header with each request curl "api_endpoint_here" \ - -H "Authorization: meowmeowmeow" + -H "Authorization: lixApiKey" ``` ```javascript -const kittn = require('kittn'); +const lix = require('lix'); -let api = kittn.authorize('meowmeowmeow'); +let api = lix.authorize('lixApiKey'); ``` -> Make sure to replace `meowmeowmeow` with your API key. +> Make sure to replace `lixApiKey` with your API key. + +Lix uses API keys to allow access to the API. Should you not have an API Token yet, please [mailto:help@lix-it.com]contact our sales team to receive one. + +Lix expects for the API key to be included in all API requests to the server in a header that looks like the following: -Kittn uses API keys to allow access to the API. You can register a new Kittn API key at our [developer portal](http://example.com/developers). +`Authorization: lixApiKey` -Kittn expects for the API key to be included in all API requests to the server in a header that looks like the following: +or with a query variable: + +`https://api.lix-it.com/v1/person?profile=alfie-lambert&api_key=lixApiKey` + +Please bear in mind to also specify the Content-Type as application/json format. -`Authorization: meowmeowmeow` -# Kittens +# Response Codes +## HTTP Status Codes +Our API returns standard HTTP success or error status codes as listed below. For errors, we will also include extra information about what went wrong encoded in the response as JSON. The various HTTP status codes we might return are listed below. + +CODE | TITLE | DESCRIPTION +----- | ---- | ----------- +200 | Success | The request was successful +400 | Bad Request | The request data has not been provided correctly +401 | Unauthorized | Your API key is not authorised to access this endpoint +402 | Over quota | Over plan quota on this endpoint. Please top-up your account or [mailto:] speak to sales to increase your quota. +404 | Not found | The endpoint does not exist +429 | Too Many Requests | The rate limit was exceeded +500 | Internal Server Error | An error occurred on the server. Should this error persis, please contact our technical team. +503 | Service Unavailable | The API is temporarily unavailable + +## Error types +All errors are returned in the form of JSON with a type and optional message. + +> Example error response: + +``` + { + "error": { + "type": "params_invalid", + "message": "profile_id is required" + } + } +``` + +Type | Description +---- | ------------ +params_invalid | Your parameters were not valid +unknown_record | Record was not found +unknown_route | URL was not valid +queued | Lookup queued. Try this request again in a few minutes +rate_limit | The request has been rate limited +api_error | Internal API error + + +# Profiles API + +This section describes the data you can expect from each returned profile. The same profile data structure will be returned from multiple profile collection endpoints as described below. Each profile is equivalent to 1 credit. + + -## Get All Kittens +## Profile Schema ```ruby -require 'kittn' +require 'lix' -api = Kittn::APIClient.authorize!('meowmeowmeow') +api = Lix::APIClient.authorize!('lixApiKey') api.kittens.get ``` ```python -import kittn +import lix -api = kittn.authorize('meowmeowmeow') +api = lix.authorize('lixApiKey') api.kittens.get() ``` ```shell curl "http://example.com/api/kittens" \ - -H "Authorization: meowmeowmeow" + -H "Authorization: lixApiKey" ``` ```javascript -const kittn = require('kittn'); +const lix = require('lix'); -let api = kittn.authorize('meowmeowmeow'); +let api = lix.authorize('lixApiKey'); let kittens = api.kittens.get(); ``` @@ -142,28 +204,28 @@ Remember — a happy kitten is an authenticated kitten! ## Get a Specific Kitten ```ruby -require 'kittn' +require 'lix' -api = Kittn::APIClient.authorize!('meowmeowmeow') +api = Lix::APIClient.authorize!('lixApiKey') api.kittens.get(2) ``` ```python -import kittn +import lix -api = kittn.authorize('meowmeowmeow') +api = lix.authorize('lixApiKey') api.kittens.get(2) ``` ```shell curl "http://example.com/api/kittens/2" \ - -H "Authorization: meowmeowmeow" + -H "Authorization: lixApiKey" ``` ```javascript -const kittn = require('kittn'); +const lix = require('lix'); -let api = kittn.authorize('meowmeowmeow'); +let api = lix.authorize('lixApiKey'); let max = api.kittens.get(2); ``` @@ -196,29 +258,29 @@ ID | The ID of the kitten to retrieve ## Delete a Specific Kitten ```ruby -require 'kittn' +require 'lix' -api = Kittn::APIClient.authorize!('meowmeowmeow') +api = Lix::APIClient.authorize!('lixApiKey') api.kittens.delete(2) ``` ```python -import kittn +import lix -api = kittn.authorize('meowmeowmeow') +api = lix.authorize('lixApiKey') api.kittens.delete(2) ``` ```shell curl "http://example.com/api/kittens/2" \ -X DELETE \ - -H "Authorization: meowmeowmeow" + -H "Authorization: lixApiKey" ``` ```javascript -const kittn = require('kittn'); +const lix = require('lix'); -let api = kittn.authorize('meowmeowmeow'); +let api = lix.authorize('lixApiKey'); let max = api.kittens.delete(2); ```