Michael Bissell
  • Twitter
  • LinkedIn
  • Contact me

Cherry Picking Response Fields

If a consumer of the API wants to limit the complexity they should be able to specify which fields to return like this:

  /people?fields=userName,agencyCode

Which would take this payload:
{
	"content": [{
		"id": "d6e76f56-b69f-423d-80c1-5ed5395f6602",
		"userName": "myadmin@mydomain.ext",
		"firstName": "My",
		"lastName": "Admin",
		"emailAddress": [{
			"email": "myadmin@mydomain.ext",
			"verified": "unverified",
			"source": "DPD"
		}],
		"agencyCode": [
			"000000008"
		],
		"created": 1461766408
	}, {
		"id": "4c12a4b9-cd66-4774-b4de-f13d851e5864",
		"userName": "user60@gmail.com",
		"firstName": "user",
		"lastName": "60",
		"emailAddress": [{
			"email": "user60@gmail.com",
			"verified": "unverified",
			"source": "DPD"
		}],
		"agencyCode": [
			"000000008"
		],
		"created": 1462484975
	}, {
		"id": "ed0e7d00-31b3-433d-90a1-c14a97920488",
		"userName": "somebody@somewhere.ext",
		"firstName": "Some",
		"lastName": "Body",
		"emailAddress": [{
			"email": "somebody@somewhere.ext",
			"verified": "unverified",
			"source": "DPD"
		}],
		"agencyCode": [
			"12967"
		],
		"created": 1462547817
	}]
}
And compact it to this:

{
	"content": [{
		"userName": "myadmin@mydomain.ext",
		"agencyCode": [
			"000000008"
		]
	}, {
		"userName": "user60@gmail.com",
		"agencyCode": [
			"000000008"
		]
	}, {
		"userName": "somebody@somewhere.ext",
		"agencyCode": [
	  		"12967"
		]
	}]
}

Main Nav

  • Michael's Resume
  • Presentations and Voice
  • The API Contract
  • Contact me


The API Contract

  • The API Contract
  • Default Formats
  • General API Management
  • Error Standards
  • Response Codes
  • Collections
  • Filters
  • Cherry Picking
  • Conveniences
  • Change Logs

Blog

© Michael Bissell. All rights reserved.