~evanj/cms

ref: 991b370ac6b6208e5f2fd7dcada177d52be58d9f cms/internal/v/html/doc.html -rw-r--r-- 7.2 KiB
991b370aEvan M Jones Feat(Big): Added a few things here... 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html lang=en>
<head>
  {{ template "html/_head.html" }}
  <title>CMS | Docs</title>
</head>
<body class='page bg-light'>
  <style>{{ template "css/main.css" }}</style>
  <main>
    {{ template "html/_header.html" $ }}
    <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
      <h1 class="display-4">API Documentation</h1>
    </div>
    <div class='container'>
      <div class='row'>
        <div class="col-12 offset-0 col-lg-8 offset-lg-2">
          <h2>Concepts</h2>
          <p>CMS has five entities:</p>
          <ul>
            <li>Users</li>
            <li>Spaces</li>
            <li>Content Types</li>
            <li>Web Hooks</li>
            <li>Contents </li>
          </ul>
          <p>Users can be associated with many spaces. Spaces can be associated with
          many users. It's a many-to-many relationship. A space is a "backend"
          for the content of a single application. For example, a space
          represents a single website or a single mobile application.</p>
          <p>A space can "own" many content types, one-to-many.</p>
          <p>A content types is a taxonomy of content. For example, if you're familiar
          with the content management system WordPress, a content type here is akin to
          categories, tags, posts, or pages on WordPress.</p>
          <p>A content type "owns" many content instances, one-to-many.</p>
          <p>This is where CMS begins to differ from many other content management
          systems and content management infrastructures. In CMS concepts such as
          categories, tags, posts, and pages are on the same hierarchy. Where in other
          content management systems, such as WordPress, categories and tags exist on
          a level above posts and pages.</p>
          <p>Another very important distinctions: CMS does not provide you a rigid set
          of content types. You define content types and within content you define
          their relation to other contents. Meaning: if you choose to create a
          WordPress type heirarchy in CMS you would define the content types pages and
          posts that would have two fields: a category field which would be a
          Reference field type and a tags field which would be a ReferenceList field
          type. You would then create your two additional content types,
          categories and tags, then when creating content under pages and posts,
          you would choose what they are referencing.</p>
          <p>This is the biggest feature of CMS for me: arbitrarily many and
          arbitrarily deep connections from one content instance to another
          content instance or list of content instances. Creating content in
          CMS <mark>should not restrict your data model.</mark></p>
          <p>Web hooks are used when you want your application to respond to
          content within CMS under your space being created, updated, and
          deleted on the fly. For doing any cache breaking or other you may want to do within
          your application.</p>
          <h2>Using the API</h2>
          <p>Before diving into the API I suggest you poke around the user
          interace and test drive creating spaces, content types, and contents. To
          get a feel for the above concepts described.</p>
          <p>You'll also need an account to interact with the following APIs.
          The APIs use basic authentication for client applications. Sign ups
          are available to anyone but CMS is currently in a <mark>limited public
          alpha</mark>. Meaning: all your data is automatically deleted on a 15
          minute interval. CMS currently doesn't have any way to fight abuse.
          Once CMS' story on fighting abuse has been improved CMS will be moved
          into beta or general availability. If this is an inconvenience I urge
          you to look into self-hosting CMS. All you need is read access to the
          repository (which you already have), a Go compiler, and a MySQL
          database.</p>
          <h3>Spaces API</h3>
          <p>Five methods are available to the Spaces API.</p>
          <ul>
            <li>POST: Create a Space.</li>
            <li>GET: Retrieving a Space.</li>
            <li>PATCH: Update a Space.</li>
            <li>DELETE: Remove a Space.</li>
            <li>PUT: Copy a Space.</li>
          </ul>
          <h4>POST: Create a Space.</h4>
          <pre><code>curl -s -u "$cmsuser:$cmspass" https://cms.evanjon.es/space
          -X POST -F name="cURL test" -F desc="Some description here"</code></pre>
          <p>You'll be returned JSON that will have a redirectURL. The ID of the
          created space will be inside. You'll use the space ID to GET, PATCH,
          DELETE, and PUT the space.</p>
          <h4>GET: Retrieving a Space.</h4>
          <pre><code>curl -s -u "$cmsuser:$cmspass" https://cms.evanjon.es/space
          -X GET -F space=29</code></pre>
          <p>When you GET a Space you'll also retreive a paginated list of
          Content Types under the Space. The API returns JSON. Under the key
          "ContentTypes" you'll see a few more key/values: "ContentTypeList",
          "ContentTypeListMore", and "ContentTypeListBefore". Use the query
          parameter "?before=$ID" on your GET request to retrieve the next page
          of results, to use in conjunction with "ContentTypeListBefore".
          If another page of content type results exists
          "ContentTypeListMore" will state so with its boolean value.</p>
          <h4>PATCH: Update a Space.</h4>
          <pre><code>curl -s -u "$cmsuser:$cmspass" https://cms.evanjon.es/space
          -X PATCH -F space=29 -F name="cURL test (update)"</code></pre>
          <h4>DELETE: Remove a Space.</h4>
          <pre><code>curl -s -u "$cmsuser:$cmspass" https://cms.evanjon.es/space
          -X DELETE -F space=29</code></pre>
          <h4>PUT: Copy a Space.</h4>
          <pre><code>curl -s -u "$cmsuser:$cmspass" https://cms.evanjon.es/space
          -X PUT -F space=30 -F name="cURL test copy" -F desc="This is a copied space"</code></pre>
          <p>Please note: copying a space copies <mark>all</mark> of the space's
          content types and content instances.</p>
          <h3>Content Types API</h3>
          <p>Four methods are available to the Content Types API.</p>
          <ul>
            <li>POST: Create a Content Type.</li>
            <li>GET: Retrieving a Content Type.</li>
            <li>PATCH: Update a Content Type.</li>
            <li>DELETE: Remove a Content Type.</li>
          </ul>
          <h3>Web Hooks API</h3>
          <p>Four methods are available to the Web Hooks API.</p>
          <ul>
            <li>POST: Create a Web Hook.</li>
            <li>GET: Retrieving a Web Hook.</li>
            <li>PATCH: Update a Web Hook.</li>
            <li>DELETE: Remove a Web Hook.</li>
          </ul>
          <h3>Content API</h3>
          <p>Four methods are available to the Content API.</p>
          <ul>
            <li>POST: Create a Content.</li>
            <li>GET: Retrieving a Content.</li>
            <li>PATCH: Update a Content.</li>
            <li>DELETE: Remove a Content.</li>
          </ul>
        </div>
      </div>
    </div>
    {{ template "html/_footer.html" $ }}
  </main>
  {{ template "html/_scripts.html" }}
</body>
</html>