function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun99Varun99 

SALESFORCE to MAGENTO integration

Hi,

 

 Anybody explain am stuck to integrate salesforce with magento am passing parameters using http callout

this is my code am getting this response like :

 

oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key

 

 

public void resp()
{
http H=new http();
HttpRequest req = new HttpRequest();
//String url= 'http://advaanz.com/magentoapitest/oauth/initiate';
req.setEndpoint('http://advaanz.com/magentoapitest/oauth/initiate');
//string Stringval='OAuth oauth_callback="'+EncodingUtil.urlEncode('https://c.ap1.visual.force.com/apex/megentoapi', 'UTF-8')+'",oauth_consumer_key="6nuzyesqo16saelvdazlodjvknurc2wh",oauth_consumer_secret="5fqgg8xrv9rvt88kz9o31bbe55zw6896"';

string Stringval='OAuth realm="http://advaanz.com/",oauth_consumer_key="6nuzyesqo16saelvdazlodjvknurc2wh",oauth_nonce="15ZN8FFR1700UQ6O",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1367319400",oauth_version="1.0",oauth_signature="4mphBg8VgYCV%2BeMIIMdZ%2BgD%2F6eM%3D"';
req.setMethod('POST');
req.setHeader('Content-length', '1753' );
req.setHeader('Content-Type', 'text/xml;charset=UTF-8');
string bVal=EncodingUtil.Base64Encode(blob.valueof(Stringval));
String authorizationHeader =bval;
req.setHeader('Authorization',bVal);
req.setbody('');
//req.setHeader('Accept','');
//req.setHeader('Host','api.magento.com');
req.setTimeout(50000);
HttpResponse res =h.send(req);
TestVal=res.getbody();
}

 

can any one explain how to integrate maganto using apex code?

 

Thankyou

 

krish99krish99

Hi Varun

 

  
       We are using magento. when customer create a quote in magento means that should be automatically populate into salesforce. how can i achieve this, which integration type i have to use.could you please help me. From where sholud i have to start.

suresh dupadasuresh dupada

Hi Varun

       Are you find any solution regarding this issue, Please Update Me, Because I am also facing same proble with magento, while testing form testsandbox. Actually I am using Oauth Playground to test normally it was worked fine  3 months back (To retrieve customers and orders from magento) with Oauth Play ground. But it is giving response like 403 forbidden error. 

             If you find any solution please update me........

ThankU
 

t4runjaint4runjain
Hi @Varun99,

Try to set the autherization values in request body in url/querystring form works for me :
req.setBody('oauth_nonce=test3&oauth_signature=test&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=testkey&oauth_timestamp='+DateTime.now().millisecond());

Let me know if this helps you or if there any question?

Regards,
Tarun Jain | Sr. Salesforce Developer/Consultant
salesforcelearner1salesforcelearner1
Hi Tarun,
can you share piece of code to construct request.

Thanks,
SL