Routes

Postcode

Retrieve Location Data by Postcode

  • The __invoke method in the PostcodeController handles GET requests made to the /{postcode} endpoint.
  • The method retrieves location data (latitude and longitude) based on the provided postcode using the postcodeLatLonService.
  • The retrieved data is then returned as a PostcodeResource.

Route::get('postcodes/{postcode}', 'PostcodeController');

Details

  • Route: postcodes/{postcode}
  • HTTP Request: GET
  • Controller: PostcodeController
  • Method: __invoke

Tested through Postman

  • Endpoint: https://apis.dev.nl.toolstation.dev/ecom/v1/postcodes/TA64DB
  • Access Token: Required
  • Request Body:
  • Response:
    {
      "data": {
      "postcode": "TA64DB",
      "latitude": "51.133840999999996768",
      "longitude": "-3.000694999999999890"
      }
    }
    

Copyright © 2026