/** * Retrieves an existing reverse DNS record. * * If a query is specified in the URL, all records matching the IPs or ranges * are returned. Multiple queries may be specified, and must be comma separated. * * If an identifier is specified, the reverse DNS record for one IP will be * retrieved. * * ### Response: ### * * ~~~ * [ * { * "name": <string>, * "ip": <ip>, * "reverse_dns": <string>|null, * "arpa_zone": <string>|null * },0..n * ] * ~~~ * * ### Errors (request without identifier): ### * * * 508 - Invalid request, missing required parameters or input validation failed. * * 500 - Failed to connect to database or query execution error. * * ### Errors (request with identifier): ### * * * 508 - Invalid request, missing required parameters or input validation failed. * * 500 - Failed to connect to database or query execution error. * * 404 - Could not find IP. * * @access public * @param mixed $request Request parameters * @param string $identifier IP address * @return Response DNS zone data if successful, error message otherwise. */ public function get($request, $identifier = null) { $response = new FormattedResponse($request); $data = $request->parseData(); if (empty($identifier)) { if ($data == null) { return ArpaFunctions::get_all_arpa($response, $out); } else { $validator = new ArpaValidator($data); if (!isset($data->query)) { $response->code = Response::BADREQUEST; $response->error = "Query was missing or invalid. Ensure that the body is in valid format and all required parameters are present."; $response->error_detail = "ARPA_INVALID_QUERY"; return $response; } if (!$validator->validates()) { $response->code = Response::BADREQUEST; $response->error = $validator->getFormattedErrors(); $response->error_detail = $validator->getErrorDetails(); return $response; } return ArpaFunctions::query_arpa($response, $data->query, $out); } } else { $validator = new ArpaValidator(); $validator->identifier = $identifier; if (!$validator->validates()) { $response->code = Response::BADREQUEST; $response->error = $validator->getFormattedErrors(); $response->error_detail = $validator->getErrorDetails(); return $response; } return ArpaFunctions::get_arpa($response, $identifier); } }