質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

Q&A

解決済

1回答

5254閲覧

[Postman]postリクエストが送信できない

bardy

総合スコア3

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

API

APIはApplication Programming Interfaceの略です。APIはプログラムにリクエストされるサービスがどのように動作するかを、デベロッパーが定めたものです。

0グッド

0クリップ

投稿2021/09/21 16:08

編集2021/09/21 16:10

railsのAPIモードでの開発しています。
Postmanを使ってPOSTリクエストして、データを作成したいのですが、
リクエストを送信できません。
どなたか原因がわかる方おられますでしょうか。

###開発環境
~ % rails -v
Rails 5.2.6

~ % bundle -v
Bundler version 1.17.2

###Postman表示画面
イメージ説明

###各ファイル

ruby

1#20210917122447create_users.rb 2 3class CreateUsers < ActiveRecord::Migration[5.2] 4 def change 5 create_table :users do |t| 6 t.string :name 7 t.string :user_id 8 t.string :email 9 t.string :password 10 11 t.timestamps 12 end 13 end 14end

ruby

1#schema.rb 2 3# This file is auto-generated from the current state of the database. Instead 4# of editing this file, please use the migrations feature of Active Record to 5# incrementally modify your database, and then regenerate this schema definition. 6# 7# Note that this schema.rb definition is the authoritative source for your 8# database schema. If you need to create the application database on another 9# system, you should be using db:schema:load, not running all the migrations 10# from scratch. The latter is a flawed and unsustainable approach (the more migrations 11# you'll amass, the slower it'll run and the greater likelihood for issues). 12# 13# It's strongly recommended that you check this file into your version control system. 14ActiveRecord::Schema.define(version: 2021_09_19_122338) do 15 16 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| 17 t.string "name" 18 t.string "user_id" 19 t.string "email" 20 t.string "password" 21 t.datetime "created_at", null: false 22 t.datetime "updated_at", null: false 23 end 24 25end

ruby

1#routes.rb 2 3Rails.application.routes.draw do 4 # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 5 namespace :api do 6 namespace :v1 do 7 resources :hello, only: [:index] 8 resources :users, only: [:create, :show] 9 10 end 11 end 12end 13

ruby

1#users_controller.rb 2 3module Api 4 module V1 5 class UsersController < ApplicationController 6 def create 7 user = User.create(user_params) 8 9 if user.save 10 render json: { status: 'SUCCESS', data: user} 11 else 12 render json: { status: 'ERROR', data: user.errors } 13 end 14 end 15 16 private 17 18 def user_params 19 params.require(:user).permit(:name, :user_id, :email, :password) 20 end 21 end 22 end 23end 24

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

ダウンロード版をインストールするか、chromeの拡張機能版をインストールするかで使えるようです。

投稿2021/10/12 17:07

bardy

総合スコア3

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問