3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitHub API で Create a Rlease をしようとしたら 422 Unprocessable Entity となった原因

Last updated at Posted at 2019-01-06

使用したAPI

GitHub API - REST API v3

422 Unprocessable Entity になったコード

422の意味 => https://tools.ietf.org/html/rfc4918#section-11.2

index.js
const request = axios.create({
	baseURL: data.url,
	method: 'POST',
	headers: {
		Authorization: 'token ' + state.token,
	},
	data: {
		tag_name: data.tag,
		target_commitish: data.target,
		name: data.title,
		body: data.description,
		draft: data.isDraft,
		prerelease: data.isPreRelease
	}
})
const response = await request('/releases')

正解

index.js
	data: {
		"tag_name": data.tag,
		"target_commitish": data.target,
		"name": data.title,
		"body": data.description,
		"draft": data.isDraft,
		"prerelease": data.isPreRelease
	}
})

参考

https://developer.github.com/v3/repos/releases/#create-a-release
Screen Shot 2019-01-06 at 15.14.10.png

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?