Fetching(GET) image url with applied image styles using jsonapi module Looking to make request using the jsonapi module to GET all urls that point to the images optimized version of the image.

If I use the Drupal front-end with Twig and view my page and inspect the images on the page I get something like this


http://local.mysite.com/sites/default/files/styles/promo_background_image/public/promo-backgrounds/MYIMAGE.png?h=df23a951&amp;itok=fslZ-kmD


If I make a request to my api endpoint and drill down to the image field it does not have the included image style url.
```

{
"data": {
    "type": "file--file",
    "id": "b74b73fb-19fd-48a2-ac91-8a7aacd7fe18",
    "attributes": {
        "fid": 2,
        "uuid": "b74b73fb-19fd-48a2-ac91-8a7aacd7fe18",
        "langcode": "en",
        "filename": "MYIMAGE.png",
        "uri": "public://promo-backgrounds/MYIMAGE.png",
        "filemime": "image/png",
        "filesize": 37624,
        "status": true,
        "created": 1508723420,
        "changed": 1508723610,
        "url": "/sites/default/files/promo-backgrounds/MYIMAGE.png"
    },
    "relationships": {
        "uid": {
            "data": {
                "type": "user--user",
                "id": "b044b880-ab4e-495b-b2d1-6a4fe58dc609"
            },
            "links": {
                "self": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18/relationships/uid?language=en",
                "related": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18/uid?language=en"
            }
        }
    },
    "links": {
        "self": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18?language=en"
    }
},
"links": {
    "self": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18?language=en"
}


}

```

How can one get access the image style uri using the jsonapi as my api server?
I would do it

create file: test_api.info.yml

name: Test API
type: module
description: Custom RESTful API module with GET/POST/PUT/DELETE etc.. method examples.
author: Minnur Yunusov
core: 8.x


create file: test_api.routing.yml

test_api.getparameter:
  path: 'my-api/get/{nid}'
  defaults: { _controller: '\Drupal\test_api\Controller\TestAPIController::getpara_example' }
  methods:  [GET]
  requirements:
    _access: 'TRUE'   


create file: /src/Controller/TestAPIController.php 

&lt;?php

/**
 * @file
 * Contains \Drupal\test_api\Controller\TestAPIController.
 */

namespace Drupal\test_api\Controller;

use Drupal\Core\Controller\ControllerBase;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\user\Entity\User;

/**
 * Controller routines for test_api routes.
 */
class TestAPIController extends ControllerBase {



  /**
   * Callback for `my-api/get.json` API method.
   */
  public function getpara_example($nid, Request $request ) {

    //get node;
    $node=node_load($nid);

    //get image uri
    $image =$node-&gt;field_image-&gt;entity-&gt;getFileUri();

    $style = \Drupal::entityTypeManager()-&gt;getStorage('image_style')-&gt;load('thumbnail');

    $url = $style-&gt;buildUrl($image);


    $response['nid'] = $nid;
    $response['uri'] = file_create_url($image);
    $response['image_original'] = file_create_url($image);
    $response['image_style_thumbnail'] =file_create_url($url);


    return new JsonResponse( $response );
  }




}


test:
url: localhost/drupal8/my-api/get/30
method: get

note: 30 is nid.

result:

{
  "nid": "30",
  "uri": "public://2017-10/generateImage_1RwT72.png",
  "image_original": "http://jeremiselxi.260mb.net/drupal8/sites/default/files/2017-10/generateImage_1RwT72.png",
  "image_style_thumbnail": "http://jeremiselxi.260mb.net/drupal8/sites/default/files/styles/thumbnail/public/2017-10/generateImage_1RwT72.png?itok=Dzg02oew"
}