Skip to content
This repository has been archived by the owner on Feb 25, 2018. It is now read-only.

Creation of new object not working #4

Closed
willsr opened this issue Mar 6, 2012 · 3 comments
Closed

Creation of new object not working #4

willsr opened this issue Mar 6, 2012 · 3 comments
Assignees

Comments

@willsr
Copy link
Contributor

willsr commented Mar 6, 2012

When running this :

$query = ($_POST['query']) ? $_POST['query'] : $_GET['query'];

$params = array(
    'className' => 'temperature',
    'object' => array(
        'value' => $query

    )
);

$request = $parse->create($params);

I get this warning:

Warning: json_encode() expects exactly 1 parameter, 2 given in /home/corocco/public_html/parse.php on line 134
failed to get response 201, response code was: 400

and no new objects are created..

Any ideas?

@andrewscofield
Copy link
Owner

I think its because json_encode is a php5.3 only thing. If you take out the part that says JSON_NUMERIC_CHECK on line 134 it won't give you that error any more. But adding that line was a fix for another problem. This will work for you temporarily, I'll find another more compatible fix

@ghost ghost assigned andrewscofield Mar 7, 2012
@willsr
Copy link
Contributor Author

willsr commented Mar 7, 2012

Hi,
Yep, that fix removed the warning, but I still get "failed to get response 201, response code was: 401"
when I try to create a new object with this code:

$params = array(
    'className' => 'temperature',
    'object' => array(
        'value' => '20'
    )
);

$request = $parse->create($params);

@andrewscofield
Copy link
Owner

Hey, I just made a few fixes, it looks like they changed the API authentication on me. Should work now.

Also, please read the README on git for a small change in how to create an object

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants