magento2 – Add attributes to the Order API shipping_address

Okay, after stepping trough some other places, I’ve eventually identified how I can add the attributes to a additional key called extension_attributes inside billing_address. Not exactly what I was looking for, but a good start.

My extension_attributes.xml looks like this now:

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="MagentoSalesApiDataOrderAddressExtensionInterface">
        <attribute code="my_attr_1" type="string" />
        <attribute code="my_attr_2" type="string" />

Also, I’ve created in my module etc/webapi_rest/di.xml with this content:

<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoSalesModelOrderRepository">
        <plugin name="order_repository" type="SEECRestApiPluginMagentoSalesModelOrderRepository" disabled="false" sortOrder="200" />

And created this file to attach the data properly:


namespace SEECRestApiPluginMagentoSalesModel;

use MagentoSalesApiDataOrderInterface;
use MagentoSalesModelOrderRepository as ModelOrderRepository;

class OrderRepository

     * @param ModelOrderRepository $orderRepository
     * @param OrderInterface $order
     * @return OrderInterface
    public function afterGet(
        ModelOrderRepository $orderRepository,
        OrderInterface $order
    ) {
        $billingAddress = $order->getBillingAddress();
        $billingAddressExtensionAttributes = (null !== $billingAddress->getExtensionAttributes())
            ? $billingAddress->getExtensionAttributes()
            : '';



        if (!$order->getIsVirtual()) {
            $shippingAddress = $order->getShippingAddress();
            $shippingAddressExtensionAttributes = (null!== $shippingAddress->getExtensionAttributes())
                ? $shippingAddress->getExtensionAttributes()
                : '';


        return $order;

api – Arduino ESP8266 HTTPS Request returning empty response

I want to get some JSON data from a HTTPS secured Webserver using a ESP8266.
For some reason I’m getting an empty response, I believe there’s an error parsing the GET request.
In Chrome I get the JSON response without problems.

GET Request:

httpsClient.print(String("GET ") + path + " HTTP/1.1rn" +
               "Host: " + host + "rn" +               
               "Connection: closernrn");

Host and Path:

const char *host = "";
const char *path = "/jsonapi/game/current";

the whole function:

void connect() {

WiFiClientSecure httpsClient;    //Declare object of class WiFiClient

  Serial.print("HTTPS Connecting");
  int r=0; //retry counter
  while((!httpsClient.connect(host, httpsPort)) && (r < 30)){
  if(r==30) {
    Serial.println("Connection failed");
  else {
    Serial.println("Connected to web");
  String getData, Link;

  //GET Data

  Serial.print("requesting URL: ");

  httpsClient.print(String("GET ") + path + " HTTP/1.1rn" +
               "Host: " + host + "rn" +               
               "Connection: closernrn");

  Serial.println("request sent: ");
  Serial.println(String("GET ") + path + " HTTP/1.1rn" +
               "Host: " + host + "rn" +               
               "Connection: closernrn");
  while (httpsClient.connected()) {
    String line = httpsClient.readStringUntil('n');
    if (line == "r") {
      Serial.println("headers received");

  Serial.println("reply was:");
  String line;
    line = httpsClient.readStringUntil('n');  //Read Line by Line
    Serial.println(line); //Print response
  Serial.println("closing connection");
  delay(2000);  //GET Data at every 2 seconds

Someone finding the mistake?

web application – Is OAuth more secure compared to API Keys

I have worked on many API integrations scenarios, and I used 2 approaches to authenticate the API calls, as follow:-

  1. Using API Keys

For example inside hubspot integration i use this web call to get all the accounts using API Key:-**********&properties=website&properties=mse_scan&properties=phone&limit=100
  1. Using OAuth.

For example inside SharePoint >> I create an app which generate a ClientID & ClientSecret, then inside my project web.config i pass/define the clientID & CleintSecret

 <appSettings file="custom.config">
    <add key="ClientId" value="e****7" />
    <add key="ClientSecret" value="**=" />

now in both cases we have confidential info been passed/stored, either APIKey or ClientID and ClientSecret. so can i say that from a security point of view I can not say that oAuth is more secure compared to using APIKeys? as if someone (let assume a hacker) get the APIKey then he can integrate with the our application + if a user got the ClientID and ClientSecret then he can integrate with the application as well..

docker – How should I authorize calls to an API behind an Apache reverse proxy behind CAS authentication?

Apologies if this is incoherent. I’m very new.

I have an Apache server protected by CAS in a Docker container. I’m using mod_auth_cas to do this. I have an API running on a different container which is accessed through a reverse proxy using ProxyPass so that the user must be authorized to make API calls. I now want to know the UID in my API so that I can make sure that the user has permissions.

I’m hoping that there’s a way to add an additional parameter with the verified UID to incoming API calls. I feel like there should be some way to do this with mod_rewrite, but I’m not sure how. I suppose I’d have to get the UID as a string.

c++ – Designing a library API to allow for interactivity

The application I’m currently working on is deeply coupled to the UI framework in use (Qt at the moment). I would like to separate the UI-specific code from the rest as much as possible, with the goal of creating a library for use with other toolkits in the near future.

I have already started this work but I am struggling with the architecture of the application when it comes to interactivity: moving code out of the UI is not that hard, but I would like to keep things such as progress indicators and warning message boxes working. One thing I am doing right now is to pass a “show_progress” functor that takes one argument and updates the progress dialog, but I am not sure if this will work in the long run; I would pretty much either need multiple functors per library call or create one big interface that would have methods for progress bars, message boxes, etc.

What are some solutions or resources to help me sort these problems out?

magento2 – magento 2 get folter attributes values in custom api

Hi i created custom API in magento 2 in that i need to implement advance search like store brand,model and year search like this enter image description here

i am able to get brand fileds `

public function getAddtocar($attribute) {

//        echo "sdfkjhsdkjfhsdkjhfkjdshfjkds";

        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $filterableAttributes = $objectManager->getInstance()->get(MagentoCatalogModelLayerCategoryFilterableAttributeList::class);
        $layerResolver = $objectManager->getInstance()->get(MagentoCatalogModelLayerResolver::class);
        $filterList = $objectManager->getInstance()->create(
                MagentoCatalogModelLayerFilterList::class, (
            'filterableAttributes' => $filterableAttributes
        $layer = $layerResolver->get();
        $filters = $filterList->getFilters($layer);
//                    $maxPrice = $layer->getProductCollection();

        $i = 0;
        $values = ();
        $filterAttrs = ();
        foreach ($filters as $filter) {
            $attr_code = (string) $filter->getRequestVar();
            if ($attr_code == $attribute) {
                $attr_label = (string) $filter->getName();
                $items = $filter->getItems(); //Gives all available filter options in that particular filter
                foreach ($items as $item) {

                    $values() = array(
                        "id" => $item->getValue(),
                        "count" => $item->getCount(),
                        "label" => strip_tags($item->getLabel()));
//                $logger->info('Array Log count of values' . print_r($values, true)); // Array Log  
                if (!empty($values) && count($values) > 1) {
                    $filterAttrs() = array(
                        "label" => $attr_label,
                        "options" => $values,
                        "code" => $attr_code);
        $response = ('status' => 'true', 'layeredData' => $filterAttrs);
        echo $json = json_encode($response, JSON_UNESCAPED_UNICODE);

`by using abouve code i am able to show brand fileds which assigned to products after selection of brand need to get model filed
forexample:: brand->hyundai,lexus,kia once select kia i need to get kia related model can any one suggest how to get like selection based

sharepoint online – SP REST – add an existing group to site with REST api?

You can assign permissions to SharePoint group using SharePoint REST API like:

function setPermissionForGroup(){
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/roleassignments/addroleassignment(principalid=<GroupId>, roledefid=1073741827)",
        type: "POST",
        contentType: "application/json;odata=verbose",
        headers: { "Accept": "application/json; odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val(),"X-HTTP-Method": "POST" },
        success: function (data) {
            alert('Contribute permission set on group');
        error: function (data) {
            alert("Error: " + JSON.stringify(data));

Replace <GroupId> with the ID of SharePoint group. Open the SharePoint group & you will find the group ID in browser URL:

enter image description here

roledefid for Permission Levels are as follows:

  • Full Control: 1073741829
  • Design: 1073741828
  • Edit: 1073741830
  • Contribute: 1073741827
  • Read: 1073741826
  • Limited Access: 1073741825
  • View Only: 1073741924

You need to convert above REST call in Power Automate Send an HTTP request to SharePoint action.

magento2 – Stock quantity change API

I want to change quantity number on specific product after payment receive. And after that I reveave 400 error.

Is it possible to change the stock quantity? Or Am I doing something wrong?
I try to do API CALL with url and body


    "product": {
        "sku": "<skuNumber>",
        "extension_attributes": {
            "stock_item": {
                "qty": 4

How could I make my own API to query the blockchain

I’m looking to access transaction history for some specific coins directly from the blockchain. The main reason is that most of current API are not free or don’t provide information for the coins I want.

I’m interested in the Bitcoin block chain but in the BSC as well. And for both I’m having issues understanding if I need to run a node myself in order to retrieve transaction or if some “public” node allow people to query them for information.
On top of that, I can’t find any information related to what would be the way to request information from the node, like using REST or something.
Same goes in the case I want to run the node myself, not much information on what the exposed interface would be etc…

Doesn’t anyone already tried to build his own API on a chain ?

Validating REST API requests against previous requests as part of a larger process

I am building a REST API for warehouse inventory picking.

I have a very shallow understanding of REST, so to me that just == stateless and try to make your URL mappings nouns instead of verbs.

The picking process looks like this:

  1. Scan QR on a the shipping instruction sheet which contains an order number along with all SKU’s and their quantities. This could be
    thought of as an aggregate for the entire picking transaction, kicking
    off the order as “in progress”.

  2. Iterate the following steps until all SKUs are picked

    2.a: Scan QR on the physical location being picked from

    2.b: Scan QR on the inventory container at the location

    2.c: Scan QR on the customer label that will be attached to the inventory container

  3. Scan QR on the physical delivery location and drop off the order

Each one of these steps has it’s own API endpoint and needs to validate things like

  • Does the order number match the order this user is currently picking?
  • Is this location allowed to be picked from for this order number?
  • Is this a valid inventory container for the order? (SKU not already picked, SKU actually on the order, correct quantity, that sort of thing)
  • Does the SKU on the customer label match the SKU that was previously scanned on the inventory container?

I don’t understand how I could create a stateless REST API that meets these requirements. Without state, how do I validate the integrity of every request to make sure the order is being picked correctly?

I had the thought that maybe I’ll just have the client pass in the current state of the order on every request (giving me all the data I need to validate a request) but then that assumes I actually trust the client to maintain the correct state, which of course is a bad idea.

Or maybe I could maintain the state of the order on a backend database, and have the client pass me the order number on every request to look it up? This just seems like state with extra steps.

Or maybe I need to move past the idea that this HAS to be a stateless system and break the rules of REST?

Thanks in advance for any advice!