Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Developing documentation for RESTful APIs

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Developing documentation for RESTful APIs

Or how to kill three birds with one stone

Avatar for Ilya Chesnokov

Ilya Chesnokov

February 16, 2017

More Decks by Ilya Chesnokov

Other Decks in Programming

Transcript

  1. Documentation is important • for API users – frontend developers

    – customers using our API – our techsupport and QA • for API developers – code review – further use, development and refactoring of API – documentation (design)-driven development
  2. Perl - POD • “Native” documentation format for Perl •

    Easy to learn • Simple to use • Easily parseable • Extensible (if you have fantasy)
  3. How to read docs? • perldoc • unparsed source •

    convert to HTML and read in a browser
  4. How to read docs? • perldoc – programmers only! •

    unparsed source – programmers only! • convert to HTML and read in a browser – everyone
  5. What is documented? • General description • API routes and

    methods • Input parameters • Output data – Possible errors
  6. What is documented? • General description =head1, =head2 • API

    routes and methods =head3 • Input parameters =head4, =item • Output data =head4, =item – Possible errors
  7. =head3 POST /login Loging using your credentials. =head4 Input =over

    =item username Username to login with. =item password Password to login with. =back =head4 Output ... The POD
  8. =head3 ANY /domain/:domain =head4 Output ...common output... =head3 GET /domain/:domain

    =for docviewer output-from ANY /domain/:domain =head4 Output ...specific output ... Common output
  9. Results • DDD FTW! – documentation is always up to

    date – good programming practice • Testing (by hand) becomes even more easy • No need to write an admin panel – people use API console instead