'Invalid request method']); exit; } $input = json_decode(file_get_contents('php://input'), true); $template_id = isset($input['template_id']) ? (int)$input['template_id'] : 0; $code = isset($input['code']) ? trim($input['code']) : ''; if ($template_id <= 0) { http_response_code(400); echo json_encode(['error' => 'Missing or invalid template_id']); exit; } if ($code === '') { http_response_code(400); echo json_encode(['error' => 'Missing code']); exit; } /* * TODO: Replace this block with your real API call. * Expected response for import_json.php: * { * "success": true, * "reference": "CODE123", * "json": { ... real JSON payload ... } * } */ $sampleJson = [ 'data' => [[ 'type' => 'trf_data_request', 'id' => $code, 'attributes' => [ 'trf_type' => 'apparel', 'service_required' => 'regular', 'submitter_information' => [ 'submitter_type' => 'supplier' ] ] ]] ]; echo json_encode([ 'success' => true, 'reference' => $code, 'json' => $sampleJson ]); } catch (Throwable $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }