Web api - cannot delete article

96 views
Skip to first unread message

Ronny Buelund

unread,
Feb 26, 2023, 7:05:38 AM2/26/23
to Joomla! General Development
I am trying to use the Joomla Wep API. I can create articles and retrieve articles - but I cannot delete articles! I get this as my curl result: {"errors":[{"code":500,"title":"Internal server error"}]}

I use this function to delete:
function delete_article($articleid){
$baseurl = 'https://xxxxxxx.dk';
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $baseurl."/api/index.php/v1/content/articles/" . $articleid,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "utf-8",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => "CURL_HTTP_VERSION_2TLS",
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Accept: application/vnd.api+json",
"Accept-Encoding: gzip, deflate",
sprintf('X-Joomla-Token: %s', trim($token)),
"Cache-Control: no-cache",
"Connection: keep-alive",
"Content-Type: application/json",
"cache-control: no-cache"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo "Article deleted";
print_r($response);
echo "<br/><br/>";
}
}
Message has been deleted

jms

unread,
Feb 27, 2023, 2:26:20 AM2/27/23
to joomla-de...@googlegroups.com
Have you tried this ?
https://stackoverflow.com/questions/13420952/php-curl-delete-request

Solution "Update 2 «

JM
> --
> You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/ffbae3e7-74d3-4d55-8a02-f4d48b38c702n%40googlegroups.com.

Message has been deleted

Ronny Buelund

unread,
Mar 3, 2023, 11:48:13 AM3/3/23
to Joomla! General Development
I wonder whu my posts are being deleted here !!???

Mark Stanton

unread,
Mar 3, 2023, 1:51:58 PM3/3/23
to Joomla! General Development
I don't know.  Perhaps the Joomla website forum would be a better place to ask?
Reply all
Reply to author
Forward
0 new messages