These are chat archives for ushahidi/Community

12th
Dec 2016
Ushbot
@ushbot
Dec 12 2016 11:02
[David Losada, Ushahidi] @dhatanian , did you run this couple commands? gem install puppet librarian-puppet librarian-puppet install
Nesp
@Nesp
Dec 12 2016 14:49

Hi there,

I have a problem. I am sending a put request to change a post and it results successful. Immediately after that a Post request is sent which does not work. Everything works properly but still I have this unsuccessful POST request. I have a bad feeling about this.
@ushbot could you help me please?

Ah, I forgot to say that the POST request I am not sending myself.
Ushbot
@ushbot
Dec 12 2016 14:59
[David Losada, Ushahidi] hi Nesp, would you be able to paste payloads for those requests?
Nesp
@Nesp
Dec 12 2016 15:51
sure
Nesp
@Nesp
Dec 12 2016 15:57
Do you mean the response payload?
@ushbot

for the PUT request

this is the request payload:

{"id":2,"url":"http://localhost:8080/platform/api/v3/posts/2","user":{"id":1,"url":"http://localhost:8080/platform/api/v3/users/1"},"parent_id":null,"form":{"id":1,"url":"http://localhost:8080/platform/api/v3/forms/1"},"message":null,"color":"#E69327","type":"report","title":"Volunteers needed to carry sandbags","slug":"other-try-582996730105f","content":"Volunteers needed to carry sandbags in the Korle Lagoon. Please come and help.","author_email":null,"author_realname":null,"status":"published","created":"2016-11-14T10:48:19+00:00","updated":"2016-12-12T14:27:17+00:00","locale":"en_us","values":{"8564e89c-4948-407d-ba4c-19caef9fe559":[14],"ddb1974a-076d-4e06-8602-2f2a188f7905":[7],"location_default":[{"lon":-0.219653,"lat":5.536665}],"ae94e9f0-7f12-4785-b7dd-e359f77139a7":["- reach the Korle Lagoon, there you will receive a volunteer badge that will allow you inside the area;\n\n- please avoid this and that neighborhood because they are flooded;\n\n- our team will tell you where the sandbags are.\n\nGood Luck!"]},"post_date":"2016-11-14T10:48:19+00:00","tags":[],"published_to":[],"completed_stages":[],"sets":[],"source":null,"contact":null,"allowed_privileges":["read","create","update","delete","search","change_status"]}
and this is the response
{
    "id": 2,
    "url": "http://localhost:8080/platform/api/v3/posts/2",
    "user": {
        "id": 1,
        "url": "http://localhost:8080/platform/api/v3/users/1"
    },
    "parent_id": null,
    "form": {
        "id": 1,
        "url": "http://localhost:8080/platform/api/v3/forms/1"
    },
    "message": null,
    "color": "#E69327",
    "type": "report",
    "title": "Volunteers needed to carry sandbags",
    "slug": "other-try-582996730105f",
    "content": "Volunteers needed to carry sandbags in the Korle Lagoon. Please come and help.",
    "author_email": null,
    "author_realname": null,
    "status": "published",
    "created": "2016-11-14T10:48:19+00:00",
    "updated": "2016-12-12T15:54:34+00:00",
    "locale": "en_us",
    "values": {
        "8564e89c-4948-407d-ba4c-19caef9fe559": [
            14
        ],
        "ddb1974a-076d-4e06-8602-2f2a188f7905": [
            7
        ],
        "location_default": [
            {
                "lon": -0.219653,
                "lat": 5.536665
            }
        ],
        "ae94e9f0-7f12-4785-b7dd-e359f77139a7": [
            "- reach the Korle Lagoon, there you will receive a volunteer badge that will allow you inside the area;\n\n- please avoid this and that neighborhood because they are flooded;\n\n- our team will tell you where the sandbags are.\n\nGood Luck!"
        ]
    },
    "post_date": "2016-11-14T10:48:19+00:00",
    "tags": [],
    "published_to": [],
    "completed_stages": [],
    "sets": [],
    "source": null,
    "contact": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search",
        "change_status"
    ]
}
Nesp
@Nesp
Dec 12 2016 16:05

for the subsequent POST request

the request payload is empty

the response is:

{
    "errors": [
        {
            "status": 400,
            "title": "Invalid json supplied. Error: 'JSON must be array or object'. ''",
            "message": "Invalid json supplied. Error: 'JSON must be array or object'. ''",
            "class": "HTTP_Exception_400",
            "file": "/opt/lampp/htdocs/platform/application/classes/Ushahidi/Rest.php",
            "line": 420,
            "trace": [
                {
                    "file": "/opt/lampp/htdocs/platform/application/classes/Ushahidi/Rest.php",
                    "line": 359,
                    "function": "_parse_request_body",
                    "class": "Ushahidi_Rest",
                    "type": "->",
                    "args": []
                },
                {
                    "file": "/opt/lampp/htdocs/platform/application/classes/Ushahidi/Rest.php",
                    "line": 72,
                    "function": "_parse_request",
                    "class": "Ushahidi_Rest",
                    "type": "->",
                    "args": []
                },
                {
                    "file": "/opt/lampp/htdocs/platform/vendor/kohana/core/classes/Kohana/Controller.php",
                    "line": 69,
                    "function": "before",
                    "class": "Ushahidi_Rest",
                    "type": "->",
                    "args": []
                },
                {
                    "function": "execute",
                    "class": "Kohana_Controller",
                    "type": "->",
                    "args": []
                },
                {
                    "file": "/opt/lampp/htdocs/platform/vendor/kohana/core/classes/Kohana/Request/Client/Internal.php",
                    "line": 97,
                    "function": "invoke",
                    "class": "ReflectionMethod",
                    "type": "->",
                    "args": [
                        {
                            "request": {},
                            "response": {}
                        }
                    ]
                },
                {
                    "file": "/opt/lampp/htdocs/platform/vendor/kohana/core/classes/Kohana/Request/Client.php",
                    "line": 114,
                    "function": "execute_request",
                    "class": "Kohana_Request_Client_Internal",
                    "type": "->",
                    "args": [
                        {},
                        {}
                    ]
                },
                {
                    "file": "/opt/lampp/htdocs/platform/vendor/kohana/core/classes/Kohana/Request.php",
                    "line": 997,
                    "function": "execute",
                    "class": "Kohana_Request_Client",
                    "type": "->",
                    "args": [
                        {}
                    ]
                },
                {
                    "file": "/opt/lampp/htdocs/platform/httpdocs/index.php",
                    "line": 38,
                    "function": "execute",
                    "class": "Kohana_Request",
                    "type": "->",
                    "args": []
                }
            ]
        }
    ]
}