O'Reilly logo

RESTful Web API Design with Node.js by Valentin Bojinov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Linking

As of version 2, the contact service supports two data formats: JSON for storing contacts and binary format for storing an image file that may be associated with a contact. We need to ensure that these data formats are not mixed. In the previous section, Working with arbitrary data, the information stored for a contact was extended with an additional file entry in MongoDB that stored the binary representation of a JPEG image.

However, none of the previously exposed routes, /v2/contacts nor /v2/contacts/{primary-number}, adopted that change, and the image was exposed in a new route—/v2/contacts/{primary-number|}/image. That was done intentionally, and keeping backward compatibility was not the main reason for that decision. Mixing literally ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required