This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
learnexa_graphql_api [2019/04/19 09:07] 182.72.26.6 [Implementation] |
learnexa_graphql_api [2019/08/08 05:29] (current) 182.72.26.6 [Learnexa GrapphQL API] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Learnexa GrapphQL API ====== | + | ====== Learnexa GraphQL API ====== |
| ===== Implementation ===== | ===== Implementation ===== | ||
| Line 95: | Line 95: | ||
| field :created_at, String, null: false | field :created_at, String, null: false | ||
| field :updated_at, String, null: false | field :updated_at, String, null: false | ||
| + | field :course_contents, [Types::CourseContentType], null: false | ||
| end | end | ||
| end | end | ||
| Line 153: | Line 154: | ||
| 11) Sample API curl call: | 11) Sample API curl call: | ||
| + | |||
| + | Example 1 | ||
| Request | Request | ||
| Line 175: | Line 178: | ||
| </code> | </code> | ||
| + | Example 2 | ||
| + | |||
| + | Request query: | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | getContent(id: 3234) { | ||
| + | title | ||
| + | courseContents { | ||
| + | maximumAttempts | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | Response: | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | "data": { | ||
| + | "getContent": { | ||
| + | "title": "Intermediate System to Intermediate System (IS-IS) Routing Protocol", | ||
| + | "courseContents": [ | ||
| + | { | ||
| + | "maximumAttempts": 1 | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | Example 3 | ||
| + | |||
| + | Request: | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | getCourse(id: 2) { | ||
| + | title | ||
| + | contents { | ||
| + | title | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | Response: | ||
| + | |||
| + | <code> | ||
| + | { | ||
| + | "data": { | ||
| + | "getCourse": { | ||
| + | "title": "Practitioner’s Perspective on the Enterprise Data Model", | ||
| + | "contents": [ | ||
| + | { | ||
| + | "title": "Practitioner’s Perspective on the Enterprise Data Model" | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ===== API Setup Server ===== | ||
| + | |||
| + | 1) Download the following zip file | ||
| + | |||
| + | {{learnexa_api.zip}} | ||
| + | |||
| + | 2) Run "bundle install" | ||
| + | 3) Change database name in "database.yml". Point it to current devlep01 server database. | ||
| + | 4) Start rails server in the working directory "rails s" | ||