[ad_1]
Hello,
I’m using Guzzle for my WP Rest application.
"guzzlehttp/guzzle": "^7.5"I can do the GET requests without any problems but when it comes to POST request I’m getting a
401 Unauthorized response: {“code”:”rest_cannot_create”,”message”:”Sorry, you are not allowed to create posts as this user.”,”data”:{“status”:401}}
However, when I’m doing the POST request using Postman I can make POST request without any problems
$response = $client->request('POST', '/wp-json/wp/v2/our-cruises/', [
'json' => [
'title' => 'This is a new test post from REST API',
'content' => 'This is a content from REST API'
]
]);
$body = $response->getBody();
$arr_body = json_decode($body);
print_r($arr_body);
