You need to sign in to do that
Don't have an account?
sravanthi k 4
How to image urls into salesforce throught REST resource
Hi,
Integration with PHP
My requriement is that when user uploads image in php site i need to get the image url into salesforce throught rest api and then i have pass response that image has been attached
My code;
@RestResource(UrlMapping='/handm/v1.0/itemdetails/*')
Global with sharing class HandMProducts{
@HttpGet
global static string doGet(){
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
system.debug('---------->request req'+req);
system.debug('---------->request url '+req.requestURI);
System.debug('=============== req.requestURI -'+ req.params);
String method = req.params.get('method');
System.debug('============= method-' + method);
if(method == 'Attach'){ System.debug('====Attach========= method-' + method); String itemid=req.params.get('Itemid'); string url =req.params.get('url'); System.debug('====Attach=========-' + itemid); System.debug('====Attach=========-' + url ); return Attach(itemid,url); }
return null; }
global static string Attach(String Itemid,string url){ System.debug('==========Attach======= - ' +Itemid); System.debug('==========Attach======= - ' +url); Item__c a = [select id,name from Item__c]; if(a.id==Itemid){ a.URL__c = url; System.debug('==========Attach======= - ' +a.URL__c); insert a; System.debug('==========Attach======= - ' +a); } System.debug('==========Attach======= - ' +a.id); return a.id; }
can any help me out please
Integration with PHP
My requriement is that when user uploads image in php site i need to get the image url into salesforce throught rest api and then i have pass response that image has been attached
My code;
@RestResource(UrlMapping='/handm/v1.0/itemdetails/*')
Global with sharing class HandMProducts{
@HttpGet
global static string doGet(){
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
system.debug('---------->request req'+req);
system.debug('---------->request url '+req.requestURI);
System.debug('=============== req.requestURI -'+ req.params);
String method = req.params.get('method');
System.debug('============= method-' + method);
if(method == 'Attach'){ System.debug('====Attach========= method-' + method); String itemid=req.params.get('Itemid'); string url =req.params.get('url'); System.debug('====Attach=========-' + itemid); System.debug('====Attach=========-' + url ); return Attach(itemid,url); }
return null; }
global static string Attach(String Itemid,string url){ System.debug('==========Attach======= - ' +Itemid); System.debug('==========Attach======= - ' +url); Item__c a = [select id,name from Item__c]; if(a.id==Itemid){ a.URL__c = url; System.debug('==========Attach======= - ' +a.URL__c); insert a; System.debug('==========Attach======= - ' +a); } System.debug('==========Attach======= - ' +a.id); return a.id; }
can any help me out please