Jump to content

REST API stopped working ("errorCode": "EX0")


Omri Amos

Recommended Posts

Posted

Hi,

A few days ago (maybe after the upgrade to 4.1.17.1?) my REST API functions stopped working.

For example when trying to create a new topic (POST to /forums/topics) I'm getting this response:

Quote

"errorCode": "EX0",
"errorMessage": "UNKNOWN_ERROR"

And my system log show OutOfRangeException::0 error:

Quote

#0 /home/hwzone/public_html/community/system/Content/Api/ItemController.php(282): IPS\Patterns\_ActiveRecord::load(0)
#1 /home/hwzone/public_html/community/applications/forums/api/topics.php(127): IPS\Content\Api\_ItemController->_createOrUpdate(Object(IPS\forums\Topic))
#2 /home/hwzone/public_html/community/system/Content/Api/ItemController.php(315): IPS\forums\api\_topics->_createOrUpdate(Object(IPS\forums\Topic))
#3 /home/hwzone/public_html/community/applications/forums/api/topics.php(193): IPS\Content\Api\_ItemController->_create(Object(IPS\forums\Forum), Object(IPS\Member))
#4 [internal function]: IPS\forums\api\_topics->POSTindex()
#5 /home/hwzone/public_html/community/system/Api/Controller.php(73): call_user_func_array(Array, Array)
#6 /home/hwzone/public_html/community/system/Dispatcher/Api.php(224): IPS\Api\_Controller->execute(Array, true)
#7 /home/hwzone/public_html/community/api/index.php(13): IPS\Dispatcher\_Api->run()
#8 {main}

I'm using this generic code to send the API test request:

$fields = array(
		'forum' => 16,
		'author' => 84343,
		'author_name' => 'test',
		'title' => 'test',
		'post' => 'test',
		'hidden' => 0,
		'tags' => 'test',
	);
	
	$curl = curl_init( $communityUrl . '/api/forums/topics' );
	curl_setopt($curl,CURLOPT_RETURNTRANSFER, TRUE);
	curl_setopt($curl,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($curl,CURLOPT_USERPWD, "{$apiKey}:");
	curl_setopt($curl,CURLOPT_POSTFIELDS, $fields);

	$response = curl_exec( $curl );

 

This was working perfectly fine until a few days ago, what could have cause this? and how should I fix this?

Thanks

2016-12-13_2002.png

Posted

quick update: the ItemController.php file was indeed last changed on 7 December, when it stopped working.

Also please note that the REST API request actually does indeed create the topic - but it does not include the actual post content in it - and trying to enter the topic results in an error message ( 2F173/L ). In the database, no posts are created under that topic id.

another quick update:  POSTing to forums/posts (adding a new post to existing topics) works fine, so the issue is only with creating new topics...

 

Posted

OK, so after a few tests I figured out that the problem was with the "tags" parameter - for some reason it causes the above error when used. When I removed the tags parameter - it was working without any issues.

I need this tag.

What should I do?

Thanks

Posted

OK, I was able to overcome this by removing the "tags" parameter from the "forums/topics" call, and then adding it by another, second call, to "forums/topics/$id".

The actual issue still exists though.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...