The url: https://www.fira.co.uk/fullmembers.json
is an endpoint for Craft's element API plugin.
It has been working fine until recently I did a few things:
- I changed the site to https
- There have been some tweaks to the server config (nginx caching etc)
The problem I am having is that the URL returns a 404 header but still displays the JSON response in the browser. This 404 is affecting my wget script that systematically saves the response to a static file, as to improve performance.
Any ideas why the endpoint would be behaving like this?
I haven't altered the elementapi.php recently but here it is:
<?php
namespace Craft;
return [
'endpoints' => [
'fullmembers.json' => [
'elementType' => 'User',
'criteria' => ['group' => 'fullMembership', 'limit' => null, 'order' => 'companyName'],
'paginate' => false,
'transformer' => function(UserModel $member) {
// var_dump($member->memberAddress);
$businessCategories = [];
foreach ($member->businessTypeMarketSectorsProducts as $block) {
switch ($block->type->handle) {
case 'businessCategory':
$productValues = [];
foreach ($block->product as $prod) {
if ($prod->selected) {
$productValues[] = $prod->value;
}
}
$businessCategories[] = [
'businessType' => $block->businessType->value,
'marketSector' => $block->marketSector->value,
'product' => $productValues
];
break;
}
}
// $urlslug = strtolower(implode('-',explode(" ", $member->membersCompanyName)));
$urlslug = StringHelper::toKebabCase($member->membersCompanyName);
return [
'id' => $member->id,
'companyName' => $member->membersCompanyName,
// 'memberAddress' => $member->memberAddress->attributes,
'lat' => $member->memberAddress->lat,
'lng' => $member->memberAddress->lng,
'city' => $member->memberAddress->city,
'street1' => $member->memberAddress->street1,
'street2' => $member->memberAddress->street2,
'street3' => $member->membersAddressLine3,
'zip' => $member->memberAddress->zip,
'country' => $member->memberAddress->country,
'email' => $member->email,
'phone' => $member->membersPhoneNumber,
'profile' => UrlHelper::getUrl("directory/company/{$member->id}/{$urlslug}"),
'businessCategories' => $businessCategories
];
},
]
]
];