I am getting the error 'Unknown error creating mind map. Response data:'

PHP Testing 1
PHP Testing 1 EN Basic Posts: 2 Beginner
edited May 28 in Ask the Community

// Define your MindMeister API key and secret
$api_key = 'xxx';
$api_secret = 'xxx';

// Define the parameters for creating the mind map
$params = array(
'method' => 'mindmap.create',
'api_key' => $api_key,
'secret' => $api_secret,
'map_id' => '0', // Set to 0 for a new mind map
'map_title' => 'Test Mind Map',
'nodes' => array(
array(
'title' => 'Test Node 1',
'parent_id' => 0
),
array(
'title' => 'Test Node 2',
'parent_id' => 0
)
)
);

// Create a new cURL resource
$ch = curl_init();

echo $ch;
echo "<br/>";

// Set the MindMeister API URL
curl_setopt($ch, CURLOPT_URL, 'https://www.mindmeister.com/services/rest?format=json');

// Set cURL options for sending POST data
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));

// Return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, true);

// Execute the request
$response = curl_exec($ch);
echo "Response:";
print_r($response)."<br/>";

// Close cURL resource
curl_close($ch);

// Decode the JSON response
$response_data = json_decode($response, true);

// Check if the request was successful
if ($response_data && isset($response_data['stat']) && $response_data['stat'] == 'ok') {
echo 'Mind map created successfully. Map ID: ' . $response_data['rsp']['map_id'];
} else {
// Print the error message from the API response if available
if (isset($response_data['rsp']['err']['msg'])) {
echo 'Error creating mind map: ' . $response_data['rsp']['err']['msg'];
} else {
echo 'Unknown error creating mind map. Response data: ';
echo '<pre>';
print_r($response_data);
echo '</pre>';
}
}

For the above code I am getting the error 'Unknown error creating mind map. Response data:'

Following is the output

Resource id #2
Response:HTTP/2 200 date: Mon, 27 May 2024 10:25:47 GMT content-type: application/xml; charset=utf-8 content-length: 124 x-xss-protection: 0 x-content-type-options: nosniff x-download-options: noopen x-permitted-cross-domain-policies: none referrer-policy: strict-origin-when-cross-origin p3p: CP="CAO PSA OUR" etag: W/"25eefad724573fefe092e6cdad448540" cache-control: max-age=0, private, must-revalidate content-security-policy: default-src * 'unsafe-inline'; img-src * data: blob:; frame-ancestors *; script-src * 'unsafe-inline' 'unsafe-eval'; media-src * blob:; worker-src 'self' blob:; style-src * blob: 'unsafe-inline' 'unsafe-eval'; frame-src * blob: set-cookie: _mind_session=cWxVnnEFtkzoEwbQOt4zt%2BEdy92IWRrkdhQ%2BOu%2BeOzr%2BsAGBxl5CxFxALcYDK5VgwQmA6AKhawyszWbxQ4im0zewycHrcW7EZQHiA3%2Fm2NRz8pkOU%2Biom5yfkdTe%2FzvQ8PZlN5ownf54oT2Cb1uho%2BZSCnkMTFWzQRyYNcAQiiIwDFf%2Bw3dKNgsXZEs9x3v6Swgc%2FU%2B41lJ2NP6CQkk7C2Sx2Ykf9rzKQuR4vdPRtsRtnHKK6iib9fHqYCe7yQ0bGmW6TaPUn6GF7YsA3PoKhyHdrNbcMMQ%3D--cq7Ld8t%2FwUE%2F1ga9--2CmsrEbwclKY883%2FKcfQWQ%3D%3D; path=/; expires=Mon, 10 Jun 2024 10:25:46 GMT; secure; HttpOnly; SameSite=None x-request-id: 7f6e94be2fd57d6aa05cadce7f13b452 x-runtime: 0.022774 x-cloud-trace-context: 4c742897504349eb8a424e418c0d4b5b;o=0 strict-transport-security: max-age=31536000; includeSubDomains; preload cf-cache-status: DYNAMIC server: cloudflare cf-ray: 88a54d8bfbfa3b08-IAD Unknown error creating mind map. Response data:

Please help

Thanks

Answers

  • Miša Hennin
    Miša Hennin Admin, MeisterLobster, EN Business Posts: 1,581 Community Admin
    edited May 31

    Hey!

    So I'm afraid that MindMeister API doesn't allow any changes to mind maps, even creation, since it's already API version 2.

    It allows only to read the mind map but not adjust it.

    I can convert this post into a feature request if you like? And then other users can upvote it.

    Best,

    Miša