0 votes

Hi,

I've been trying to use the json api on a test environment. Every time I send a request, it just reflects the json body I sent back to me instead of the data I request.

I use this url: {testenvironment}/crm/json

These are the request headers:
enter image description here

These are the response headers:
enter image description here

I have a feeling I'm missing something obvious.

asked in Efficy/ Client side by

3 Answers

0 votes

Could you give us the body, too?

answered by (120 points)
Hey, thanks for replying, but I fixed it. The body of my request was not properly formatted.
In case you didn't find it, here is more explanation about the remote APIS's in Efficy 11

https://help.efficy.com/edn/admin/crft_11_remoteapis
0 votes

An example of two wrapped operations in a JSON body is the following.

Posted to http://hostname/crm/json with the headers combo X-Efficy-User & X-Efficy-Pwd. Alternatively, use the API key header X-Efficy-ApiKey

Raw body:

[
    {
        "@name": "api",
        "@func": [
            {
                "@name": "currentuserfullname"
            },
            {
                "@name": "currentusergroups"
            }           
        ]
    }
]

Response

[
    {
        "@name": "api",
        "@func": [
            {
                "@name": "currentuserfullname",
                "#result": "Administrator",
                "#handled": true
            },
            {
                "@name": "currentusergroups",
                "#result": "1;99999001;99999002;99999004",
                "#handled": true
            }
        ],
        "#handled": true
    }

]

answered by (7.4k points)
0 votes

As in SOAP requests, JSON requests are handled by parsing the list of request blocks and then function blocks within those, and the response is identical to the request, with each block marked as "handled" when it is processed correctly, and with the result data for that function call inserted into that block, either into the #result property when it's a scalar value, or a sub object when it's a complex datatype (dataset, list, object, etc)

answered by (449 points)
1,249 questions
1,518 answers
1,858 comments
328 users