18

So I am working on creating a Google App Engine Application, and I've come across the term "expose" a number of times, e.g. "your first app can expose objects using an HTTP based API" and "expose this datamodel class through a REST API". What does "expose" mean? Is there a particular action associated it, or is it an abstract part of design?

16

It means that you enable objects to be accessed through some means. In your examples, you could let the users create, read, update or delete objects (usually abbreviated to CRUD) using the HTTP protocol through some predefined way to interact with your objects (an API).

That API can adhere to a set of rules - e.g. RESTful APIs use HTTP verbs to perform some actions on objects and they adhere to some principles that say how resources should be identified/represented and how they should be manipulated through those representations.

In the context of a web application, let's say you have blog posts stored in your database. You would like the users of your application to be able to do something with those posts. They don't have to necessarily use your web site, but could perhaps use their own application that would connect to your application (e.g. a blog reader program).

As the owner of your application, you could define an interface through which your application can be accessed. For example, you might want to add an option for some users to read or write blog posts. The interface could look something like this (for an example of a more complex API, see Twitter's API definition):

  • If a GET /posts/{number} HTTP/1.1 is requested from your web application, you will provide a representation of your post object with an id {number} in a predefined format

Note that you are not providing an actual database object, nor your application object. You are providing a representation of your object

  • If a POST /posts HTTP/1.1 with a title={text1}&body={text2} is posted to your web application, you will create a new post object titled {text1} that will contain {text2} for its body, and will return an id value of the newly created post

Again, you are allowing the user the manipulate representations of your objects. The user does not have to know how your objects actually look like (that is abstracted away by the interface from the user).

Exposing the object means providing the user with an interface to access and manipulate your objects. If that interface satisfied some additional predefined conditions regarding representations of the object and states of the application that exposes its objects, then that interface is said to be a REST (or RESTful) API.

19

"Expose" here means what it means in regular English - give access where access would not otherwise be available.

For instance "your first app can expose objects using an HTTP based API" means that someone on another machine can manipulate your object on your machine by asking for the right web pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.