-
-
Save kandy/dd6592508c5774d9235d to your computer and use it in GitHub Desktop.
<?php | |
/** | |
* Created by PhpStorm. | |
* User: akasian | |
* Date: 10/6/15 | |
* Time: 9:45 AM | |
*/ | |
ini_set('display_errors',1); | |
$token = "67ihe78il86214jgt8asjr9fhvl9i41r"; | |
$baseUrl = 'http://mage.dev/rest/'; | |
for ($i = 1; $i <= 10; $i ++) { | |
$postdata = json_encode([ | |
"customer" => [ | |
"email" => "user{$i}@example.com", | |
"firstname" => "John", | |
"lastname" => "Doe", | |
"addresses" => [ | |
[ | |
"defaultShipping" => true, | |
"defaultBilling" => true, | |
"firstname" => "John", | |
"lastname" => "Doe", | |
"region" => [ | |
"regionCode" => "CA", | |
"region" => "California", | |
"regionId" => 12 | |
], | |
"postcode" => "90001", | |
"street" => ["Zoe Ave"], | |
"city" => "Los Angeles", | |
"telephone" => "555-000-00-00", | |
"countryId" => "US" | |
] | |
] | |
] | |
]); | |
$opts = ['http' => [ | |
'method' => 'POST', | |
'header' => implode("\n", [ | |
"Authorization: Bearer " . $token, | |
'Content-type: application/json' | |
]), | |
'content' => $postdata | |
]]; | |
$context = stream_context_create($opts); | |
var_dump(file_get_contents( $baseUrl . 'default/V1/customers/', null, $context)); | |
} |
Stack Trace:
http://192.168.0.183/NewMagento2/soap?wsdl&services=customerCustomerRepositoryV1
loading http://192.168.0.183/NewMagento2/soap?wsdl&services=customerCustomerRepositoryV1
Acquiring the wsdl...
Resolving the wsdlendpoint...
Generating code...
Code generation failed.
Microsoft.FSharp.Core.FailureException: Assembly not yet created.
at Storm.Types.WebSvcManagerOps.clo@90.CreateWebServiceModel()
at <StartupCode$Storm>.$Type.bgworker.run@51@57_2.Invoke(DoWorkEventArgs dArgs)
at <StartupCode$Storm>.$Type.bgworker.run@51@57_1.Invoke(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
@VLCSolutions, can edit app/bootstrap.php file, uncomment ini_set('display_errors', 1); open http://192.168.0.183/NewMagento2/soap?wsdl&services=customerCustomerRepositoryV1 in browser and copy page structure in gist?
@kandy page is too long so i have copied part of the text
@kandy Have you found the way to get XML request
no, sorry i have no idea what problem you have
for me all work fine
@kandy, Please find the first image which i'm able to get xml request by giving the url http://192.168.0.183/magento1131/api/v2_soap/?wsdl=1 in magento1
Observe the second image throwing error after giving the URL http://192.168.0.183/NewMagento2/soap?wsdl&services=customerCustomerRepositoryV1 to get the xml request in magento2
you are calling customer request api each time for the each customer, but i want to send multiple customers in a single request