<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Otávio Cruz</title>
    <description>The latest articles on DEV Community by Otávio Cruz (@otbox).</description>
    <link>https://dev.to/otbox</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2859772%2Fd088ded3-912e-4830-9ad8-a64b434943a0.jpeg</url>
      <title>DEV Community: Otávio Cruz</title>
      <link>https://dev.to/otbox</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/otbox"/>
    <language>en</language>
    <item>
      <title>API POSTfull</title>
      <dc:creator>Otávio Cruz</dc:creator>
      <pubDate>Thu, 13 Feb 2025 21:05:13 +0000</pubDate>
      <link>https://dev.to/otbox/api-postfull-28p</link>
      <guid>https://dev.to/otbox/api-postfull-28p</guid>
      <description>&lt;p&gt;In my high school had programming classes, not so properly to learn something, them the programming teacher, only told the less than basic about REST API, to operate with databases. This way, i saw a new and simple way to solve the problem with REST, the way was use only &lt;strong&gt;post&lt;/strong&gt;.&lt;br&gt;
I saw problems, with get, pass params in the path, was very insecurity. And i wasn't to expose the php file so directly, and wasn't create multiple endpoint, then edits them.&lt;br&gt;
A Example Below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $data = json_decode(file_get_contents("php://input"), true) ?? $_POST;
    if(isset($data['Operation'])){ 
        $WhoOperation = $data['Operation'];
        $content = $data['Content'];

        switch ($WhoOperation) {
            case 'select':
                SelectAllEmpresas($conn);
                break;
            case 'VerifyAccount':
                getUser($conn, $content);
                break;
            case 'selectUsers': 
                SelectUser($conn,$content);
                break;
            case 'addUser':
                addUser($conn,$content);
                break;
            case 'deleteUser':
                deleteUser($conn,$content);
                break;
            case 'alterUser':
                alterUser($conn,$content);
                break;  
            default:
                error404();
        }
    }else{
        error404();
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above, had all the operations of an CRUD, only with posts. Only when i learned more about API, and discussing with friends, i named it POSTfull. It's a predecessor of GraphQL, i think, actually. I was very funny this code today.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>php</category>
    </item>
  </channel>
</rss>
