{"id":1463,"date":"2024-12-02T12:02:19","date_gmt":"2024-12-02T03:02:19","guid":{"rendered":"https:\/\/webclass.jp\/blog\/?p=1463"},"modified":"2024-12-02T12:02:19","modified_gmt":"2024-12-02T03:02:19","slug":"webapi%e3%81%ae%e5%88%a9%e7%94%a8%e6%89%8b%e9%a0%86%e6%9b%b8","status":"publish","type":"post","link":"https:\/\/webclass.jp\/blog\/2024\/12\/02\/webapi%e3%81%ae%e5%88%a9%e7%94%a8%e6%89%8b%e9%a0%86%e6%9b%b8\/","title":{"rendered":"WebAPI\u306e\u5229\u7528\u624b\u9806\u66f8"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>\u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3001WebClass \u306e WebAPI \u306e\u5229\u7528\u624b\u9806\u306b\u3064\u3044\u3066\u8a18\u8f09\u3057\u307e\u3059\u3002<br \/>\nWebClass\u3067\u5229\u7528\u3067\u304d\u308bWebAPI\u306e\u8a73\u7d30\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/webclass.jp\/api-doc\/\" title=\"WebClass API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\">WebClass API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/p>\n<h2>WebAPI \u306e\u6709\u52b9\u5316<\/h2>\n<hr \/>\n<p>WebAPI \u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u4e8b\u524d\u306b WebClass \u306b <strong>ClientID<\/strong> \u3068 <strong>\u30c8\u30fc\u30af\u30f3\u53d6\u5f97\u7528\u8a8d\u8a3c\u30ad\u30fc<\/strong> \u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u8a2d\u5b9a\u306f\u30b5\u30dd\u30fc\u30c8\u304c\u884c\u3044\u307e\u3059\u306e\u3067\u3001<strong>ClientID<\/strong> \u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li><strong>ClientID<\/strong> \u306f\u3001API \u3092\u5229\u7528\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u3092\u8b58\u5225\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/li>\n<li>\n<p>URL \u307e\u305f\u306f\u82f1\u6570\u5b57\u306e\u6587\u5b57\u5217\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u4f8b<\/strong>: <code>https:\/\/some.existing.service\/<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u30b5\u30dd\u30fc\u30c8\u304c\u8a8d\u8a3c\u30ad\u30fc\u3092\u751f\u6210\u3057\u3001<strong>ClientID<\/strong> \u3068\u4e00\u7dd2\u306b\u767b\u9332\u3057\u307e\u3059\u3002\u767b\u9332\u5f8c\u3001\u8a8d\u8a3c\u30ad\u30fc\u3092\u901a\u77e5\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97<\/h2>\n<hr \/>\n<p><strong>ClientID<\/strong> \u3068 <strong>\u30c8\u30fc\u30af\u30f3\u53d6\u5f97\u7528\u8a8d\u8a3c\u30ad\u30fc<\/strong> \u3092\u4f7f\u7528\u3057\u3066\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<h3><strong>Form\u5f62\u5f0f\u306e\u5834\u5408<\/strong><\/h3>\n<pre><code class=\"language-bash\">curl -X POST https:\/\/your.webclass.site\/webclass\/api.php\/auth\/token \\\n  -H &quot;Content-Type: application\/x-www-form-urlencoded&quot; \\\n  -d &quot;client_id=YOUR-CLIENT-ID&amp;key=YOUR-SECRET-KEY&quot;<\/code><\/pre>\n<h3><strong>JSON\u5f62\u5f0f\u306e\u5834\u5408 (WebClass v12 \u4ee5\u964d)<\/strong><\/h3>\n<pre><code class=\"language-bash\">curl -X POST https:\/\/your.webclass.site\/webclass\/api.php\/auth\/token \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -d &#039;{&quot;client_id&quot;:&quot;YOUR-CLIENT-ID&quot;, &quot;key&quot;:&quot;YOUR-SECRET-KEY&quot;}&#039;<\/code><\/pre>\n<h3><strong>\u30ec\u30b9\u30dd\u30f3\u30b9\u4f8b<\/strong><\/h3>\n<pre><code class=\"language-json\">{\n  &quot;result&quot;: &quot;OK&quot;,\n  &quot;token&quot;: &quot;xxxxxxxxxx&quot;\n}<\/code><\/pre>\n<h2>API \u306e\u5229\u7528<\/h2>\n<hr \/>\n<p>\u53d6\u5f97\u3057\u305f\u30c8\u30fc\u30af\u30f3\u3092 <strong>Bearer \u30d8\u30c3\u30c0\u30fc<\/strong> \u306b\u8a2d\u5b9a\u3057\u3066 API \u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n<h3><strong>\u6559\u6750\u306e\u6210\u7e3e\u30c7\u30fc\u30bf\u53d6\u5f97API \u306e\u4f8b<\/strong><\/h3>\n<p><code>:contents_id<\/code> \u306f\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3059\u6559\u6750 ID \u306b\u7f6e\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">curl -X GET https:\/\/your.webclass.site\/webclass\/api.php\/rest\/contents\/:contents_id\/scores \\\n  -H &quot;Authorization: Bearer xxxxxxxx&quot;<\/code><\/pre>\n<h2>\u5229\u7528\u4f8b<\/h2>\n<hr \/>\n<p>WebAPI\u306e\u5229\u7528\u4f8b\u3068\u3057\u3066\u3001\u30e6\u30fc\u30b6\u767b\u9332API\u3068\u30b3\u30fc\u30b9\u30e6\u30fc\u30b6\u767b\u9332API\u306e\u5229\u7528\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30e6\u30fc\u30b6\u767b\u9332<\/h3>\n<hr \/>\n<p>\u30e6\u30fc\u30b6\u767b\u9332 API \u3092\u5229\u7528\u3057\u3066\u3001\u65b0\u3057\u3044\u30e6\u30fc\u30b6\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>\u30e1\u30bd\u30c3\u30c9<\/strong>: <code>POST<\/code><\/li>\n<li><strong>Content-Type<\/strong>: <code>application\/json<\/code><\/li>\n<\/ul>\n<h3><strong>\u30e6\u30fc\u30b6\u767b\u9332 API \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8<\/strong><\/h3>\n<pre><code>https:\/\/\u30b5\u30fc\u30d0\u30db\u30b9\u30c8\/webclass\/api.php\/rest\/user<\/code><\/pre>\n<h4><strong>\u9001\u4fe1\u30c7\u30fc\u30bf\u4f8b<\/strong><\/h4>\n<pre><code class=\"language-json\">{\n  &quot;user_id&quot;: &quot;id000001&quot;,\n  &quot;fullname&quot;: &quot;\u9234\u6728 \u5148\u751f&quot;,\n  &quot;email&quot;: &quot;suzukisensei@example.com&quot;,\n  &quot;perm&quot;: &quot;1&quot;,\n  &quot;student_id&quot;: &quot;2022000001&quot;,\n  &quot;login_id&quot;: &quot;extid000001&quot;\n}<\/code><\/pre>\n<h4><strong>\u8fd4\u5374\u30c7\u30fc\u30bf\u4f8b<\/strong><\/h4>\n<pre><code class=\"language-json\">{\n  &quot;result&quot;: &quot;Registration successful. user_id &lt;id000001&gt; added.&quot;\n}<\/code><\/pre>\n<h3>\u30b3\u30fc\u30b9\u30e6\u30fc\u30b6\u767b\u9332<\/h3>\n<hr \/>\n<p>\u30b3\u30fc\u30b9\u30e6\u30fc\u30b6\u767b\u9332 API \u3092\u5229\u7528\u3057\u3066\u3001\u30b3\u30fc\u30b9\u306b\u30e6\u30fc\u30b6\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>\u30e1\u30bd\u30c3\u30c9<\/strong>: <code>POST<\/code><\/li>\n<li><strong>Content-Type<\/strong>: <code>application\/json<\/code><\/li>\n<\/ul>\n<h4><strong>\u30b3\u30fc\u30b9\u30e6\u30fc\u30b6\u767b\u9332 API \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8<\/strong><\/h4>\n<pre><code>https:\/\/\u30b5\u30fc\u30d0\u30db\u30b9\u30c8\/webclass\/api.php\/rest\/course\/APITestCourse\/member<\/code><\/pre>\n<h4><strong>\u9001\u4fe1\u30c7\u30fc\u30bf\u4f8b<\/strong><\/h4>\n<pre><code class=\"language-json\">{\n  &quot;user_id&quot;: &quot;id000001&quot;,\n  &quot;course_perm&quot;: &quot;0&quot;\n}<\/code><\/pre>\n<h3><strong>\u8fd4\u5374\u30c7\u30fc\u30bf\u4f8b<\/strong><\/h3>\n<pre><code class=\"language-json\">{\n  &quot;result&quot;: &quot;Registration successful. user_id &lt;id000001&gt; added.&quot;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 \u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3001WebClass \u306e WebAPI \u306e\u5229\u7528\u624b\u9806\u306b\u3064\u3044\u3066\u8a18\u8f09\u3057\u307e\u3059\u3002 WebClass\u3067\u5229\u7528\u3067\u304d\u308bWebAPI\u306e\u8a73\u7d30\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002 WebClass API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"class_list":["post-1463","post","type-post","status-publish","format-standard","hentry","category-48"],"_links":{"self":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts\/1463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/comments?post=1463"}],"version-history":[{"count":5,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts\/1463\/revisions"}],"predecessor-version":[{"id":1468,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts\/1463\/revisions\/1468"}],"wp:attachment":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/media?parent=1463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/categories?post=1463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/tags?post=1463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}