Problem/Motivation

Hi, am trying to POST data to an endpoint using http_client_manager with parameters in a controller. Currently its working fine on the UI am able to POST and receive a response, but I i cant get it to work with parameters via ::call($command,$params) in my controller, no data is being passed to my parameters as defined on the post.json

[mymodule]\src\api\resources\post.json 
{
  "operations":{
    "CreateInvo":{
      "httpMethod":"POST",
      "uri":"invo.php",
      "summary":"Create",
      "parameters":{
        "content-type":{
          "location":"header",
          "default":"application/json"
        },
        "yourname":{
          "type":"string",
          "location":"json",
          "description":"The name",
          "required":true,
          "default":"ABC"
        },
        "yournumber":{
          "type":"integer",
          "location":"json",
          "description":"Your number",
          "required":true,
          "default":124
        }
      },
      "responseModel":"Post"
    }
  },
  "models":{
    "Post":{
      "type":"object",
      "properties":{
        "details":{
          "type":"object",
          "location":"json",
          "properties":{
            "name":{
              "location":"json",
              "type":"string"
            },
            "number":{
              "location":"json",
              "type":"integer"
            }
          }
        },
        "message":{
          "location":"json",
          "type":"string"
        }
      }
    }
  }
}

Controller

/*the method that is pointed in my routing.yml*/
public function createInvo(){
    $params=array("yourname"=>"mike","yournumber"=>123);
    $response= $this->httpClient->call('CreateIlnvo',$params);
    return [
      '#type' => 'markup',
      '#markup' => $response,
    ];
  }

Comments

MikeSorus1489 created an issue. See original summary.

avpaderno’s picture

Assigned: » Unassigned
Priority: Major » Normal
MikeSorus1489’s picture

Status: Active » Closed (works as designed)
avpaderno’s picture

Status: Closed (works as designed) » Closed (outdated)