Skip to main content Skip to complementary content

Creating an operation to get a list of movies

Create a GET operation that returns an array of the Movie data type.

Procedure

  1. Click the + button to the right of the Movies section and select Operation.
  2. Configure the general information as follows:
    Field Value
    Name Get a list of movies
    Method GET
    Path /movies
    Description Returns a list of movies available for rental.
    Id getMovies
    Screenshot of the configured general information.
  3. Click Add next to RESPONSES and select 2XX - Default in the Status field.
  4. Click Add next to BODY.
  5. In the TYPE section, select Array in the Type list and Movie in the of list.
  6. Add the following example in the Examples field:
    <movies>
      <movie>
        <movieId>1</movieId>
        <title>The Social Network</title>
        <releaseYear>2010</releaseYear>
        <director>David Fincher</director>
        <price>4.99</price>
      </movie>
      <movie>
        <movieId>2</movieId>
        <title>La La Land</title>
        <releaseYear>2016</releaseYear>
        <director>Damien Chazelle</director>
        <price>5.99</price>
      </movie>
      <movie>
        <movieId>3</movieId>
        <title>Ex Machine</title>
        <releaseYear>2014</releaseYear>
        <director>Alex Garland</director>
        <price>4.99</price>
      </movie>
    </movies>
    Screenshot of the response with the example.
  7. Click Save.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!