Jump to content

Empty API Request when editing a member


MediaDiGi

Recommended Posts

Posted

Hello guys,

I'm stuck when I try to edit a member group according to this instructions:

https://invisioncommunity.com/developers/rest-api?endpoint=core/members/POSTitem

I see the request in inside IPS with Response Code 200 OK, but the member group is not changing, 

Here is the Log:

POST core/members/45783

REQUEST DATA

[]

RESPONSE

{
    "id": 45783,

Here is my PHP code

        $data = array("group" => 12);                                                                    
        $data_string = json_encode($data);
        
        $ch = curl_init($this->communityUrl.'/core/members/'.$memberId);
    
        curl_setopt_array($ch, array(
            CURLOPT_RETURNTRANSFER    => TRUE,
            CURLOPT_HTTPAUTH    => CURLAUTH_BASIC,
            CURLOPT_HTTPHEADER => array('Content-Type: application/json','Content-Length: ' . strlen($data_string)),
            CURLOPT_USERPWD        => "{$this->apiKey}:",
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $data_string ));
        
        $result = curl_exec($ch);

        return $result;

 

Please let me know what I'm doing wrong.

Posted

Hello,

        $data = array("group" => 12);                                                                    
        
        $ch = curl_init($this->communityUrl.'/core/members/'.$memberId);
    
        curl_setopt_array($ch, array(
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
            CURLOPT_USERPWD        => "{$this->apiKey}:",
            CURLOPT_POST           => true,
            CURLOPT_POSTFIELDS     => $data 
       ));
        
        $result = curl_exec($ch);

        return $result;

 

Archived

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

  • Recently Browsing   0 members

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