DOT Intership Technical Test

This project is a simple application that build by me to fulfill the intership selection at PT. Digdaya Olah Teknologi Indonesia

Requirements

I use a Laravel Framework 5.8 that need this requirement:

  • PHP >= 7.1.3
  • BCMath PHP Extension
  • Composer
  • Ctype PHP Extension
  • cURL PHP Extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Installation

  • Clone this repository
  • Copy .env.example to .env and update RajaOngkir API Key and Package with your own
  • Run composer install
  • You can start the development server using command php artisan serve

Task 1

Default Array

  1. Start development server using command php artisan serve
  2. Open http://127.0.0.1:8000/task-one
  3. See the result of default array in JSON format

Array Input

  1. Input an array that contains an integer collection as array GET parameter separates by commas (,) and open it.

    Ex: http://127.0.0.1:8000/task-one?array=5,3,8,10,1

  2. See the results in JSON format

Task 2

Available endpoint

Format Response

In a successful response, API will return a response with HTTP Status Code 2xx and JSON in this format:

{
    "success": true,
    "message": "Request success.",
    "data": {
        "province_id": "1",
        "province": "Bali",
    }
}

data key in the response must be either a single resource or an array of resource

Then, in a failed response, API will return a response with HTTP Status Code 4xx or 5xx and JSON in this format:

{
    "success": false,
    "message": "Request failed.",
    "errors": [
        "province_id": "Province ID is invalid.",
        "city_id": "City ID is invalid.",
    ]
}

errors key in the failed response must be an array that every key is taken from the request body key and value declare the error message