[chef] Re: Re: Re: Chef API


Chronological Thread 
  • From: Tensibai < >
  • To:
  • Subject: [chef] Re: Re: Re: Chef API
  • Date: Mon, 12 May 2014 16:37:51 +0200

I have added an exemple of my code on Stack Overflow.

It works for me (OOS 11.0.10), but maybe hosted chef is more conservative, you may try to dump the data within the library to ensure what is sent...

 

Tensibai

Le 2014-05-12 13:48, Dvir Levy a écrit :

Hello Tensibai,
 
First of all thank you for the help.
 
Did casting the response work for you? 
For me, it doesn't change the outcome of the "json_encode()".
I have checked that I am really getting an array after casting, but the output of the json_encode is an object.
I still get "Invalid JSON" :\
 
Again, Thank You,
-- Dvir Levy


On Mon, May 12, 2014 at 12:51 PM, Tensibai < "> > wrote:

Le 2014-05-12 09:40, Dvir Levy a écrit :

Hello,
Im not sure if this is the right address.
 
I am trying to create a PHP library to work with Chef API.
I am using hosed Chef and this is the library : https://github.com/dv1r/php-chef
I have also opened a ticket in support : https://www.getchef.com/support/tickets/17534
 
All of the information to my problem is there, but to sum up
Every PUT/POST request that contains data being passed to the API
comes back as "Invalid JSON".
I've looked at the request from every direction I could think of and it should work.
Is there any way someone here can help me?
Does chef expect a kind of JSON that I've never heard of? 
 
Thank you,
Dvir Levy
 
 
P.S
If this is the wrong place, could you point me to the right place? :)

Answered on SO.

Mainly the problem is json to object, new property and object to json.

I had to cast to an array to ensure adding items works properly with the library.

Hope it helps.

Tensibai

 

 

 



Archive powered by MHonArc 2.6.16.

§