Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestResource(urlMapping='/jde_integration')
- global class JdeIntegration {
- @HttpPost
- global static void doPost() {
- String req = RestContext.request.requestBody.toString();
- System.debug('Req: '+req);
- // Data in format 'Sl.no Name Date City 1 Testfile 25.10.2014 Hyderabad'
- // Want to split on whitespace, at most 8 substrings (city might have spaces)
- String[] params = req.split('\s', 8);
- String name = params[5];
- String datt = params[6]; // date is a reserved word!
- String city = params[7];
- System.debug('Got name: '+name+', date: '+datt+', city:'+city);
- // Now you can insert a record, or do whatever you need to
- }
- }
- $ curl -v -H 'Content-Type: text/plain' -H 'Authorization: Bearer ACCESS_TOKEN'
- -d 'Sl.no Name Date City 1 Testfile 25.10.2014 Hyderabad'
- https://na1.salesforce.com/services/apexrest/jde_integration
- 09:14:41.127 (127782275)|USER_DEBUG|[7]|DEBUG|Req: Sl.no Name Date City 1 Testfile 25.10.2014 Hyderabad
- 09:14:41.139 (139188394)|USER_DEBUG|[17]|DEBUG|Got name: Testfile, date: 25.10.2014, city:Hyderabad
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement