Showing results for 
Search instead for 
Did you mean: 

building api rest - insert register in table

building api rest - insert register in table

hi i have one problem whit my api rest, i am noob in this, i try do this 


namespace Inchoo\Hello\Model;
use Inchoo\Hello\Api\HelloInterface;
class Hello implements HelloInterface
     * Returns greeting message to user
     * @api
     * @param int $id Users id.
     * @param int $seller Users seller.
     * @param float $price Users price.
     * @param float $sprice Users sprice.
     * @return string Greeting message with users seller.
    public function name($id, $seller, $price, $sprice) {
    $conexion = mysqli_connect($host,$user,$pass);
    mysqli_query($conexion, "INSERT INTO marketplace_product (entity_id, mageproduct_id, adminassign, seller_id, store_id, status, created_at, updated_at, wk_commission, wk_commission_price, wk_seller_price, wk_special_price)
    VALUES ('190', '$id', '0', '$seller', '0', '1', '2017-11-05 15:51:15', '2017-11-05 15:51:15', '0', '$cprice', '$price', '$sprice')");
    return "insertado";

and my webapi.xml

<?xml version="1.0"?>
<routes xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
    <route url="/V1/hello/name/:id/:seller/:price/:sprice" method="GET">
        <service class="Inchoo\Hello\Api\HelloInterface" method="name"/>
            <resource ref="anonymous"/>

if i change GET by POST show me this:


if i put GET show me

and it don't save anythig


help pls