Slide 1

Slide 1 text

Working with 3rd Party APIs #Loopconf 2015 - Las Vegas

Slide 2

Slide 2 text

About Me Mike Hansen Open Source Team at Bluehost WordPress Core Contributor @MikeHansenMe mikehansen.me

Slide 3

Slide 3 text

An Idea Ideas are great but execution can be problematic.

Slide 4

Slide 4 text

Finding the API or Creating it

Slide 5

Slide 5 text

What To Look For Documentation How much is it being used How do they support old version

Slide 6

Slide 6 text

Workers or Products What is the difference?

Slide 7

Slide 7 text

How does WordPress Help HTTP API Option Transients Meta WP_Error more..

Slide 8

Slide 8 text

Fetching Data

Slide 9

Slide 9 text

Error Handling Deal with WP_Errors first then confirm the response is also a success.

Slide 10

Slide 10 text

Preparing Data Make lots of checks

Slide 11

Slide 11 text

Storing Data Transients Options User Meta Post Meta

Slide 12

Slide 12 text

Transients Transients work as a fallback for caching

Slide 13

Slide 13 text

Constants MINUTE_IN_SECONDS HOUR_IN_SECONDS DAY_IN_SECONDS WEEK_IN_SECONDS YEAR_IN_SECONDS

Slide 14

Slide 14 text

Trust Do not trust any data an API gives you. Treat it as user input.

Slide 15

Slide 15 text

Securing Data Validate Sanitize Escape

Slide 16

Slide 16 text

Authentication

Slide 17

Slide 17 text

Basic Header Validation Pass it with every request

Slide 18

Slide 18 text

Key in the Query Some APIs just want the key in the query.

Slide 19

Slide 19 text

Speed Keep the data close for as long as possible.

Slide 20

Slide 20 text

Timing Timing your request can improve the user experience.

Slide 21

Slide 21 text

About Me Mike Hansen Open Source Team at Bluehost WordPress Core Contributor @MikeHansenMe mikehansen.me

Slide 22

Slide 22 text

Credits and Resources trust image locket image mr. clean image handshake image stopwatch image speed image idea image search image storage image Data Validation HTTP_API Transients Options Basic Auth