fixing API Problems when to many results

This commit is contained in:
schrom01
2023-09-26 17:30:35 +02:00
parent 8bd927dd23
commit 6ec770f27c
4 changed files with 32 additions and 14 deletions
+4 -4
View File
@@ -44,7 +44,7 @@ function sendAPICompanyInfoRequest(string $username, string $password, string $u
function sendAPICompanySearchRequest(string $username, string $password, array $data): string|bool {
// API endpoint
$apiUrl = 'https://www.zefix.admin.ch/ZefixPublicREST/api/v1/company/search';
$apiUrl = 'https://www.zefix.admin.ch/ZefixREST/api/v1/firm/search.json';
// Headers
$headers = array(
@@ -77,7 +77,7 @@ curl_close($ch);
function sendAPICommunityRequest(string $username, string $password): string|bool
{
// API endpoint
$apiUrl = 'https://www.zefix.admin.ch/ZefixPublicREST/api/v1/community';
$apiUrl = 'https://www.zefix.admin.ch/ZefixREST/api/v1/community.json';
// Headers
$headers = array(
@@ -110,7 +110,7 @@ function sendAPICommunityRequest(string $username, string $password): string|boo
function communityCSV(string $username, string $password): string {
$response = sendAPICommunityRequest($username, $password);
$communityArray = json_decode($response, true);
$csvOutput = 'bfsId,Kanton,Gemeindename,registryOfCommerceId\n';
$csvOutput = 'id,bfsId,Kanton,Gemeindename,registryOfCommerceId,replacedById,alternateNames\n';
// Create CSV rows
foreach ($communityArray as $item) {
@@ -122,7 +122,7 @@ function communityCSV(string $username, string $password): string {
function sendAPILegalFormRequest(string $username, string $password): string|bool
{
// API endpoint
$apiUrl = 'https://www.zefix.admin.ch/ZefixPublicREST/api/v1/legalForm';
$apiUrl = 'https://www.zefix.admin.ch/ZefixREST/api/v1/legalForm.json';
// Headers
$headers = array(