Giter Club home page Giter Club logo

The "What ?" and the "Why ?"

Carte is a simple Jekyll based documentation website for APIs. It is designed as a boilerplate to build your own documentation and is heavily inspired from Swagger and I/O docs. Fork it, add specifications for your APIs calls and customize the theme. Go ahead, see if we care.

We built Carte because the existing options (Swagger and the likes) were trying to do too much and did not match our needs:

  1. Most of our API calls are sending JSON objects, as opposed to a series of parameters,
  2. Being able to query the real API is nice, but running anything but GET calls can get tricky ("What do you mean I deleted my stuff? I was just trying out the API calls!"),
  3. Overall, setting up a separate server for what really requires a good static documentation seemed overkill.

The real value of Carte is its structure for describing APIs, not its underlying technical stack (or lack-thereof). In a nutshell; we built a static template for your API documentation, feel free to re-use it.

Install

It' Jekyll god dammit:

  1. Clone this repository on your local,
  2. Install Jekyll,
  3. Go at the root of the repository and run jekyll serve --watch,
  4. Go to http://localhost:4000,
  5. Great success! High five!

How to...

Adding a new API call

You can add a new API call by simply adding a new post in the _posts folder. Jekyll by default forces you to specify a date in the file path: it makes us sad pandas too, but you'll have to stick to this format. You can use dates to control the order in which API calls are displayed in the interface.

Each API call can define a few values in its YAML header:

Variable Mandatory Default Description
title Y - A short description of what that calls does.
path N - The URL for the API call, including potential parameters.
type N - Set it to PUT, GET, POST, DELETE or nothing (for parts of your documentation that do not relate to an actual API call).

A typical header:

---
path: '/stuff/:id'
title: 'Delete a thing'
type: 'DELETE'

layout: nil
---

We then describe the request and response (or whatever else you wish to talk about) in the body of our post. Check the placeholders present in the _posts folder to get an idea of what it can look like.

Grouping calls

Adding a category to your YAML header will allows you to group methods in the navigation. It is particularly helpful as you start having a lot of methods and need to organize them. For example:

---
category: Stuff
path: '/stuff/:id'
title: 'Delete a thing'
type: 'DELETE'

layout: nil
---

Edit the design

The default UI is mostly described through the css/style.css file and a couple short jQuery scripts in the /_layouts/default.html layout. Hack it to oblivion.

cwp123-chan's Projects

bullshitgenerator icon bullshitgenerator

Needs to generate some texts to test if my GUI rendering codes good or not. so I made this.

chatgpt icon chatgpt

🔮 ChatGPT Desktop Application (Mac, Windows and Linux)

city icon city

中华人民共和国行政区划数据:省份、城市、区县。**省市区镇三级联动地址数据。城市经纬度数据。

docker-lnmp icon docker-lnmp

Deploying LNMP(Linux、Nginx、Mysql、PHP-FPM) using docker-compose.

gpt_academic icon gpt_academic

为ChatGPT/GLM提供实用化交互界面,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm2等本地模型。兼容文心一言, moss, llama2, rwkv, claude2, 通义千问, 书生, 讯飞星火等。

home icon home

高黎贡山生物多样性展示平台

http icon http

一个简单易用的PHP HTTP 客户端, 基于cURL封装

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.