Hi All,
I am trying to read Magento customer from a C# third-party software.
When I enter SOAP into browser, its throwing error.
URL -
http://localhost:81/magento2-2.2.5/soap/default?wsdl&services=customerCustomerMetadataV1
Error-
Consumer is not authorized to access %resources
Please suggest, how to resolve this concern.
Thanks
Gautam
Solved! Go to Solution.
I understand your concern , but for that you need to contact to this - https://support.stitchlabs.com/
As they are not supporting soap api so
for magento 2 native api , you can refer this link - https://devdocs.magento.com/swagger/
Hope it helps !
Yes directly if you hit this URL in the browser it won't work and it gives the consumer not authorized the access error !
to access this api and get correct output - first you required to have accesstoken of this api
So use any api app - like POSTMAN - form there first pass the get accesstoken api - once you get the accesstoken - then you need to pass that accesstoken with this customerMetaData API
then it will display list of customer data
Thanks for prompt reply.
Thing is that I need to consume this web service in Visual studio, so Do I need to use postman tool for that.
Thanks
Gautam
POSTMAN app is just for testing purpose - just test the magento api , you don't required to use that in visual studio !
So as you mention you are using this in visual studio - below i am sharing a complete example of soap api - from there you get actual idea how its works !
<?php $request = new SoapClient("http://magento.m2/index.php/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2)); $token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"inchoo", "password"=>"GN2vKgfsszz43u")); $opts = array( 'http'=>array( 'header' => 'Authorization: Bearer '.json_decode($token->result) ) ); $wsdlUrl = 'http://magento.m2/soap/default?wsdl&services=directoryCurrencyInformationAcquirerV1'; $context = stream_context_create($opts); $soapClient = new SoapClient($wsdlUrl, ['version' => SOAP_1_2, 'context' => $context]); $soapResponse = $soapClient->__getFunctions();
Refer this link for more details - https://inchoo.net/magento-2/magento-2-api/
Thanks @Manthan Dave.
I got some idea on this now.
one more issue is that this URL - http://localhost:81/magento2-2.2.5/api/v2_soap/?wsdl=1
is not getting open.
What could be the reason.
Thanks
Gautam
Glad to know that you got some idea how to use this API
Regarding the URL which you have shared , from where you get this URL ? i think its not there in WSDL magento soap api library - something is missing in this url !
From this blog i got that URL
Thanks
Gautam
So which magento version are you using ? - because they have mention that this api won't work on magento 2 and in magento 1.9 lower version as well !
so its mainly depends on your magento version !
below is what they have written !
Running Magento CE v1.9.x (2.0 not supported) or Enterprise v1.14.x (2.0 not supported).
We are using newer version Magento 2.
Then for the newer version from where I will get this url .
Thanks
Gautam
I understand your concern , but for that you need to contact to this - https://support.stitchlabs.com/
As they are not supporting soap api so
for magento 2 native api , you can refer this link - https://devdocs.magento.com/swagger/
Hope it helps !