Copy - Usage

Once installed, you will have two routes that respond to GET requests and return Copy elements. The actual routes that receive these requests are dependent on where you added the route declaration line during installation. These routes are intended to be accessed with xhr requests.

If you just added them to your routes\web.php file, your routes will be:

/copy/{slug}/{response-type}

This route can be called to request a single piece of copy. The {slug} segment should be the slug of the Copy record, and the {response-type} element should be either text or html depending on the data you wish to request. Both are available for all records.

The response will be just the data requested, or a 404 if the Copy record does no exist for the given slug.

/copy

This route can be used to access multiple pieces of Copy at once, to reduce the number of calls.

To use this endpoint, your GET request should contain an array named 'items', which should consist of key => value pairs of data where the key is the slug of the Copy record and the value is the format for the data. For example, you might request:

/copy?items[foo]=text&items[bar]=html&items[baz]=text

This would return a json response as follows:

{
  foo: 'foo text content',
  bar: 'bar html value',
  baz: 'baz text value',
}

Unlike the route to request single Copy elements, this route does not return a 404 if a requested Copy element does not exist. Instead, it will return the value as null.