Jump to content

Recommended Posts

Posted (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):
Could contain: Page, Text

Edited by NexusMods
Posted

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",

 

Posted

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"
Posted

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.

Posted

Hi, okay, that's interesting - mine still returns UNKNOWN_ERROR with the exact same values you are sending:

Could contain: Page, Text
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, '' );

    }
}

 

Posted

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)

  • Recently Browsing   0 members

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