title: How to create Post request to Rails API using Postman?
body: <p>I am new to Postman. I have a Rails server running on the background. I am trying to mock a POST request, but it is not being accepted. </p>
  
  <p>Let's say the model is called <code>manufacturer_organization.rb</code>. Inside, it <em>requires</em> 3 parameters: <code>organization_id (uuid data type), manufacturer_id (integer data type), and account_number (string data type).</code> <code>manufacturer_organization</code> belongs_to organization and it also belongs_to :manufacturer (vice versa; manufacturer and organization has_many manufacturer_organization)</p>
  
  <p>Inside <code>manufacturer_organizations_controller.rb</code>, I have a create method:</p>
  
  <pre><code>  def create
      @manufacturer_organization = ManufacturerOrganization.new(manufacturer_organization_params)
      if @manufacturer_organization.save
        puts "success!"
        render json: @manufacturer_organization
      else
        puts "Sorry, something went wrong"
      end
    end
  </code></pre>
  
  <p>I can confirm that I have sufficient authorization; when I perform a GET request I got the right JSON response. I am using rails serializer and I have setup serializer for this model as well. Route is also setup using <code>resources :manufacturer_organizations</code>. My gut feeling says the way I am using postman is wrong.</p>
  
  <p>Here is the screenshot of Postman app. I have the right address on address bar, and I am performing a POST request. I have the three params under <code>key-value</code>. </p>
  
  <p><a href="https://i.stack.imgur.com/J6GcI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J6GcI.png" alt="Postman screenshot POST"></a></p>
  
  <p>After I <code>Send</code> it, under my Rails Server log I see:</p>
  
  <pre><code>Started POST "/manufacturer_organizations" for 127.0.0.1 at 2017-04-13 16:56:44 -0700
  Processing by ManufacturerOrganizationsController#create as */*
    Parameters: {"organization_id"=&gt;"fb20ddc9-a3ee-47c3-bdd2-f710541-ff89c", "manufacturer_id"=&gt;"1", "account_number"=&gt;"A rand
  om account number test"}
  ...
    (0.4ms)  BEGIN
     (0.3ms)  ROLLBACK
  Sorry, something went wrong
  </code></pre>
  
  <p>I can do <code>ManufacturerOrganization.new(organization_id: Organization.last.id, manufacturer_id: Manufacturer.last.id, and account_number: "random test account number")</code> just fine inside <code>rails console</code>. </p>
  
  <p>How can I submit a POST request from postman to add a new manufacturer_organization?</p>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>  def manufacturer_organization_params
      api_params.permit(:organization_id, :manufacturer_id, :account_number)
    end
  </code></pre>
  
  <p>whereas inside <code>application_controller.rb</code></p>
  
  <pre><code>def api_params
      @api_params ||= ActionController::Parameters.new(ActiveModelSerializers::Deserialization.jsonapi_parse(params))
    end
  </code></pre>
  
  <p><strong>Edit2:</strong></p>
  
  <p>I added <code>error.full_messages</code> and this is what I got:</p>
  
  <pre><code>Manufacturer can't be blank
  Organization can't be blank
  Account number can't be blank
  </code></pre>
  
  <p>Why are they blank?</p>