API Style Guides · Example Payload

Paypal Hateoas

HATEOASHypermediaPayPal

Paypal Hateoas is an example object payload from API Style Guides, with 13 top-level fields. It illustrates the shape of data this provider's APIs accept or return.

Top-level fields

$schemaidguideleveltitlesummarycategoryrationaleappliesTosourceUrlexamplesrelatedRulestags

Example Payload

paypal-hateoas.json Raw ↑
{
  "$schema": "../json-schema/style-guide-rule-schema.json",
  "id": "paypal-hateoas",
  "guide": "style-guides:paypal",
  "level": "SHOULD",
  "title": "Return Hypermedia Link Description Objects (HATEOAS)",
  "summary": "Resource responses should include a 'links' array of Link Description Objects with href, rel, and optional method properties to expose the next legal actions the client can take.",
  "category": "Hypermedia",
  "rationale": "HATEOAS makes the API self-describing: clients can follow links rather than hard-coding URLs, which reduces coupling to URI structure changes.",
  "appliesTo": ["REST"],
  "sourceUrl": "https://github.com/paypal/api-standards",
  "examples": [
    {
      "kind": "good",
      "language": "json",
      "snippet": "{\n  \"id\": \"PAY-1234\",\n  \"state\": \"approved\",\n  \"links\": [\n    { \"href\": \"https://api.paypal.com/v1/payments/payment/PAY-1234\", \"rel\": \"self\", \"method\": \"GET\" },\n    { \"href\": \"https://api.paypal.com/v1/payments/payment/PAY-1234/refund\", \"rel\": \"refund\", \"method\": \"POST\" }\n  ]\n}"
    }
  ],
  "relatedRules": ["zalando-hypermedia"],
  "tags": ["HATEOAS", "Hypermedia", "PayPal"]
}