a Frapi_Response object, or an array) • Frapi serializes to requested format on output • Out of the box support for: • JSON, JSON-P, XML, PHP serialized, PHP printr, CLI (plain text) and HTML (requires custom templates) • You can disable any you don’t want to use! • Create custom outputs (such as CSV or Adobe AMF)
types and other configuration • Allows for documenting your API • Supports markdown with syntax highlighting • More documentation-related features coming • Entire interface currently being overhauled • User Interface and User Experience enhancements (UI/UX++) Best Practices: Do not deploy admin to production
set is decent (versioned documentation, etc) • Markdown syntax with extensions • Free while in beta • Has been in beta for a long... long time. • Open signup
creates mock API from documentation to write clients against • Debug console • Markdown syntax with extensions • Free while in beta • Closed signup • Lots of success tweeting them for invite codes: @apiaryio
your views Pros: Quickly piggy-back off your current code. Get an API into production now. Cons: Will likely lead to REST-like (or RESTy/RESTful) APIs that are RPC in reality.
are like URIs: They should be permanent • Don’t let bad legacy decision drive new development Do: Pretend your API is a re-write. Create the best API you can for your application. Then implement it using legacy code any way you can. Even if it sucks. Don’t: Make compromises based on old code. Instead, plan to later refactor the old code.
to use your APIs instead of legacy code. Then make the APIs better by: • Refactor the underlying implementation of your APIs to migrate away from legacy code Do: Test. Unit Tests and Integration Tests. Frisby.js is a great BDD integration testing system. Don’t: change your API! If you designed it right during the Reuse phase, this should be easy!
the time you get here, you should have full testing in place • You should have separation of concerns via SOA, so you can rewrite piecemeal Do: Discard any and all bad legacy code. Treat it as a clean slate. Don’t: Rewrite just to rewrite! Legacy code isn’t inherently bad code. Focus on new features. Build them as services!
code (Do whatever it takes!) 3. Release 4. Refactor Application to use API instead of Legacy code 5. Refactor (or Rewrite) API to not use Legacy code. 6. Reuse API in Legacy application Rewrite (or Reuse in an entirely new application!)
level than Unit Testing • Ensures your API conforms to your design • Can be used for BDD — Behavior Driver Development • Use the excellent Frisby.js by Vance Lucas: http://frisbyjs.com
Basic HTTP Authentication • auth(username,Cpassword) • Doesn’t support Digest or other types of auth • Call any HTTP method • .get(), .post(), .put(), .delete(), .head() • No PATCH support
using == • toMatch(): Comparison using RegExp • toBeDefined(), toBeUndefined(): Checks against undefined • toBeNull(): Checks for ===Cnull • toBeTruthy(), toBeFalsy(): Checks non-boolean truthfulness • toContain(): Checks for a value inside an Array • toBeGreaterThan()/toBeLessThan(): Checks < and > • toBeCloseTo(): Checks with a specified level of precision • toThrow(): Checks that a function throws an exception • Precede with not to invert, e.g.Cexpect(expr).not.toBeNull()