Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
NexusMods Posted January 24 Posted January 24 (edited) Hi, Hope you are well. I'm experiencing an issue when trying to send any datetime values in query params when creating a member warning with a POST request to the core/members/{member_id}/warnings. According to the documentation I'm trying to form a url including suspend and/or restrict values which can be datetime|-1|null. However, when sending a datetime (or -1) I receive an UNKNOWN_ERROR response from the invision API. I've investigated this as much as I can and believe its being produced in Warning.php within a foreach loop where its trying to output 'no_warning_action_time' error - although, only the UNKNOWN_ERROR response is actually received. I may be incorrect on this though so seeking advice on next steps. I suspect its something to do with the datetime format I'm sending, any help would be appreciated. The formed URL and response looks as below (in postman): Edited January 24 by NexusMods
Daniel F Posted January 24 Posted January 24 Do you see any logged errors in your system log ( ACP => System => "Get Support" )
Daniel F Posted January 24 Posted January 24 I have tested it on my end with the same fields as you and it works as expected. The only difference I had to make was for the member note field, which is a string and not bool(but it shouldn't matter) My params: 'reason' => 1, 'moderator' => 1, 'acknowledged' => TRUE, 'memberNote' => true, 'suspend' => "2024-01-25 09:03:14 +0000", 'suspendPosts' => "2024-01-25 09:03:14 +0000",
NexusMods Posted January 24 Author Posted January 24 Thanks for the swift reply and pointing me in the right direction. I do actually see two System errors produced:
NexusMods Posted January 24 Author Posted January 24 Hi, you are sending a suspendPosts query param, not restrictPosts as your documentation states? https://invisioncommunity.com/developers/rest-api?endpoint=core/members/POSTitem_warnings
NexusMods Posted January 24 Author Posted January 24 Hi, please could I get a resolution on this. I believe its attempting to output this message. I'm not sure what this is relating to though. You must specify a timeframe for the actions applied, or select "Indefinitely"
Daniel F Posted January 24 Posted January 24 Same with the following request: var_dump( \IPS\Http\Url::external( $url.'api/index.php?core/members/1/warnings' )->request()->login( $key, '' )->post( [ 'reason' => 1, 'moderator' => 1, 'acknowledged' => TRUE, 'memberNote' => true, 'suspend' => "2024-01-25 09:03:14 +0000", 'restrictPosts' => "2024-01-25 09:03:14 +0000", ] )->decodeJson() ); but I think I've just located an issue if warning actions are present! Let me investigate this further.
NexusMods Posted January 24 Author Posted January 24 Hi, okay, that's interesting - mine still returns UNKNOWN_ERROR with the exact same values you are sending: If there is something relating to warning actions that matches up with where I think its erroring trying to send form a specific output. Please keep me in the loop, thanks. /* We do this after the action is checked because the moderator may not be able to override the action, in which case the actual values won't have been submitted */ foreach( $values['warn_punishment'] AS $p ) { if ( $values['warn_' . $p ] === NULL ) { \IPS\Output::i()->error( 'no_warning_action_time', '1C150/2', 403, '' ); } }
Daniel F Posted January 24 Posted January 24 I have located an issue here which is waiting for review (I have also sent you a PM with the instructions to see if it's the same issue)
Recommended Posts