[wp-trac] [WordPress Trac] #39166: REST API and PHP HTTPClient wrapper error: Invalid JSON body passed

WordPress Trac noreply at wordpress.org
Wed Dec 7 21:40:48 UTC 2016


#39166: REST API and PHP HTTPClient wrapper error: Invalid JSON body passed
--------------------------+-----------------------------
 Reporter:  peterigz      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 Since 4.7 I can no longer do a request with the php wrapper
 ([https://github.com/woocommerce/wc-api-php]), so doing:


 {{{
 $order = $client->get('orders/'.$order_id);
 }}}

 I get the error "Error: Invalid JSON body passed". The body being passed
 is of course blank because there's no data needed for a get request. I
 guess the issue is in class-wp-rest-request::parse_json_params?

 I can work around forcing a value in the data parameter in Client->Get but
 obviously not ideal :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39166>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list