Setting and enable CORS

In this section, we will add binary file support settings and enable CORS for the APIs

  1. Select Settings on the left menu.
  • Click Add Binary Media Type

CreateRestAPI

  1. Enter multipart/form-data
  • Click Save Changes

CreateRestAPI

  1. After the setting is done, back to Resource on the left menu.
  • Select /books resource
  • Click Actions
  • Select Enable CORS

CreateRestAPI

  1. Click Enable CORS and replace existing CORS headers

CreateRestAPI

  1. Click Yes, replace existing values

CreateRestAPI

  • Enable CORS for successful GET and POST methods

CreateRestAPI

  1. Select books/{id} resource
  • Click Actions
  • Select Enable CORS

CreateRestAPI

  1. Click Enable CORS and replace existing CORS headers

CreateRestAPI

  1. Click Yes, replace existing values

CreateRestAPI

  • Enable CORS for successful DELETE method

CreateRestAPI

  1. To front-end can use APIs, we need deploy APIs.
  • Select / resource
  • Click Actions
  • Select Deploy API

CreateRestAPI

  1. Select New stage

CreateRestAPI

  1. Enter stage name, such as: staging

CreateRestAPI

  1. Take note URL to call API

CreateRestAPI

  • URL of list and write API:

CreateRestAPI

  • URL of delete API:

CreateRestAPI