All Questions
590 questions
4
votes
1
answer
5k
views
REST API and setting the quotes Billing & Shipping addresses
In Magento 2.2 there is an API endpoint of:
/V1/carts/mine/billing-address
And this accepts JSON in a POST request like this:
{
"address": {
"region": "somewhere",
"country_id": "GB",
...
4
votes
2
answers
3k
views
Magento 2: How do I notify a customer about an order status change done via the REST Api?
I'm using the rest API
.../index.php/rest/V1/orders/561/
in order to update my order status:
Payload (POST):
{
"entity": {
"entity_id": 561,
"state": "new",
"status": "pending"
}
}
...
4
votes
3
answers
9k
views
Magento 2 searchCriteria using REST APIs
I have the following query:
$url =
http://kostakfashion.com/rest/V1/products/?searchCriteria[filter_groups][0][filters][0][field]=category_gear&searchCriteria[filter_groups][0][filters][0][...
4
votes
1
answer
926
views
Differences between Magento 1 and Magento 2 REST API?
What's the difference between endpoints and integrations?
My main question is for basic things like products, orders and customers, but also like an overview.
4
votes
1
answer
3k
views
Magento 2 call external REST api
I am trying to call external api from Magento. Below is the request,
$client = $this->_httpClientFactory->create();
$client->setUri('thirdpartyurl.com/api/');
$client->setMethod(\...
4
votes
2
answers
5k
views
Magento 2: How to create new customer cart via rest API?
I want to place an order for a customer from API. Currently, I do:
Login as integration (OAuth).
Create customer
Create customer cart (or take an existing one).
Remove all items from the cart.
Add ...
4
votes
2
answers
858
views
Getting http code 400 on Magento REST API call where token has 'admin' & 'all' privileges
I'm trying to create a customer using the Magento REST API.
I can use my token to retrieve/update data just fine, but for whatever reason I am unable to create an account, regardless of the ...
4
votes
3
answers
8k
views
where to find Magento 2 API docs?
Finally I found out the magento 2 api endpoint for all products as below
rest/V1/products?searchCriteria[pageSize]=20
but I need more detailed docs about api endpoints which I coudn't find out yet. ...
4
votes
0
answers
270
views
What is the correct way to create Mock input interface in Web-Api functional test?
I've already write successfully a Web-Api unit test for a Custom API. But I'm wondering if there is a way to automatically create a Mock for input data for the API?
For example, AccountManagement ...
4
votes
0
answers
570
views
Magento 2 add customer address attribute to REST APIs response?
I have created customer address attribute "city_id" with setup script.
I am able to save the value. but want to display the city_id field to the below apis json response. how we can we add city_id in ...
4
votes
0
answers
156
views
magento 2 REST API for cutom collection based on store code [closed]
magento 2 REST API for custom collection based on store code how to pass store id
rest/store_code/V1/banners
rest/ar/V1/banners
different store having different banners so how to get the banners ...
4
votes
1
answer
2k
views
Sign Up With Avatar REST API Validation Error : Magento 2
I have this code for image attribute (avatar).
app/code/Ibnab/CustomerPut/Setup/InstallData.php :
<?php
namespace Ibnab\CustomerPut\Setup;
use Magento\Framework\Module\Setup\Migration;
use ...
4
votes
0
answers
188
views
Magento - Create order using REST API
I need to create place order using REST API. I want to help someone to create API. If you have any reference URL for perfect code please let me know.
3
votes
3
answers
12k
views
Passing Array in REST Api Magento2 (Post Method)
I have created many rest Api in magento2 which working perfectly... I have only problem to pass the array in custom rest api...
for example I am passing the data in below format from postman.
{"...
3
votes
2
answers
2k
views
How to call a 3rd party API from a controller? Magento 2
I built a custom module. Its admin tables with CRUD functionality. I am putting a new button on the grid via the Ui_component listing XML file. When this button gets clicked I want to call a 3rd party ...
3
votes
1
answer
6k
views
Featured and related products REST API Magento 2
Is there is a built in REST APIs for both Featured and Related products in Magento because I looked in the reference and couldn't find?
3
votes
1
answer
5k
views
Invalid auth/bad request. Magento rest api
I followed http://devdocs.magento.com/guides/m1x/api/rest/authentication/oauth_configuration.html
I am able to login to "My first application" with admin.
But not with customer.
I got $_SESSION ...
3
votes
2
answers
4k
views
Magento 2: cURL webAPI request for Customer search
Trying to find a way how to integrate Magento 2 via cURL to search for a customer.
For Example the below command is able to bring the customer details of 8
curl -X GET "http://example.com/index.php/...
3
votes
1
answer
5k
views
Magento 2 Product Custom Attribute in API rest
I added a product custom attribute (type text) through the admin interface.
Now I'm trying to save a product through the api rest but if I include the new attribute in the data passed I get this ...
3
votes
3
answers
7k
views
How to get Custom HTTP header in Magento2 controller?
I'm accessing my controller via postman tool (Postman)
I've passed custom header as shown in image and trying to access it in controller through this code:
$this->_response->getHeader('APP_ID'...
3
votes
2
answers
2k
views
How to use token base Rest API?
I have created custom module and also implemented API in that but I want to
know other two ways Auth base and Token base access.
My webapi.xml file:-
<?xml version="1.0"?>
<routes xmlns:xsi=...
3
votes
1
answer
992
views
How can I programmatically create a RESTful api role and consumer?
How can I create a RESTful role and consumer during the installation of an extension (module) using a data-install script located at:
app/code/community/Namespace/Module/data/namespace_module_setup/...
3
votes
1
answer
1k
views
Magento 2 API: 3rd Party makes a post request to magento API with x-www-form-encoded data
I am trying to integrate a payment gateway with my headless magento 2 website.
So after the payment is processed/failed, the payment website makes a POST request to my API with x-www-form-encoded ...
3
votes
1
answer
2k
views
Retrive Configuration data via API
Is Magento giving any default REST API for retrieving configuration (system.xml) data ?.
If yes then share URL.
Else share the best approach for retrieving configuration data via REST API.
3
votes
2
answers
1k
views
Rest API - magento 1.9 - Return 403 Access denied - Magento\Framework\Webapi\Exception::HTTP_FORBIDDEN - format - https://abc.in/api/rest/customers
Error : Rest API for customer return 403 access denied error.
Format : website/rest/api/customer -> 403 access denied error
Magento\Framework\Webapi\Exception::HTTP_FORBIDDEN
3
votes
2
answers
3k
views
How can I get the HEX code in Visual Swatch via Rest API
Could anyone help me to find the rest api to get hex or image of visual swatch attribute?
I need the api to return the following,
Label
Value
HEX or Image of the swatch.
Thanks
3
votes
1
answer
4k
views
When i request for token(REST API).It returns the following error...
When I am using content type="application/json",I cant passing any parameters and also returns
"message": "Decoding error."
When I am using content type="application/x-www-form-...
3
votes
1
answer
6k
views
Trying to add product with description via REST
Apologies if this is a silly question, I'm sure it must be but I just can't seem to figure out how you are supposed to add a product's description via REST.
The REST API docs at http://devdocs....
3
votes
2
answers
3k
views
Invalid webservice adapter specified REST API
I have configured the rest api in my localhost magento. When I Hit this url, http://localhost/magento/api/rest/products
The error is:
Invalid webservice adapter specified.
3
votes
2
answers
658
views
Magento2: Module Vault rest api help
I have created a webapi.xml in module vault:
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"&...
3
votes
1
answer
3k
views
Magento 2: Successful oAuth/Integration Flow
Does anyone have or know of working PHP code to complete an oAuth API integration request flow? I've gotten past the activation step, and my application has the following information
[...
3
votes
1
answer
8k
views
Magento 2 rest api - How to post a product attribute?
I'm new in Magento 2, I want to add an attribute using REST api. Is it possible? I use the follow code for products:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', ...
3
votes
2
answers
2k
views
Magento2 Rest api get admin customer details and orders
If I login as an admin user, how can I get details of customer and orders list with payment details using REST API in Magento2
3
votes
1
answer
3k
views
Custom REST API - resource not found
I have followed the tutorial and making a simple REST API.
api2.xml FILE
<?xml version="1.0"?>
<config>
<api2>
<resource_groups>
<custac translate=...
3
votes
2
answers
7k
views
Getting 403 Forbidden response with REST API on CE 1.9.1.0
I'm using this link as my model for testing the REST API, and I get all the way through the authorize prompt to a "403 Forbidden" response (this is for both the customer and admin examples).
Invalid ...
3
votes
2
answers
2k
views
Magento 2 How to Update custom order attribute using REST API
I am using this -
extension_attributes.xml
<extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
<attribute code="custom_sales_id" type="string&...
3
votes
1
answer
2k
views
Magento 2: Run reindexer using REST API
Is any one having tried to create REST API so using custom API one can trigger re-indexing?
which method do i have to mention in webapi.xml file as this is purely AREA::ADMIN activitiy. currently ...
3
votes
1
answer
1k
views
Magento 2 for logged In customer need to add shipping address every time i place a new order?
This is what i am following...
1. Add Configurable product in cart.
http://magento-host/index.php/rest/default/V1/carts/mine/items
method : POST
Authorization : Bearer <customer token>
body ...
3
votes
2
answers
4k
views
Magento2 REST API - Cannot create cart/quote for customer
I am building a shoppingcart using the Magento2 Rest API and I want to create a cart for a customer and (if not logged in) for a guest.
For guest carts is it working:
Create a guestcart:
POST ...
3
votes
1
answer
2k
views
Create order with REST API, without cart
I'm using REST API with token authentication to export data from a M1 to a fresh installation of M2.2.0 installation.
Everything works fine with customers and products, but I cannot manage to ...
3
votes
1
answer
51
views
Magento APIs mapping to Mobile Per Screen API Request
I'm leading an API team on Magento 2.2 in supporting a mobile development team.
The mobile team is asking for APIs to be developed that support an "API per Page" type of architecture where they are ...
3
votes
1
answer
2k
views
Magento 2: SMS Integration REST API
I have an API URL of SMS Gateway :
https://smsexample.net/test/api.php?username=xxxx&password=xxxx&from=xxxx&to=xxxx&text=xxxx
How can I make REST API using this gateway, so can call ...
3
votes
1
answer
3k
views
Magento 2 - How to get attribute options array for inserting the data using rest api
I have json array for attribute options which is showing below:
"options":[
{
"label":"string",
"value":"string",
"sort_order":0,
"is_default":true,
"store_labels":[
{
"store_id":0,
...
3
votes
2
answers
3k
views
Magento 2 custom authentication for API
I want to implement custom ACL for my custom API. Can someone assist me how to achieve this.
Below is my webapi.xml file content:
<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/...
3
votes
1
answer
2k
views
Why do I get unauthorized for REST API
I setup the admin to access resources through REST API.
Here is my current setup:
Then I assigned a Role user for the admin:
When I login as an admin and try to access the REST API, I still get ...
3
votes
1
answer
1k
views
How to get a Product ID after a product post via REST api to update product category
I want to insert products from a csv-file into the Magento DB via the REST API.
First I try to update one single product.
The product is inserted into the db but this product needs to be assigned to ...
3
votes
4
answers
694
views
Unable to set customer group when create customer with REST API
In Magento 2.4.5 I'm trying to create customer with REST API. In the payload I specify the group ID, but the new customer always get the default group ID.
Example payload:
$customerData = [
'customer' ...
3
votes
0
answers
591
views
What is protect code used for?
We're working on a project where we're replacing our existing web store with a custom Magento integration.
We need a way for a guest customer to retrieve information about their order by following a ...
3
votes
0
answers
1k
views
2FA REST API using Postman
I have followed the steps at: https://devdocs.magento.com/guides/v2.4/security/two-factor-authentication.html to get a token in order to use Postman to fetch Magento 2 REST endpoints e.g. products, ...
3
votes
1
answer
615
views
Custom REST API for fetch all product with stock information
I am creating custom rest API for getting all products including out of stock products too but I am not able to get out of stock products.
/**
* Get products with filter.
*
* @param string $...