Skills Test Answers - RESTful Services

When you wish to read a collection of “Foo” via a RESTful API, which is most appropriate?

GET /api/foos
POST /api/foos
PUT /api/foos
DELETE /api/foos



How is REST related to SOAP?

SOAP is a subset of REST that is stricter
REST is an alternative to SOAP
REST is a subset of SOAP that is stricter
REST is the same as SOAP, except that REST does not specify that the format of interchange is XML



True of False? REST, being an architectural style, does not concern implementation details

True
False



Which HTTP method should be used to update a resource in a RESTful Web Service?

POST
GET
DELETE
PUT



When you wish to read a single “Foo” via a RESTful API, which is most appropriate?

GET /api/foos/123
DELETE /api/foos/123
POST /api/foos/123
PUT /api/foos/123



What happens if Restful resources are accessed by multiple clients?

XML protocol will be used to access clients
Synchronization will be made to the Restful resource request
Multiple clients can safely access Restful resources concurrently
SOAP service will be implemented



What is the advantage of including Cache control and Last-Modified (a date value) HTTP response header?

Improves performance by reducing the requests for duplicate resources
Includes links to subordinate resources to keep them connected
Resources organized by date for using hierarchical syntax
Avoids query strings



When you wish to create a new “Foo” via a RESTful API, which is most appropriate?

POST /api/foos
DELETE /api/foos
GET /api/foos
PUT /api/foos



Which of the following is true of RESTful Web Service?

Caters to any client in one language
No transfer of XML
Inconsistent with protocol definition
Use HTTP methods explicitly



REST is an acronym for representational state transfer

False
True



What are the prerequisites for an application to interact with a resource?

Identifier of the resource and Action required
Well managed cache control
Code on demand
Format of the presentation



In the context of a web service, a RESTful API should...

Make individual reources available at the same URI
Make individual resources available at unique URIs
(none of these are correct)



When you wish to update an existing “Foo” via a RESTful API, which is most appropriate?

DELETE /api/foos/123
PUT /api/foos/123
GET /api/foos/123
POST /api/foos/123



Which is a true statement in the basic REST design principle that uses HTTP request methods to update resources?

To create a resource on the server, use POST
To create a resource on the server, use ADD
To create a resource on the server, use CREATE
To create a resource on the server, use EXECUTE



Consider a RESTful resource available on the URI /posts. Which is the correct HTTP method used to create a new entry?

POST
HEAD
GET
PUT



Which data formats can be transfered through RESTful Web Services?

Haml
JSON
XML
Any format



RESTful web services are designed with ____ in mind.

Peer to peer communications
Raw socket data transfer communications
Client-server communications
Encrypted communications



Which request would best describe removing an user in a RESTful Web Service?

PUT /users/delete/1
POST /users/1
GET /users/delete?id=1
DELETE /users/1



Identify the method which is not predefined in HTTP specification

PUT
GET
FIND
POST



When you wish to delete an existing “Foo” via a RESTful API, which is most appropriate?

POST /api/foos/123
GET /api/foos/123
DELETE /api/foos/123
PUT /api/foos/123



Identify the item which is not an intermediary for communication in REST

Firewalls
Viruses
Gateways
Proxies



When you wish to create a new “Foo” via a RESTful API, which is most appropriate?

PUT /api/foos/123
GET /api/foos/123
POST /api/foos/123
DELETE /api/foos/123



What is the key difference between RESTful web services and SOAP web services?

SOAP can be cached and REST cannot be cached
REST uses HTTP protocol for producing or consuming web services while SOAP uses XML
SOAP is more lightweight as compared to REST
SOAP is transport protocol specific whereas REST is transport protocol neutral



Which of the following best describes a RESTful service?

Structured text that uses hyperlinks between nodes containing text to exchange or transfer hypertext
An application protocol for distributed, collaborative, hypermedia information systems.
Web Services with focus on system resources and transfer of state of resource over http by a wide range of clients written in different languages
A protocol specification for exchanging structured information in the implementation of Web Services in computer networks



Which is the preferred method of determining the format of the data being transfered in a RESTful request?

HTTP Content-Type header
Inference from the HTTP method used
Extension in URI. E.g. /users.json
A string containing MIME-Type in the HTTP body



RESTful web services must be stateful

True
False



Which of the following best describe REST?

an architectural style
(None of these)
a standard
a framework



What determines the action to be executed on a RESTful request?

Verb on URI
HTTP Method
Query string parameters
Verb on request body



As an idempotent method, which of the following should not happen when issuing a GET request to a RESTful Web Service?

Return resource data
Update a resource entry
Log the request data
Increment an internal counter



How can users log into RESTful API to see protected resources only?

Encryption and Decryption technology addresses the need
Since server is stateless, client has to provide all information to make request
It depends on entitlement per Data Protection Act
Users apply for permission to enable them to login



Which of the following cannot be considered a REST design principle

Makes use of standard HTTP methods
(None of these)
Client-server separation
Stateless



True or False? RESTful responses should include links to related resources, enabling the Client to progress through states.

True
False



A RESTful Web Service URI should map to __________________?

a method on a class
an entity or resource
a file on the disk
(All of these)



Statelessness is one of the formal constraint of REST Web Service, which feature is addressed due to absence of state on the server?

Modifies components to meet changing needs while an application is running
Uniform interface separates each client from the server
Improves Web service performance as it removes the need to synchronize session data with an external application
A default page or resource is provided as a response



Suppose you're writing a REST resource for listing all coments made by an user. Which would be the most appropriate URI?

/comments?user={id}
/user/id?fields=comments
/comments/user/{id}
/users/{id}/comments



Identify which is not a formal REST constraint

Client-server
Cache Responses
Stateless Principle
Master Data



Which HTTP methods are considered "safe", meaning that the request should not produce side-effects or alter the server state?

HEAD, GET, PUT and OPTIONS
HEAD, POST, GET and PUT
HEAD, GET, OPTIONS and TRACE
GET, POST, PUT and DELETE



In the context of a web service, a RESTful API should...

Use the same HTTP verb for different actions on the same resource, and append the action tothe URI
Use different HTTP verbs for different actions on the same resource
(none of these are correct)
Use different HTTP verbs for different actions on the same resources, in addition to appending the URI with the action



Which software architecture is used for designing and developing software with "RESTful" interfaces?

Resource Oriented Architecture
Enterprise Architecture
Software System Architecture
Service Oriented Architecture



True or False? It is a design flaw for RESTful Web Services to reveal data gradually, linking to additional resources on the response body.

False
True



What is the mechanism that mediates communication, coordination or cooperation among components like data streams known as?

Configuration
Pattern
Architecture
Connector



Who is responsible for tracking the application state on a system that communicates through a RESTful Web Service

Both client and server
Server
(None of these)
Client



True or False? In RESTful Web Services each URI can map to one or more resources.

True
False



Which of the following describe the correct way to let a client progress through states in a RESTful application?

(None of these)
A link in the response body pointing to the next state
There is no way to track states in RESTful applications
The server should track the state for the client



Which of the following should not be present in RESTful Web Services URIs?

Nouns
Verbs
(All of these)
Parameters. E.g. id, page, etc.



In the context of a web service, a RESTful API should...

Include URIs that link to other related resources
(none of these are correct)
Include a list of verbs/ actions available on this resource
Include a time stamp that indicates when the state of this resource is valid till



Which is the foundational constraint in REST that defines the separation between service, consumer and the technical contract?

URL
Cache
Client server
Media



What is an appropriate HTTP response for issuing a GET request to /users/1/delete on a RESTful Web Service?

500 Internal Server Error
200 OK
302 Found
405 Method Not Allowed



Which of the following is one of the interface constraints for REST that allows the server functionality to evolve independently?

SOAP (Simple Object Access Protocol)
HATEOAS (Hypertext As The Engine Of Application State)
API (Application Programming Interface)
WSS (Web Services Security)



How might HATEOAS principles be applied in a RESTful web service?

(all of these are correct)
Each response should include metadata about the resource, such as when the data is valid until
Each response should include state of related resources
Each response should include links to the other related resources



What is the advantage of Restlet Framework?

Restlet Framework encapsulates some aspects of Rest Architecture
There is no control on call handling to developers
Does not need support to URI templates
Restlet Application can be a client and a server at the same time.



Name the service where the security measures are transport dependent

Representational State Transfer
Simple Object Access Protocol
Web Services Description Language
Remote Procedure Calls



Which is an optional constraint for REST?

Stateless
Cacheable
Client-server
Code on demand



URIs in a RESTful web service should be hierarchical

True
False



When you wish to update a select few fields on an existing “Foo” via a RESTful API, which is most appropriate?

PUSH /api/foos/123
PATCH /api/foos/123
POST /api/foos/123
PUT /api/foos/123



RESTful web services must be served over HTTP or HTTPS

False
True



In a RESTful web service, which HTTP verbs are idempotent?

GET, PUT, DELETE
POST, PUT, DELETE
All HTTP verbs afe idempotent
GET only



It is possible to implement a RESTful web service in HTTP1.1, but not in HTTP1.0

True, because HTTP1.0 does not support keeping state between related requests on the server
True, because HTTP1.0 has insufficient verbs
False, both were capable