Notes
Static Resource
[
{
"firstName": "Logan",
"lastName": "Smith",
"email": "logansmith@gmail.com",
"phone": "3456787658",
"gender": "Male",
"status": "active"
},
{
"firstName": "Mia",
"lastName": "Scott",
"email": "miascott@gmail.com",
"phone": "7865643456",
"gender": "Female",
"status": "active"
}
]
Apex Class
public class CustomerAPI {
public static void PostCustomerFromSR(){
StaticResource sr = [SELECT Id, body FROM StaticResource WHERE name ='Customers'];
String payload = sr.body.toString();
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://api.pathtosalesforce.com/customer.php?token='+token);
request.setMethod('POST');
request.setBody(payload);
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
HttpResponse response = http.send(request);
System.debug(response.getStatusCode());
System.debug(response.getStatus());
System.debug(response.getBody());
}
}