github.com/mmatczuk/gohan@v0.0.0-20170206152520-30e45d9bdb69/etc/templates/markdown.tmpl (about) 1 Common 2 ========= 3 4 HTTP Header 5 6 X-Auth-Token: keystone Token 7 8 Common HTTP Status 9 10 | Code | Status | Description | 11 |------|--------|-------------| 12 | 401 | Unauthorized | Authentication required or you don't have permission to perform action for a resource | 13 | 404 | Not Found | Resource Not Found | 14 | 500 | Internal Server Error | Server Side issue occurred.. Please contact administrator | 15 16 - Not Found: 404 Resource Not Found 17 - Internal Server Error: 500 Server Side issue occurred.. Please contact administrator 18 19 {% for schema in schemas %}{% if schema.Metadata.type != "metaschema" && schema.Type != "abstract" %} 20 {{ schema.Title }} 21 ============================ 22 23 Description: {{ schema.Description }} 24 25 Properties 26 ------------ 27 28 | Key | Title | Description | Type | Default | Format | Permission | 29 | ----- | ------- | ------------- | ------ | --------- | --------- | ------------ |{% for property in schema.Properties %} 30 | {{ property.ID }} | {{ property.Title }} | {{property.Description}} | {{ property.Type }} | {{ property.Default }} | {{ property.Format }} | {{ property.Permission }} |{% endfor %} 31 32 Note: it is mandatory property if there is no default value specified. 33 id is an exception. if id property is null, gohan server will put uuid. 34 35 API Endpoint 36 37 List API 38 ----------- 39 40 GET {{schema.GetPluralURL() }} 41 42 Sample Output 43 44 HTTP Status Code: 200 (OK) 45 46 47 ``` json 48 49 { 50 "{{schema.Plural}}": [ 51 { 52 {% for property in schema.Properties %} 53 "{{ property.ID }}": ${{ property.ID }}{% if not forloop.Last %},{%endif%}{% endfor %} 54 } 55 ] 56 } 57 58 ``` 59 60 Show API 61 ----------- 62 63 GET {{schema.GetSingleURL() }} 64 65 Sample Output 66 67 HTTP Status Code: 200 (OK) 68 69 ``` json 70 71 { 72 "{{schema.Singular}}": { {% for property in schema.Properties %} 73 "{{ property.ID }}": ${{ property.ID }}{% if not forloop.Last %},{%endif%}{% endfor %} 74 } 75 } 76 ``` 77 78 POST API 79 ----------- 80 81 POST {{schema.GetPluralURL() }} 82 83 Sample Request 84 85 ``` json 86 87 { 88 "{{schema.Singular}}": { {% for property in schema.Properties %}{% if "create" in schema.Permission || schema.Permission == null %} 89 "{{ property.ID }}": ${{ property.ID }}{% if not forloop.Last %},{%endif%}{% endif %}{% endfor %} 90 } 91 } 92 } 93 94 ``` 95 96 Sample Output 97 98 HTTP Status Code: 201 (Accepted) 99 100 ``` json 101 102 { 103 "{{schema.Singular}}": { {% for property in schema.Properties %} 104 "{{ property.ID }}": ${{ property.ID }}{% if not forloop.Last %},{%endif%}{% endfor %} 105 } 106 } 107 } 108 109 ``` 110 111 Error Codes 112 113 | Code | Status | Description | 114 |------|--------|-------------| 115 | 400 | Bad Request | There are one or more errors in request value | 116 | 409 | Conflicts | Data integlity issue such as deleting resource with reference from the other resources | 117 118 119 Update API 120 ----------- 121 122 PUT {{schema.GetSingleURL() }} 123 124 Sample Request 125 126 ``` json 127 128 { 129 "{{schema.Singular}}": { {% for property in schema.Properties %}{% if "update" in schema.Permission || schema.Permission == null %} 130 "{{ property.ID }}": ${{ property.ID }}{% if not forloop.Last %},{%endif%}{% endif %}{% endfor %} 131 } 132 } 133 } 134 135 ``` 136 137 Sample Output 138 139 HTTP Status Code: 200 (OK) 140 141 ``` json 142 143 { 144 "{{schema.Singular}}": { {% for property in schema.Properties %} 145 "{{ property.ID }}": ${{ property.ID }}{% if not forloop.Last %},{%endif%}{% endfor %} 146 } 147 } 148 } 149 150 ``` 151 152 Error Codes 153 154 | Code | Status | Description | 155 |------|--------|-------------| 156 | 400 | Bad Request | There are one or more errors in request value | 157 | 409 | Conflicts | Data integlity issue such as deleting resource with reference from the other resources | 158 159 Delete API 160 ----------- 161 162 DELETE {{schema.GetSingleURL() }} 163 164 HTTP Status Code: 204 (No Content) 165 166 Error Codes 167 168 | Code | Status | Description | 169 |------|--------|-------------| 170 | 400 | Bad Request | There are one or more errors in request value | 171 | 409 | Conflicts | Data integlity issue such as deleting resource with reference from the other resources | 172 173 {% endif %}{% endfor %}