Let me share my experience with REST.
1. Apex REST supports both XML and JSON for
resource formats sent in REST request and responses. By default, Apex REST uses
JSON to represent resources. Now here I got the problem with the size of JSON
file because SDFC can accept less than 3 MB file. SO What I did, I removed all blank spaces and also we suggested third application
developer to send the file less than 3 MB if the file is larger than they will
split the file into a smaller size. That helps us a lot.
2. Always
tried to map the exact api name of the field in the JSON that you are accepting
from the other side. Otherwise, you need to deserialize the parameter in the method
that will unnecessarily increase the complexity.
Ø For example Below are two formats of JSON
and used to update account :
1.
{
"Name" :
"ParentUpdate Manoj11",
"Industry" :
"Consultant",
"Phone" :
"9891798737“
}
2.
{
"Account_Name" :
"ParentUpdate Manoj11",
"Account_Industry" :
"Consultant",
"Account_Phone" :
"9891798737",
}
•So both
will work fine but In first we no need to deserialize the JSON because we are
mapping with the same API but In the second JSON we need to make this JSON deserialize.
That will unnecessarily make the
method complex.
No comments:
Post a Comment