Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

ACS CustomObject not created from server service

$
0
0

Hi, I try to create custom object with ACS api from server service, this is my code:

ACS.Objects.create({
        classname: 'Ordini',
        fields: {
        session_id: req.session.id,
        user: req.session.user.id,
            coordinates: [req.body.latitude, req.body.longitude],
            cart: req.body.cart,
            status: 'incompleto'
        },
    },
    function(data){
        if (data.success){
            console.log('Success: ' + (JSON.stringify(data)));
            res.send(JSON.stringify(data));
        } else{
            console.log('Error: ' + ((data.error && data.message) || JSON.stringify(data)));
            res.send(JSON.stringify(data));
        }
    },
    req, res);
the POST result is:
{
    "Ordini": [
        {
            "user": {
                "id": "533ba19e891fdf0b731e8c5f",
                "created_at": "2014-04-02T05:35:26+0000",
                "updated_at": "2014-04-05T14:09:37+0000",
                "external_accounts": [],
                "confirmed_at": "2014-04-02T05:35:26+0000",
                "username": "psha4ng8kn0glef31o87",
                "admin": "false",
                "stats": {
                    "photos": {
                        "total_count": 0
                    },
                    "storage": {
                        "used": 0
                    }
                }
            },
            "session_id": "dnNR9zoFbT+fTsapydho4Oqa",
            "status": "incompleto",
            "coordinates": [
                [
                    "22",
                    "23"
                ]
            ],
            "id": "53400ea11316e90b6e240b65",
            "created_at": "2014-04-05T14:09:37+0000",
            "updated_at": "2014-04-05T14:09:37+0000"
        }
    ],
    "success": true,
    "error": false,
    "meta": {
        "code": 200,
        "status": "ok",
        "method_name": "createObject"
    }
}
In fact, the object has not been created although the successful response.

If I run the same code from Titanium app, as

Cloud.Objects.create({
        classname: 'Ordini',
        fields: {
        session_id: req.session.id,
        user: req.session.user.id,
            coordinates: [req.body.latitude, req.body.longitude],
            cart: req.body.cart,
            status: 'incompleto'
        },
    },
    function(data){
        if (data.success){
            console.log('Success: ' + (JSON.stringify(data)));
            res.send(JSON.stringify(data));
        } else{
            console.log('Error: ' + ((data.error && data.message) || JSON.stringify(data)));
            res.send(JSON.stringify(data));
        }
    },
    req, res);
the object is created successfully.

Can anyone help me?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>