PepiMK
New member
The documentation is a bit unfinished here, but I was able to post new releases.
What doesn't work those is the release_date. The field is the same returned when reading released, and is the one in the documentation.
How do I set the release date from the API when creating a new release version?
What doesn't work those is the release_date. The field is the same returned when reading released, and is the one in the documentation.
How do I set the release date from the API when creating a new release version?
PHP:
protected function create_xenforo_resource_version(string $resource_id, string $version, int $release_date, string $download_url): mixed
{
$aHeaders = ['Content-Type: application/x-www-form-urlencoded', 'XF-Api-Key: ' . $this->XenForoAPIKey];
$aFields = array(
'resource_id' => $resource_id,
'version_string' => $version,
'release_date' => $release_date,
'external_download_url' => $download_url,
);
$ch = curl_init();
/**
* api/resource-versions/{$resource_id}/ - invalid endpoint, only GET and DELETE allowed");
* api/resources/{$resource_id}/versions/ - invalid endpoint, only GET allowed
*/
curl_setopt($ch, CURLOPT_URL, $this->XenForoURL . "api/resource-versions/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($aFields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $aHeaders);
$output = curl_exec($ch);
curl_close($ch);
return json_decode($output);
}