I am struggling with POST REST api's in Magento 2 as I am quiet new to it.
If its possible for you to provide me one post example like creation of product using oauth and admin account.
Or add to cart.
I put this query in programming questions too however i am in bit hurry that's why looking for quick solution.
Please please help me.
Thanks in Advance.
Hi - I don't have a sample handy sorry, but some hopefully useful tip until then.
I don't have sample code or CURLs for each of the above, but hopefully this helps a bit!
Pardon the intrusion on someone's question. I also want to thank you for the opportunity to have questions asked - I know a lot of questions can be way out of scope/place here but I do have something to ask in regards to the links you posted in particular on http://devdocs.magento.com/guides/v2.0/get-started/gs-web-api-request.html
Now I've previously been able to form/post-put/get info via the Soapv2 method in Magento 1.x fine, but that all seems to have been changed in M2.x. Two things I'm trying to wrap my head around:
For instance in the link referenced above, this assumes that you'll be making those calls from within the magento installation folder correct? For instance the $request method and creation of the curl request or am I reading this wrong? And if my assumption is correct (that these examples have to run from within the M2 installation), are there any methods to make these calls from outside of the M2 installation - even remotely?
Second, most of the examples reference the "app/code/Magento" structure, but everything seems to have been moved to "vendor/magento/module-xxxxx" - is this staying this way?
Thanks for any tips on this Alan!
That part of the docs is new to me (the team is chugging away at fleshing it all out). That particular code is sample code showing how you could use the Zend framework library to form a request to send to us, setting the headers etc. I think some intro text might help set it in context. There is no requirement to make requests from inside our code base - that would actually be unusual. The docs was trying to give an example of how you could build it in your own application, using an example based on Zend. I think a bit more intro text would help make the context clearer.
As to your second question, in GitHub the files are under app/code. But you are correct when you install with Composer they will sit under the vendor directory. The idea is the vendor directory is stuff you don't touch, as per Composer recommendations. The files are the same however. In my mind app/code is now for "local customizations", not official Magento shipped code. When you are developing the code base (like our internal developers, or a community member submitting a pull request) then all our code is "custom". When we release it for external projects, we bundle into Composer packages that others can then use - that packaging stage is when they move from "app/code" to "vendor". Yes, it is staying this way.
Thank you again for taking the time to clarify that. It actually all makes sense now, or at least it confirms some of my thinking. Especially when it comes to the examples. It so happens that I'm (re)building our backend on the Zend framework which in turn will talk back and forth with our M2 installation so I'm excited about that.
With some trial and error I've been able to pull orders from our M2 installation and I'm so close to having a workable solution to update them too; I'm not too familiar with M2 yet, so having documentation would've helped speed up that learning process a bit.
Hopefully there will be some expanded documentation on the M2 API in the near future!
Regarding API documentation, have you see the swagger docs? Not perfect, but a possibly useful resource. http://devdocs.magento.com/swagger/ Also if you are using SOAP, is the returned WSDL file useful for docs? Do do you find you need more "tutorial" style content, talking about how to use the specific API in greater depth? Just wondering what concrete area we most need to improve on here.
I actually found one of your posts a few days ago and another one on the breakdown of modules which helped a lot. I'm still on the fence between SOAP and REST methods. I'm using both for testing but seem to have more "luck" with REST. Ideally I would like to move everything over using SOAP so anything similar to the dev docs (SOAP implementation) for M1 would help a lot. I was completely new to Magento (1.x) and with the available docs I had a fully functional backend within 4 hours!
I don't necessarily think that "tutorial" style content would help the Magento team much (considering time and maintenance etc); anything similar to Mv1 docs with samples on the API's can be a big help - at least for me - and it helps to keep the clutter down. The v1 docs are perfect compared to the Zend style tutorials (see Album, Blog etc) which can get outdated and may cause confusion to some if it isn't kept up.