* Create an analytics report from an existing data file. * * @param int $fileId ID of the file to import * * @return DataResponse HTTP 200 with a link to the created report * */
($fileId)
| 47 | * |
| 48 | */ |
| 49 | #[NoAdminRequired] |
| 50 | #[NoCSRFRequired] |
| 51 | #[ApiRoute(verb: 'POST', url: '/createFromDataFile')] |
| 52 | public function createFromDataFile($fileId): DataResponse { |
| 53 | if ($fileId) { |
| 54 | $reportId = $this->reportService->createFromDataFile($fileId); |
| 55 | $url = '/apps/analytics/r/' . $reportId; |
| 56 | return new DataResponse([ |
| 57 | 'version' => '0.1', |
| 58 | 'root' => [ |
| 59 | 'orientation' => 'vertical', |
| 60 | 'rows' => [ |
| 61 | [ |
| 62 | 'children' => [ |
| 63 | [ |
| 64 | 'element' => 'URL', |
| 65 | 'text' => 'Analytics report created', |
| 66 | 'url' => $url, |
| 67 | ], |
| 68 | ], |
| 69 | ], |
| 70 | ], |
| 71 | ], |
| 72 | ]); |
| 73 | } else { |
| 74 | return new DataResponse(['error' => 'fileId missing'], HTTP::STATUS_BAD_REQUEST); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | #[NoAdminRequired] |
| 79 | #[NoCSRFRequired] |
nothing calls this directly
no outgoing calls
no test coverage detected