1

I have a API that was working before I did the upgrade. It returns JSON, but after upgrade it only shows:

Services Endpoint "my_test" has been setup successfully, and it never gets inside 'access callback' => ‘_my_test_access'...

Can anyone help me please?

My code:

function magmanager_services_resources() {  
return array(  

    'my_test' => array(  
        'create' => array(  
            'help' => 'My test',  
            'callback' => '_my_test',  
            'access callback' => ‘_my_test_access',  
            'access arguments' => array('create'),  
            'access arguments append' => TRUE,  
            'args' => array(  
                        array(  
                            'name' => 'pid',  
                            'type' => 'int',  
                            'description' => t('Pid'),  
                            'source' => array('data' => 'pid'),  
                            'optional' => FALSE,  
                        )  
                    )  
            )),  
);  
}  

function _my_test_access() {  

return TRUE;  
}  

function _my_test(){  

$arr = array('a' => '1');  
return json_encode($arr);  
}  

Testing in command line: $ curl -X POST -v -F "pid=44430" localhost/api/my_test

POST /api/my_test HTTP/1.1
User-Agent: curl/7.37.1
Accept: /
Content-Length: 143
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------03146779a7db0f80

< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Mon, 02 Feb 2015 18:21:27 GMT
* Server Apache/2.2.16 (Debian) is not blacklisted
< Server: Apache/2.2.16 (Debian)
< X-Powered-By: PHP/5.3.3-7+squeeze23
< Expires: Sun, 19 Nov 1978 05:00:00 GMT
< Last-Modified: Mon, 02 Feb 2015 18:21:27 +0000
< Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
< ETag: "1422901287"
< Vary: Accept-Encoding
< Content-Length: 56
< Content-Type: text/html
<
* Connection #0 to host left intact
Services Endpoint "my_test" has been setup successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.