commit
stringlengths
40
40
old_file
stringlengths
2
205
new_file
stringlengths
2
205
old_contents
stringlengths
0
32.9k
new_contents
stringlengths
1
38.9k
subject
stringlengths
3
9.4k
message
stringlengths
6
9.84k
lang
stringlengths
3
13
license
stringclasses
13 values
repos
stringlengths
6
115k
0c25c4460f534274c1e37ce1d0e73f89b84f0e24
apiary.apib
apiary.apib
HOST: http://dcp.jboss.org/v1 --- Distributed Contribution Platform API v1 --- --- # Overview **Distributed Contribution Platform** provides **REST API** for data manipulation and search. # DCP Content object This is main content object which can be pushed/retrieved or searched. DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure. Some system data fields are defined by DCP, some of them are added into content inside DCP. Those data fields are prefixed by `dcp_`: * `dcp_type` - DCP wide content type - eg. mailing-list email, issue, blogpost, IRC post - system field, always necessary * `dcp_id` - content id unique in whole DCP platform - system field, always necessary. Is constructed in 'Content Push API' from `dcp_content_type` and `dcp_content_id`. * `dcp_content_provider` - identification of provider who stored given data into platform - system field, always necessary - eg. 'jbossorg', 'seam_project' etc. * `dcp_content_type` - identifier of provider defined content type for 'Content Push API'. Unique in whole DCP so starts with `dcp_content_provider`, eg. 'jbossorg_jira_issue', 'jbossorg_blog' etc. * `dcp_content_id` - content identifier passed in by provider, must be unique for given `dcp_content_type` * `dcp_updated` - date of last content update in DCP - system field, always necessary * `dcp_project` - normalized DCP wide identifier of project - system field - in Search API used for project facet and filter * `dcp_contributors` - array of contributing persons, no duplicities in array, persons identifiers normalized during push into DCP - each person represented as String "Name Surname <[email protected]>" - in Search API used for persons facet and filter * `dcp_activity_dates` - array of timestamps representing some activity on this content - in Search API used for time facet and filter * `dcp_tags` - array of tags (Strings) - in Search API used for facet (tagcloud) and filter - do not directly pushed by content provider because we plan mechanism for user defined additional tags, so we need to rewrite this field internally. Content provider should use `tags` field instead. * `dcp_title` - content title - used to present document in basic search GUI - can be directly set by content provider during push * `dcp_url_view` - URL where document can be viewed in original system in human readable form - used to open document from basic search GUI - can be directly set by content provider during push * `dcp_description` - short text representing content - used to show content in basic search GUI for queries which do not produce highlights - can be directly set by content provider during push DCP Content described by example: { Free JSON Structure representing content. Can be one key value pair or something more structured. It's defined only by content provider. "tags": ["Content_tag1", "tag2", "tag3"], "dcp_content_provider": "jbossorg", "dcp_content_type: "jbossorg_jira_issue", "dcp_content_id": "AS7-1254", "dcp_id": "jbossorg_jira_issue-AS7-1254", "dcp_type": "issue", "dcp_title": "AS7-1254 - Set the port_range on JGroups stacks to 1", "dcp_url_view": "https://issues.jboss.org/browse/AS7-1254", "dcp_description": "Set the port_range on JGroups stacks to 1 to lock down the ports.", "dcp_updated": "2012-12-06T06:34:55.000Z", "dcp_project": "as7", "dcp_contributors": ["John Doe <[email protected]>", "Pat Mat <[email protected]>"], "dcp_activity_dates": ["2012-12-06T06:34:55.000Z", "2012-12-05T01:48:05.000Z"], "dcp_tags": ["Content_tag1", "tag2", "tag3", "user_defined_additional_tag"] } --- -- Authentication Some operation calls on REST API need to be authenticated by provider. Caller provides credentials by HTTP URL parameters `provider` and `pwd`, or via standard HTTP Basic authentication. If authentication is not successful, then standard Forbidden HTTP code is returned. -- -- Content Push API This part of API is used by content providers to manipulate content in DCP. -- Get defined content from DCP. GET /rest/content/{dcp_content_type}/{dcp_content_id} < 200 < Content-Type: application/json { "foo": "bar" } < 404 Get all content of specified provider type. GET /rest/content/{dcp_content_type}{?from,size,sort} < 200 < Content-Type: application/json { "total": "1", "hits": [ { "id": "AS7-1254", "data": { "tags": ["Content_tag1", "tag2", "tag3"], "dcp_content_provider": "jbossorg", "dcp_content_type: "jbossorg_jira_issue", "dcp_content_id": "AS7-1254", "dcp_id": "jbossorg_jira_issue-AS7-1254", "dcp_type": "issue", "dcp_title": "AS7-1254 - Set the port_range on JGroups stacks to 1", "dcp_url_view": "https://issues.jboss.org/browse/AS7-1254", "dcp_description": "Set the port_range on JGroups stacks to 1 to lock down the ports.", "dcp_updated": "2012-12-06T06:34:55.000Z", "dcp_project": "as7", "dcp_contributors": ["John Doe <[email protected]>", "Pat Mat <[email protected]>"], "dcp_activity_dates": ["2012-12-06T06:34:55.000Z", "2012-12-05T01:48:05.000Z"], "dcp_tags": ["Content_tag1", "tag2", "tag3", "user_defined_additional_tag"] } } ] } JSON document in http body which is pushed to DCP. Http body empty POST /rest/content/{dcp_content_type}/{dcp_content_id} > Accept: application/json < 200 < Content-Type: application/json { "status":"insert", "message":"Content was inserted successfully." } Delete defined content from DCP. DELETE /rest/content/{dcp_content_type}/{dcp_content_id}{?ignore_missing} < 200 < 404 -- Search API This part of API is used by all systems who can use content stored in DCP. -- Search contributions. GET /rest/search?TODO < 200 { "foo": "bar" } -- Query Suggestions It can return suggestions for given user query such as *query completion*, *did you mean*, ... etc. Returned JSON contains two highlevel objects: ``` { "view" : { ... }, "model" : { ... } } ``` #### View The `view` represents the visual part of query suggestions response. It *always* contains section `search` which will *always* have only one option matching incoming user query (`${query_string}`). It can then contain one or more additional sections (like `suggestions`, `filters`, `mails`, ... etc.). ##### Example ``` "view" : { "search": { "caption" : "Search", "options" : ["${query_string}"] }, "suggestions" : { "caption" : " ... ", "options" : [ ... ] }, "filters" : { "caption" : " ... ", "options" : [ ... ] }, ... } ``` #### Model The `model` represents possible "actions" that are relevant to individual `option`s in the `view` part. This means both `view` and `model` parts have the same highlevel structure and each `option` in the `view` part have corresponding "action" in the `model` part. ##### Example ``` "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ ... ], "filters" : [ ... ], ... } ``` Individual actions are described using symbolic commands. Interpretation of these commands is up to the client the following is just a recommendation about how client can interpret the commands: ##### Commands `search` - execute search for `query` value. `suggestion` - replace text in the search field with the `value`'s value. `filter` - replace current filters with provided filters. `filter_add` - enable provided filters (on top of currently active filters). ... more TDB. -- GET /rest/suggestions/query_string?q={user_query_string} < 200 < Access-Control-Allow-Origin: * { "view": { "search": { "caption": "Search", "options": ["${query_string}"] }, "suggestions": { "caption": "Query Completions", "options": [ "option #1", "option #2", "..." ] }, "filters": { "caption": "Filters", "options": [ "option #1", "option #2", "..." ] }, "mails": { "caption": "Mails", "options": [ "option #1", "option #2", "..." ] } }, "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ { "action #1": {} }, { "action #2": {} }, { } ], "filters": [ { "action #1": {} }, { "action #2": {} }, { } ], "mails": [ { "action #1": {} }, { "action #2": {} }, { } ] } } Example for user query 'Hiberna'. GET /rest/suggestions/query_string?q=Hiberna < 200 < Access-Control-Allow-Origin: * { "view": { "search": { "caption": "Search", "options": ["Hiberna"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "Hiberna" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ { "filter_add": [ "foo" ] }, {}, {} ] } }
HOST: http://dcp.jboss.org/v1 --- Distributed Contribution Platform API v1 --- --- # Overview **Distributed Contribution Platform** provides **REST API** for data manipulation and search. # DCP Content object This is main content object which can be pushed/retrieved or searched. DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure. Some system data fields are defined by DCP, some of them are added into content inside DCP. Those data fields are prefixed by `dcp_`: * `dcp_type` - DCP wide content type - eg. mailing-list email, issue, blogpost, IRC post - system field, always necessary * `dcp_id` - content id unique in whole DCP platform - system field, always necessary. Is constructed in 'Content Push API' from `dcp_content_type` and `dcp_content_id`. * `dcp_content_provider` - identification of provider who stored given data into platform - system field, always necessary - eg. 'jbossorg', 'seam_project' etc. * `dcp_content_type` - identifier of provider defined content type for 'Content Push API'. Unique in whole DCP so starts with `dcp_content_provider`, eg. 'jbossorg_jira_issue', 'jbossorg_blog' etc. * `dcp_content_id` - content identifier passed in by provider, must be unique for given `dcp_content_type` * `dcp_updated` - date of last content update in DCP - system field, always necessary * `dcp_project` - normalized DCP wide identifier of project - system field - in Search API used for project facet and filter * `dcp_contributors` - array of contributing persons, no duplicities in array, persons identifiers normalized during push into DCP - each person represented as String "Name Surname <[email protected]>" - in Search API used for persons facet and filter * `dcp_activity_dates` - array of timestamps representing some activity on this content - in Search API used for time facet and filter * `dcp_tags` - array of tags (Strings) - in Search API used for facet (tagcloud) and filter - do not directly pushed by content provider because we plan mechanism for user defined additional tags, so we need to rewrite this field internally. Content provider should use `tags` field instead. * `dcp_title` - content title - used to present document in basic search GUI - can be directly set by content provider during push * `dcp_url_view` - URL where document can be viewed in original system in human readable form - used to open document from basic search GUI - can be directly set by content provider during push * `dcp_description` - short text representing content - used to show content in basic search GUI for queries which do not produce highlights - can be directly set by content provider during push DCP Content described by example: { Free JSON Structure representing content. Can be one key value pair or something more structured. It's defined only by content provider. "tags": ["Content_tag1", "tag2", "tag3"], "dcp_content_provider": "jbossorg", "dcp_content_type: "jbossorg_jira_issue", "dcp_content_id": "AS7-1254", "dcp_id": "jbossorg_jira_issue-AS7-1254", "dcp_type": "issue", "dcp_title": "AS7-1254 - Set the port_range on JGroups stacks to 1", "dcp_url_view": "https://issues.jboss.org/browse/AS7-1254", "dcp_description": "Set the port_range on JGroups stacks to 1 to lock down the ports.", "dcp_updated": "2012-12-06T06:34:55.000Z", "dcp_project": "as7", "dcp_contributors": ["John Doe <[email protected]>", "Pat Mat <[email protected]>"], "dcp_activity_dates": ["2012-12-06T06:34:55.000Z", "2012-12-05T01:48:05.000Z"], "dcp_tags": ["Content_tag1", "tag2", "tag3", "user_defined_additional_tag"] } --- -- Authentication Some operation calls on REST API need to be authenticated by provider. Caller provides credentials by HTTP URL parameters `provider` and `pwd`, or via standard HTTP Basic authentication. If authentication is not successful, then standard Forbidden HTTP code is returned. -- -- Content Push API This part of API is used by content providers to manipulate content in DCP. -- Get defined content from DCP. GET /rest/content/{dcp_content_type}/{dcp_content_id} < 200 < Content-Type: application/json { "foo": "bar" } Missing document. GET /rest/content/{dcp_content_type}/{dcp_content_id} < 404 < Content-Type: text/plain Missing document Get all content of specified provider type. GET /rest/content/{dcp_content_type}{?from,size,sort} < 200 < Content-Type: application/json { "total": "1", "hits": [ { "id": "AS7-1254", "data": { "tags": ["Content_tag1", "tag2", "tag3"], "dcp_content_provider": "jbossorg", "dcp_content_type: "jbossorg_jira_issue", "dcp_content_id": "AS7-1254", "dcp_id": "jbossorg_jira_issue-AS7-1254", "dcp_type": "issue", "dcp_title": "AS7-1254 - Set the port_range on JGroups stacks to 1", "dcp_url_view": "https://issues.jboss.org/browse/AS7-1254", "dcp_description": "Set the port_range on JGroups stacks to 1 to lock down the ports.", "dcp_updated": "2012-12-06T06:34:55.000Z", "dcp_project": "as7", "dcp_contributors": ["John Doe <[email protected]>", "Pat Mat <[email protected]>"], "dcp_activity_dates": ["2012-12-06T06:34:55.000Z", "2012-12-05T01:48:05.000Z"], "dcp_tags": ["Content_tag1", "tag2", "tag3", "user_defined_additional_tag"] } } ] } JSON document in http body which is pushed to DCP. Http body empty POST /rest/content/{dcp_content_type}/{dcp_content_id} > Accept: application/json < 200 < Content-Type: application/json { "status":"insert", "message":"Content was inserted successfully." } Delete defined content from DCP. DELETE /rest/content/{dcp_content_type}/{dcp_content_id}{?ignore_missing} < 200 < 404 -- Search API This part of API is used by all systems who can use content stored in DCP. -- Search contributions. GET /rest/search?TODO < 200 { "foo": "bar" } -- Query Suggestions It can return suggestions for given user query such as *query completion*, *did you mean*, ... etc. Returned JSON contains two highlevel objects: ``` { "view" : { ... }, "model" : { ... } } ``` #### View The `view` represents the visual part of query suggestions response. It *always* contains section `search` which will *always* have only one option matching incoming user query (`${query_string}`). It can then contain one or more additional sections (like `suggestions`, `filters`, `mails`, ... etc.). ##### Example ``` "view" : { "search": { "caption" : "Search", "options" : ["${query_string}"] }, "suggestions" : { "caption" : " ... ", "options" : [ ... ] }, "filters" : { "caption" : " ... ", "options" : [ ... ] }, ... } ``` #### Model The `model` represents possible "actions" that are relevant to individual `option`s in the `view` part. This means both `view` and `model` parts have the same highlevel structure and each `option` in the `view` part have corresponding "action" in the `model` part. ##### Example ``` "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ ... ], "filters" : [ ... ], ... } ``` Individual actions are described using symbolic commands. Interpretation of these commands is up to the client the following is just a recommendation about how client can interpret the commands: ##### Commands `search` - execute search for `query` value. `suggestion` - replace text in the search field with the `value`'s value. `filter` - replace current filters with provided filters. `filter_add` - enable provided filters (on top of currently active filters). ... more TDB. -- GET /rest/suggestions/query_string?q={user_query_string} < 200 < Access-Control-Allow-Origin: * { "view": { "search": { "caption": "Search", "options": ["${query_string}"] }, "suggestions": { "caption": "Query Completions", "options": [ "option #1", "option #2", "..." ] }, "filters": { "caption": "Filters", "options": [ "option #1", "option #2", "..." ] }, "mails": { "caption": "Mails", "options": [ "option #1", "option #2", "..." ] } }, "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ { "action #1": {} }, { "action #2": {} }, { } ], "filters": [ { "action #1": {} }, { "action #2": {} }, { } ], "mails": [ { "action #1": {} }, { "action #2": {} }, { } ] } } Example for user query 'Hiberna'. GET /rest/suggestions/query_string?q=Hiberna < 200 < Access-Control-Allow-Origin: * { "view": { "search": { "caption": "Search", "options": ["Hiberna"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "Hiberna" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ { "filter_add": [ "foo" ] }, {}, {} ] } }
fix 404
fix 404
API Blueprint
apache-2.0
ollyjshaw/searchisko,ollyjshaw/searchisko,ollyjshaw/searchisko,searchisko/searchisko,searchisko/searchisko,searchisko/searchisko
fb832b537a1ac4c0b136f1dd510d3b2819fe97ff
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://localhost:8080/api # AzuraCast AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more. ## Authenticating Some request types require an API key, either to perform administrative steps or avoid public rate-limiting. API keys can be generated from the AzuraCast global administration panel. When making an authenticated request, any of the following methods can be used to supply the key: * The "X-API-Key" HTTP header supplied in the request * The "key" parameter supplied via GET or POST (?key=a1b2c3...) * The "key" parameter embedded at the end of a URL (/api/nowplaying/index/key/a1b2c3.../) ## Important Notes * Many API calls are cached for performance reasons, and some implement rate-limits to prevent flooding the system. Typically, calls authenticated with an API key have rate limits removed. * API signatures may change between software versions. Check the GitHub repository for more information when updating. * All timestamps in API calls are supplied as UNIX timestamps, i.e. seconds from 1/1/1970. ## Station "Short Codes" In lieu of a station ID, some station-related API calls allow for what is called a "shortcode". This is the name of the station, in lower case, with its special characters removed. For example, "My Awesome Radio!" would become "my_awesome_radio". ## Song Identifiers Most database entries have an auto-incrementing unique identifier, but songs use a hash-based identification system that avoids collisions based on spacing or punctuation differences. # Group Now Playing Retrieve "Now Playing" information about active stations. ### GET /nowplaying Returns all now playing data for active stations. + Response 200 (application/json) { status: "success", result: [ { station: { id: 1, name: "Pony Radio Station", shortcode: "pony_radio_station" }, current_song: { id: "178ebfae95842a543f30a449f2420125", text: "YourEnigma - On Hold (Feat. Rhyme Flow)", artist: "YourEnigma", title: "On Hold (Feat. Rhyme Flow)", created: 1472973486, play_count: 2, last_played: 1473192908, sh_id: null }, listeners: { current: 0, unique: 0, total: 0 }, meta: { status: "online", bitrate: null, format: "audio/mpeg" }, song_history: [ { played_at: 1473192663, song: { id: "86125d7861a62e19b773a5911b490675", text: "PhonyBrony, Feather - I'll Show You My Loyalty (1st Capital Rock Version)", artist: "PhonyBrony, Feather", title: "I'll Show You My Loyalty (1st Capital Rock Version)", created: 1472973505, play_count: 2, last_played: 1473192663 } }, { played_at: 1473192423, song: { id: "d631a2196db79ab1e6b5e8e0db69dea4", text: "StormWolf - BBBFF (Stormwolf Remix)", artist: "StormWolf", title: "BBBFF (Stormwolf Remix)", created: 1472973497, play_count: 3, last_played: 1473192423 } } ], cache: "database" } ] } ### GET /nowplaying/index/id/{id} **Station Specified by Numeric ID** Returns a single station's now-playing information based on a station identifier. + Parameters + id (number, required) - The station ID. + Response 200 (application/json) { status: "success", result: { station: { id: 1, name: "Pony Radio Station", shortcode: "pony_radio_station" }, current_song: { id: "178ebfae95842a543f30a449f2420125", text: "YourEnigma - On Hold (Feat. Rhyme Flow)", artist: "YourEnigma", title: "On Hold (Feat. Rhyme Flow)", created: 1472973486, play_count: 2, last_played: 1473192908, sh_id: null }, listeners: { current: 0, unique: 0, total: 0 }, meta: { status: "online", bitrate: null, format: "audio/mpeg" }, song_history: [ { played_at: 1473192663, song: { id: "86125d7861a62e19b773a5911b490675", text: "PhonyBrony, Feather - I'll Show You My Loyalty (1st Capital Rock Version)", artist: "PhonyBrony, Feather", title: "I'll Show You My Loyalty (1st Capital Rock Version)", created: 1472973505, play_count: 2, last_played: 1473192663 } }, { played_at: 1473192423, song: { id: "d631a2196db79ab1e6b5e8e0db69dea4", text: "StormWolf - BBBFF (Stormwolf Remix)", artist: "StormWolf", title: "BBBFF (Stormwolf Remix)", created: 1472973497, play_count: 3, last_played: 1473192423 } } ], cache: "database" } } + Response 400 (application/json) Returned if an invalid station ID is specified. +Body { status: "error", error: "Station not found." } ### GET /nowplaying/index/station/{shortcode} **Station Specified by Shortcode** Returns a single station's now-playing information based on a station's "short code" identifier. + Parameters + shortcode (string, required) - The station "short code" identifier. + Response 200 (application/json) { status: "success", result: { station: { id: 1, name: "Pony Radio Station", shortcode: "pony_radio_station" }, current_song: { id: "178ebfae95842a543f30a449f2420125", text: "YourEnigma - On Hold (Feat. Rhyme Flow)", artist: "YourEnigma", title: "On Hold (Feat. Rhyme Flow)", created: 1472973486, play_count: 2, last_played: 1473192908, sh_id: null }, listeners: { current: 0, unique: 0, total: 0 }, meta: { status: "online", bitrate: null, format: "audio/mpeg" }, song_history: [ { played_at: 1473192663, song: { id: "86125d7861a62e19b773a5911b490675", text: "PhonyBrony, Feather - I'll Show You My Loyalty (1st Capital Rock Version)", artist: "PhonyBrony, Feather", title: "I'll Show You My Loyalty (1st Capital Rock Version)", created: 1472973505, play_count: 2, last_played: 1473192663 } }, { played_at: 1473192423, song: { id: "d631a2196db79ab1e6b5e8e0db69dea4", text: "StormWolf - BBBFF (Stormwolf Remix)", artist: "StormWolf", title: "BBBFF (Stormwolf Remix)", created: 1472973497, play_count: 3, last_played: 1473192423 } } ], cache: "database" } } + Response 400 (application/json) Returned if an invalid station shortcode is specified. +Body { status: "error", error: "Station not found." } # Group Stations Information about the service's hosted radio stations. ### GET /stations/list List all stations from all categories. + Response 200 (application/json) { status: "success", result: [ { id: 1, name: "Best Pony Radio", shortcode: "best_pony_radio" } ] } ### GET /stations/index/id/{id} Station info for the specified numeric identifier. + Parameters + id (number, required) - The station ID. + Response 200 (application/json) { status: "success", result: { id: 1, name: "Best Pony Radio", shortcode: "best_pony_radio" } } + Response 400 (application/json) Returned if an invalid station ID is specified. +Body { status: "error", error: "Station not found." } ### GET /stations/index/station/{shortcode} Station info for the specified shortcode. + Parameters + shortcode (string, required) - The station "short code" identifier. + Response 200 (application/json) { status: "success", result: { id: 1, name: "Best Pony Radio", shortcode: "best_pony_radio" } } + Response 400 (application/json) Returned if an invalid station shortcode is specified. +Body { status: "error", error: "Station not found." } # Group Song Requests Information about available tracks that can be requested, and functionality to submit those requests programmatically. ### GET /requests/list/id/{id} Get all currently requestable songs from the specified station. + Parameters + id (number, required) - The station ID. + Response 200 (application/json) { status: "success", result: [ { song: { id: "b0df73b9260ea324ec873c8a6f90f0dc", text: "BlackGryph0n/Baasik - Crusader (Are We There Yet)", artist: "BlackGryph0n/Baasik", title: "Crusader (Are We There Yet)", created: 1472973479, play_count: 2, last_played: 1473029524 }, request_song_id: 5, request_url: "/api/requests/submit/id/1/song_id/5" }, { song: { id: "feea15c78f90b918d71b00972e051e19", text: "Aviators/Omnipony - Monster", artist: "Aviators/Omnipony", title: "Monster", created: 1472973479, play_count: 4, last_played: 1473179043 }, request_song_id: 10, request_url: "/api/requests/submit/id/1/song_id/10" } ] } + Response 400 (application/json) Returned if an invalid station ID is specified. +Body { status: "error", error: "Station not found." } ### POST /requests/submit/id/{station_id}/song_id/{song_id} Submit a request for a station to play a song with the specified ID. + Parameters + station_id (number, required) - The station ID. + song_id (number, required) - The song ID (supplied from the /requests/list endpoint) + Response 200 (application/json) { status: "success", result: "Request submitted successfully." } + Response 400 (application/json) Returned if any of the following circumstances occur: * Invalid station ID specified * Invalid song ID specified * Song requests disabled by station * Song played too recently on the station * Request was rate-limited by IP * Duplicate request (already pending) +Body { status: "error", error: "(Detailed error message)" } # Group Utilities Utility functions to verify the functionality of the system. ### GET / The homepage of the API, that provides a basic ping function and a link to this documentation. + Response 200 (application/json) { status: "success", result: "The AzuraCast API is online and functioning." } ### GET /index/status A basic ping function that returns the current UNIX timestamp (for caching tests). + Response 200 (application/json) { status: "success", result: { online: "true", timestamp: 0123456789 } } ### GET /index/time Return the server's timezone configuration, as well as several formats of the current UTC and localized timestamp. + Response 200 (application/json) { status: "success", result: { timestamp: 1473194546, gmt_datetime: "2016-09-06 8:42:26", gmt_date: "September 6, 2016", gmt_time: "8:42pm", gmt_timezone: "GMT", gmt_timezone_abbr: "GMT", local_datetime: "2016-09-06 3:42:26", local_date: "September 6, 2016", local_time: "3:42pm", local_timezone: "US/Central", local_timezone_abbr: "CDT" } }
FORMAT: 1A HOST: http://localhost:8080/api # AzuraCast AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more. ## Authenticating Some request types require an API key, either to perform administrative steps or avoid public rate-limiting. API keys can be generated from the AzuraCast global administration panel. When making an authenticated request, any of the following methods can be used to supply the key: * The "X-API-Key" HTTP header supplied in the request * The "key" parameter supplied via GET or POST (?key=a1b2c3...) * The "key" parameter embedded at the end of a URL (/api/nowplaying/index/key/a1b2c3.../) ## Important Notes * Many API calls are cached for performance reasons, and some implement rate-limits to prevent flooding the system. Typically, calls authenticated with an API key have rate limits removed. * API signatures may change between software versions. Check the GitHub repository for more information when updating. * All timestamps in API calls are supplied as UNIX timestamps, i.e. seconds from 1/1/1970. ## Station "Short Codes" In lieu of a station ID, some station-related API calls allow for what is called a "shortcode". This is the name of the station, in lower case, with its special characters removed. For example, "My Awesome Radio!" would become "my_awesome_radio". ## Song Identifiers Most database entries have an auto-incrementing unique identifier, but songs use a hash-based identification system that avoids collisions based on spacing or punctuation differences. # Group Now Playing Retrieve "Now Playing" information about active stations. ### GET /nowplaying Returns all now playing data for active stations. + Response 200 (application/json) { status: "success", result: [ { station: { id: 1, name: "Pony Radio Station", shortcode: "pony_radio_station" }, current_song: { id: "178ebfae95842a543f30a449f2420125", text: "YourEnigma - On Hold (Feat. Rhyme Flow)", artist: "YourEnigma", title: "On Hold (Feat. Rhyme Flow)", created: 1472973486, play_count: 2, last_played: 1473192908, sh_id: null }, listeners: { current: 0, unique: 0, total: 0 }, meta: { status: "online", bitrate: null, format: "audio/mpeg" }, song_history: [ { played_at: 1473192663, song: { id: "86125d7861a62e19b773a5911b490675", text: "PhonyBrony, Feather - I'll Show You My Loyalty (1st Capital Rock Version)", artist: "PhonyBrony, Feather", title: "I'll Show You My Loyalty (1st Capital Rock Version)", created: 1472973505, play_count: 2, last_played: 1473192663 } }, { played_at: 1473192423, song: { id: "d631a2196db79ab1e6b5e8e0db69dea4", text: "StormWolf - BBBFF (Stormwolf Remix)", artist: "StormWolf", title: "BBBFF (Stormwolf Remix)", created: 1472973497, play_count: 3, last_played: 1473192423 } } ], cache: "database" } ] } ### GET /nowplaying/index/id/{id} **Station Specified by Numeric ID** Returns a single station's now-playing information based on a station identifier. + Parameters + id (number, required) - The station ID. + Response 200 (application/json) { status: "success", result: { station: { id: 1, name: "Pony Radio Station", shortcode: "pony_radio_station" }, current_song: { id: "178ebfae95842a543f30a449f2420125", text: "YourEnigma - On Hold (Feat. Rhyme Flow)", artist: "YourEnigma", title: "On Hold (Feat. Rhyme Flow)", created: 1472973486, play_count: 2, last_played: 1473192908, sh_id: null }, listeners: { current: 0, unique: 0, total: 0 }, meta: { status: "online", bitrate: null, format: "audio/mpeg" }, song_history: [ { played_at: 1473192663, song: { id: "86125d7861a62e19b773a5911b490675", text: "PhonyBrony, Feather - I'll Show You My Loyalty (1st Capital Rock Version)", artist: "PhonyBrony, Feather", title: "I'll Show You My Loyalty (1st Capital Rock Version)", created: 1472973505, play_count: 2, last_played: 1473192663 } }, { played_at: 1473192423, song: { id: "d631a2196db79ab1e6b5e8e0db69dea4", text: "StormWolf - BBBFF (Stormwolf Remix)", artist: "StormWolf", title: "BBBFF (Stormwolf Remix)", created: 1472973497, play_count: 3, last_played: 1473192423 } } ], cache: "database" } } + Response 400 (application/json) Returned if an invalid station ID is specified. +Body { status: "error", error: "Station not found." } ### GET /nowplaying/index/station/{shortcode} **Station Specified by Shortcode** Returns a single station's now-playing information based on a station's "short code" identifier. + Parameters + shortcode (string, required) - The station "short code" identifier. + Response 200 (application/json) { status: "success", result: { station: { id: 1, name: "Pony Radio Station", shortcode: "pony_radio_station" }, current_song: { id: "178ebfae95842a543f30a449f2420125", text: "YourEnigma - On Hold (Feat. Rhyme Flow)", artist: "YourEnigma", title: "On Hold (Feat. Rhyme Flow)", created: 1472973486, play_count: 2, last_played: 1473192908, sh_id: null }, listeners: { current: 0, unique: 0, total: 0 }, meta: { status: "online", bitrate: null, format: "audio/mpeg" }, song_history: [ { played_at: 1473192663, song: { id: "86125d7861a62e19b773a5911b490675", text: "PhonyBrony, Feather - I'll Show You My Loyalty (1st Capital Rock Version)", artist: "PhonyBrony, Feather", title: "I'll Show You My Loyalty (1st Capital Rock Version)", created: 1472973505, play_count: 2, last_played: 1473192663 } }, { played_at: 1473192423, song: { id: "d631a2196db79ab1e6b5e8e0db69dea4", text: "StormWolf - BBBFF (Stormwolf Remix)", artist: "StormWolf", title: "BBBFF (Stormwolf Remix)", created: 1472973497, play_count: 3, last_played: 1473192423 } } ], cache: "database" } } + Response 400 (application/json) Returned if an invalid station shortcode is specified. +Body { status: "error", error: "Station not found." } # Group Stations Information about the service's hosted radio stations. ### GET /stations/list List all stations from all categories. + Response 200 (application/json) { status: "success", result: [ { id: 1, name: "Best Pony Radio", shortcode: "best_pony_radio" } ] } ### GET /stations/index/id/{id} Station info for the specified numeric identifier. + Parameters + id (number, required) - The station ID. + Response 200 (application/json) { status: "success", result: { id: 1, name: "Best Pony Radio", shortcode: "best_pony_radio" } } + Response 400 (application/json) Returned if an invalid station ID is specified. +Body { status: "error", error: "Station not found." } ### GET /stations/index/station/{shortcode} Station info for the specified shortcode. + Parameters + shortcode (string, required) - The station "short code" identifier. + Response 200 (application/json) { status: "success", result: { id: 1, name: "Best Pony Radio", shortcode: "best_pony_radio" } } + Response 400 (application/json) Returned if an invalid station shortcode is specified. +Body { status: "error", error: "Station not found." } # Group Song Requests Information about available tracks that can be requested, and functionality to submit those requests programmatically. ### GET /requests/list/id/{id} Get all currently requestable songs from the specified station. + Parameters + id (number, required) - The station ID. + Response 200 (application/json) { status: "success", result: [ { song: { id: "b0df73b9260ea324ec873c8a6f90f0dc", text: "BlackGryph0n/Baasik - Crusader (Are We There Yet)", artist: "BlackGryph0n/Baasik", title: "Crusader (Are We There Yet)", created: 1472973479, play_count: 2, last_played: 1473029524 }, request_song_id: 5, request_url: "/api/requests/submit/id/1/song_id/5" }, { song: { id: "feea15c78f90b918d71b00972e051e19", text: "Aviators/Omnipony - Monster", artist: "Aviators/Omnipony", title: "Monster", created: 1472973479, play_count: 4, last_played: 1473179043 }, request_song_id: 10, request_url: "/api/requests/submit/id/1/song_id/10" } ] } + Response 400 (application/json) Returned if an invalid station ID is specified. +Body { status: "error", error: "Station not found." } ### POST /requests/submit/id/{station_id}/song_id/{song_id} Submit a request for a station to play a song with the specified ID. + Parameters + station_id (number, required) - The station ID. + song_id (number, required) - The song ID (supplied from the /requests/list endpoint) + Response 200 (application/json) { status: "success", result: "Request submitted successfully." } + Response 400 (application/json) Returned if any of the following circumstances occur: * Invalid station ID specified * Invalid song ID specified * Song requests disabled by station * Song played too recently on the station * Request was rate-limited by IP * Duplicate request (already pending) +Body { status: "error", error: "(Detailed error message)" } # Group Utilities Utility functions to verify the functionality of the system. ### GET / The homepage of the API, that provides a basic ping function and a link to this documentation. + Response 200 (application/json) { status: "success", result: "The AzuraCast API is online and functioning." } ### GET /index/status A basic ping function that returns the current UNIX timestamp (for caching tests). + Response 200 (application/json) { status: "success", result: { online: "true", timestamp: 0123456789 } } ### GET /index/time Return the server's timezone configuration, as well as several formats of the current UTC and localized timestamp. + Response 200 (application/json) { status: "success", result: { timestamp: 1473194546, gmt_datetime: "2016-09-06 8:42:26", gmt_date: "September 6, 2016", gmt_time: "8:42pm", gmt_timezone: "GMT", gmt_timezone_abbr: "GMT", local_datetime: "2016-09-06 3:42:26", local_date: "September 6, 2016", local_time: "3:42pm", local_timezone: "US/Central", local_timezone_abbr: "CDT" } }
Add newline under +Body in case that's what's making APIary be so picky.
Add newline under +Body in case that's what's making APIary be so picky.
API Blueprint
agpl-3.0
SlvrEagle23/AzuraCast,SlvrEagle23/AzuraCast,SlvrEagle23/AzuraCast,AzuraCast/AzuraCast,AzuraCast/AzuraCast,SlvrEagle23/AzuraCast,AzuraCast/AzuraCast,AzuraCast/AzuraCast,SlvrEagle23/AzuraCast
ca82abadad5df688127444fdc6702e032c8b43f5
apiary.apib
apiary.apib
FORMAT: 1A # SCU Evals The SCU Evals API powers the SCU Evals front-end by managing all the data and actions. ## Meta [/] ### Get API Status [GET] + Response 200 (application/json) + Attributes + status: ok (string, required) ## Authentication [/auth] ### Authenticate New/Old User [POST] + Request (application/json) + Attributes + id_token (string, required) + Response 200 (application/json) + Attributes + status: ok, new, incomplete (enum[string], required, fixed) + jwt (string, required) + Response 500 (application/json) + Attributes + message: `failed to get certificates from Google: <reason>` (string, required) + Response 401 (application/json) + Attributes + message: `token is expired` (string, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed-type) + `invalid id_token` + `invalid id_token: <reason>` + `invalid id_token format: <reason>` + Response 403 (application/json) + Attributes + status: non-student (string, required, fixed) ### Validate User [GET /auth/validate] + Response 200 (application/json) + Attributes + jwt (string, required) - New JWT ### Authenticate API Key [POST /auth/api] + Request (application/json) + Attributes + api_key (string, required) + Response 200 (application/json) + Attributes + jwt (string, required) ## Classes [/classes/{quarter_id}/{professor_id}/{course_id}] ### Get Class Details [GET] + Parameters + quarter_id: 3900 (number) - The ID of the quarter that the class was taught + professor_id: 1 (number) - The ID of the professor that taught the class + course_id: 1 (number) - The ID of the course that was taught + Response 200 (application/json) + Attributes + course (Course, required) + quarter (Quarter, required) + professor (Professor, required) + user_posted: false (boolean, required) Whether the current user has posted an evaluation or not for this combination + Response 404 (application/json) + Attributes + message: class does not exist (string, required, fixed) ## Courses [/courses] ### List All Courses [GET /courses{?quarter_id,professor_id}] + Parameters + quarter_id (optional, number) - Limit the list to courses that were taught during the specified quarter + professor_id (optional, number) - Limit the list to courses that were taught by the specified professor + Response 200 (application/json) + Attributes (array[Course], fixed-type) ### Post Courses [POST] + Request (application/json) + Attributes + courses (array, fixed-type) + (object, required) + term: 3900 (string, required) + subject: ANTH (string, required) + catalog_nbr: 1 (number, required) + class_descr: Intro to Bio Anth (string, required) + instr_1: Doe, John (string, required) + instr_2 (string, required) + instr_3 (string, required) + Response 200 (application/json) + Attributes + result: success (string, fixed) + updated_count: 248 (number, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed) + Members + `The request was well-formed but was unable to be followed due to semantic errors.` + missing department to COEN ### Get Course Details [GET /courses/{id}{?embed}] + Parameters + id: 1 (number) - The course for which to get details + embed (enum[string], optional) Which other data to embed. Specifying `professors` gives you a list of professors that has taught the course. + Members + `professors` + Response 200 (application/json) Example response with the professors embedded. + Attributes (Course, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + professors (array[Professor], optional) + Response 404 (application/json) + Attributes + message: course with the specified id not found (string, required, fixed) ## Departments [/departments] ### List All Departments [GET] + Response 200 (application/json) + Attributes (array[Department], required, fixed-type) ### Post Departments [POST] + Request (application/json) + Attributes + departments (array, required, fixed-type) + (object) + value: ACTG (string, required) + label: `Accounting (ACTG)` (string, required) + school: BUS (string, required) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + updated_count: 74 (number, required) + Response 422 (application/json) + Attributes + message: `The request was well-formed but was unable to be followed due to semantic errors.` (string, required, fixed) ## Evaluations [/evaluations] ### List All Your Own Evaluations [GET] + Response 200 (application/json) + Attributes (array, required, fixed-type) + (Evaluation) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### List Recent Evaluations [GET /evaluations/recent{?count}] + Parameters + count (number, optional) - How many recent evaluations to return. + Default: 10 + Response 200 (application/json) + Attributes (array, required) + (Evaluation, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### Get Evaluation Details [GET /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 200 (application/json) + Attributes (Evaluation, required) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) ### Submit Evaluation [POST] + Request (application/json) + Attributes + quarter_id: 3900 (number, required) + professor_id: 1 (number, required) + course_id: 1 (number, required) + display_grad_year: false (boolean, required) + display_majors: true (boolean, required) + evaluation (EvaluationDataV1, required) + Response 201 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 422 (application/json) + Attributes + message: `invalid quarter/course/professor combination` (string, required, fixed) + Response 409 + Attributes + message: `evaluation for this combination already exists` (string, required, fixed) ### Delete Evaluation [DELETE /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `you are only allowed to delete your own evaluations` (string, required, fixed) ## Evaluation Votes [/evaluations/{id}/vote] + Parameters + id: 1 (number, required) ### Add/Overwrite Vote [PUT] + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `not allowed to vote on your own evaluations` (string, required, fixed) ### Delete Vote [DELETE /evaluations/{eval_id}/vote/{vote_id}] + Parameters + eval_id: 1 (number, required) + vote_id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message (enum[string], required, fixed) + `evaluation with the specified id not found` + `vote not found` ## Majors [/majors] ### List All Majors [GET] + Response 200 (application/json) + Attributes (array[Major], required, fixed-type) ### Post Majors [POST] + Request (application/json) + Attributes + majors (array[string], required, fixed-type) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + Response 422 (application/json) + Attributes + message: `failed to insert majors: <db error>` (string, required) ## Professors [/professors] ### List All Professors [GET /professors{?course_id,quarter_id}] + Parameters + course_id: 1 (number, optional) - Limit the list to professors that taught the specified course. + quarter_id: 3900 (number, optional) - Limit the list to professors who taught during the specified quarter. + Response 200 (application/json) + Attributes (array[Professor], required, fixed-type) ### Get Professor Details [GET /professors/{id}{?embed}] + Parameters + id: 1 (number) - The professor for which to get details. + embed (enum[string], optional) Which other data to embed. Specifying `courses` gives you a list of courses that this professor has taught. + Members + `courses` + Response 200 (application/json) Example response with the courses embedded. + Attributes (Professor, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + course (Course, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + courses (array[Course], optional) + Response 404 (application/json) + Attributes + message: professor with the specified id not found (string, required, fixed) ## Quarters [/quarters{?course_id,professor_id}] ### List All Quarters [GET] + Parameters + course_id: 1 (number, optional) - Limit the list to quarters during which the specified course was taught. + professor_id: 1 (number, optional) - Limit the list to quarters during which the specified professor taught. + Response 200 (application/json) + Attributes (array[Quarter], required, fixed-type) ## Search [/search{?q,limit}] + Parameters + q: Mat (string, required) - The search query. + limit (number, optional) - Limit the number of results. Max is 50. + Default: 50 ### Search For Classes And Professors [GET] + Response 200 (application/json) + Attributes + courses (array[Course], required, fixed-type) + professors (array[Professor], required, fixed-type) ## Students [/students/{id}] + Parameters + id: 1 (number, required) ### Update Info [PATCH] + Request (application/json) + Attributes + graduation_year: 2020 (number, required) + gender: m, f, o (enum[string], required, fixed) + majors: 1, 4 (array[number], required) - Between 1 and 3 major IDs. + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 403 (application/json) + Attributes + message: `you do not have the rights to modify another student` (string, required, fixed) + Response 422 (application/json) + Attributes + message: `invalid major(s) specified` (string, required, fixed) # Data Structures ## Course (object) + id: 1 (number, required) + number: 42 (number, required) + title: What is Life (string, required) + department_id: 3 (number, required) ## Department (object) + id: 1 (number, required) + abbr: COEN (string, required) + name: Computer Science & Engineering (string, required) + school: EGR (string, required) ## Evaluation (object) + id: 1 (number, required) + version: 1 (number, required) + post_time: `2018-02-06T22:24:11.098122-08:00` (string, required) - Post time in ISO 8601 + data (EvaluationDataV1, required) + votes_score: `-3` (number, required) ## EvaluationDataV1 (object) + attitude: 1 (number, required) + availability: 1 (number, required) + clarity: 1 (number, required) + grading_speed: 1 (number, required) + resourcefulness: 1 (number, required) + easiness: 1 (number, required) + workload: 1 (number, required) + recommended: 1 (number, required) + comment: Love the lectures (string, required) ## Major (object) + id: 1 (number, required) + name: Mathematics (string, required) ## Professor (object) + id: 1 (number, required) + first_name: John (string, required) + last_name: Doe (string, required) ## Quarter (object) + id: 1 (number, required) + year: 2018 (number, required) + name: Spring (string, required) + current: true (boolean, required) ## Student (User) + gender: m, f, o (enum[string], required) + graduation_year: 2020 (number, required) + majors (array[number], required) - An array of majors ids ## User (object) + id: 1 (number, required) + university_id: 1 (number, required) + email: [email protected] (string, required) + first_name: John (string, required) + last_name: Doe (string, required) + picture: https://foo.bar/d3hj2d2lk8 (string, required) - The URL to the user's picture + roles (array[number], required) - An array of roles ids
FORMAT: 1A # SCU Evals The SCU Evals API powers the SCU Evals front-end by managing all the data and actions. ## Meta [/] ### Get API Status [GET] + Response 200 (application/json) + Attributes + status: ok (string, required) ## Authentication [/auth] ### Authenticate New/Old User [POST] + Request (application/json) + Attributes + id_token (string, required) + Response 200 (application/json) + Attributes + status: ok, new, incomplete (enum[string], required, fixed) + jwt (string, required) + Response 500 (application/json) + Attributes + message: `failed to get certificates from Google: <reason>` (string, required) + Response 401 (application/json) + Attributes + message: `token is expired` (string, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed-type) + `invalid id_token` + `invalid id_token: <reason>` + `invalid id_token format: <reason>` + Response 403 (application/json) + Attributes + status: non-student (string, required, fixed) ### Validate User [GET /auth/validate] + Response 200 (application/json) + Attributes + jwt (string, required) - New JWT ### Authenticate API Key [POST /auth/api] + Request (application/json) + Attributes + api_key (string, required) + Response 200 (application/json) + Attributes + jwt (string, required) ## Classes [/classes/{quarter_id}/{professor_id}/{course_id}] ### Get Class Details [GET] + Parameters + quarter_id: 3900 (number) - The ID of the quarter that the class was taught + professor_id: 1 (number) - The ID of the professor that taught the class + course_id: 1 (number) - The ID of the course that was taught + Response 200 (application/json) + Attributes + course (Course, required) + quarter (Quarter, required) + professor (Professor, required) + user_posted: false (boolean, required) Whether the current user has posted an evaluation or not for this combination + Response 404 (application/json) + Attributes + message: class does not exist (string, required, fixed) ## Courses [/courses] ### List All Courses [GET /courses{?quarter_id,professor_id}] + Parameters + quarter_id (optional, number) - Limit the list to courses that were taught during the specified quarter + professor_id (optional, number) - Limit the list to courses that were taught by the specified professor + Response 200 (application/json) + Attributes (array[Course], fixed-type) ### Post Courses [POST] + Request (application/json) + Attributes + courses (array, fixed-type) + (object, required) + term: 3900 (string, required) + subject: ANTH (string, required) + catalog_nbr: 1L (string, required) + class_descr: Intro to Bio Anth (string, required) + instr_1: Doe, John (string, required) + instr_2 (string, required) + instr_3 (string, required) + Response 200 (application/json) + Attributes + result: success (string, fixed) + updated_count: 248 (number, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed) + Members + `The request was well-formed but was unable to be followed due to semantic errors.` + missing department to COEN ### Get Course Details [GET /courses/{id}{?embed}] + Parameters + id: 1 (number) - The course for which to get details + embed (enum[string], optional) Which other data to embed. Specifying `professors` gives you a list of professors that has taught the course. + Members + `professors` + Response 200 (application/json) Example response with the professors embedded. + Attributes (Course, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + professors (array[Professor], optional) + Response 404 (application/json) + Attributes + message: course with the specified id not found (string, required, fixed) ## Departments [/departments] ### List All Departments [GET] + Response 200 (application/json) + Attributes (array[Department], required, fixed-type) ### Post Departments [POST] + Request (application/json) + Attributes + departments (array, required, fixed-type) + (object) + value: ACTG (string, required) + label: `Accounting (ACTG)` (string, required) + school: BUS (string, required) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + updated_count: 74 (number, required) + Response 422 (application/json) + Attributes + message: `The request was well-formed but was unable to be followed due to semantic errors.` (string, required, fixed) ## Evaluations [/evaluations] ### List All Your Own Evaluations [GET] + Response 200 (application/json) + Attributes (array, required, fixed-type) + (Evaluation) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### List Recent Evaluations [GET /evaluations/recent{?count}] + Parameters + count (number, optional) - How many recent evaluations to return. + Default: 10 + Response 200 (application/json) + Attributes (array, required) + (Evaluation, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### Get Evaluation Details [GET /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 200 (application/json) + Attributes (Evaluation, required) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) ### Submit Evaluation [POST] + Request (application/json) + Attributes + quarter_id: 3900 (number, required) + professor_id: 1 (number, required) + course_id: 1 (number, required) + display_grad_year: false (boolean, required) + display_majors: true (boolean, required) + evaluation (EvaluationDataV1, required) + Response 201 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 422 (application/json) + Attributes + message: `invalid quarter/course/professor combination` (string, required, fixed) + Response 409 + Attributes + message: `evaluation for this combination already exists` (string, required, fixed) ### Delete Evaluation [DELETE /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `you are only allowed to delete your own evaluations` (string, required, fixed) ## Evaluation Votes [/evaluations/{id}/vote] + Parameters + id: 1 (number, required) ### Add/Overwrite Vote [PUT] + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `not allowed to vote on your own evaluations` (string, required, fixed) ### Delete Vote [DELETE /evaluations/{eval_id}/vote/{vote_id}] + Parameters + eval_id: 1 (number, required) + vote_id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message (enum[string], required, fixed) + `evaluation with the specified id not found` + `vote not found` ## Majors [/majors] ### List All Majors [GET] + Response 200 (application/json) + Attributes (array[Major], required, fixed-type) ### Post Majors [POST] + Request (application/json) + Attributes + majors (array[string], required, fixed-type) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + Response 422 (application/json) + Attributes + message: `failed to insert majors: <db error>` (string, required) ## Professors [/professors] ### List All Professors [GET /professors{?course_id,quarter_id}] + Parameters + course_id: 1 (number, optional) - Limit the list to professors that taught the specified course. + quarter_id: 3900 (number, optional) - Limit the list to professors who taught during the specified quarter. + Response 200 (application/json) + Attributes (array[Professor], required, fixed-type) ### Get Professor Details [GET /professors/{id}{?embed}] + Parameters + id: 1 (number) - The professor for which to get details. + embed (enum[string], optional) Which other data to embed. Specifying `courses` gives you a list of courses that this professor has taught. + Members + `courses` + Response 200 (application/json) Example response with the courses embedded. + Attributes (Professor, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + course (Course, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + courses (array[Course], optional) + Response 404 (application/json) + Attributes + message: professor with the specified id not found (string, required, fixed) ## Quarters [/quarters{?course_id,professor_id}] ### List All Quarters [GET] + Parameters + course_id: 1 (number, optional) - Limit the list to quarters during which the specified course was taught. + professor_id: 1 (number, optional) - Limit the list to quarters during which the specified professor taught. + Response 200 (application/json) + Attributes (array[Quarter], required, fixed-type) ## Search [/search{?q,limit}] + Parameters + q: Mat (string, required) - The search query. + limit (number, optional) - Limit the number of results. Max is 50. + Default: 50 ### Search For Classes And Professors [GET] + Response 200 (application/json) + Attributes + courses (array[Course], required, fixed-type) + professors (array[Professor], required, fixed-type) ## Students [/students/{id}] + Parameters + id: 1 (number, required) ### Update Info [PATCH] + Request (application/json) + Attributes + graduation_year: 2020 (number, required) + gender: m, f, o (enum[string], required, fixed) + majors: 1, 4 (array[number], required) - Between 1 and 3 major IDs. + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 403 (application/json) + Attributes + message: `you do not have the rights to modify another student` (string, required, fixed) + Response 422 (application/json) + Attributes + message: `invalid major(s) specified` (string, required, fixed) # Data Structures ## Course (object) + id: 1 (number, required) + number: 42 (number, required) + title: What is Life (string, required) + department_id: 3 (number, required) ## Department (object) + id: 1 (number, required) + abbr: COEN (string, required) + name: Computer Science & Engineering (string, required) + school: EGR (string, required) ## Evaluation (object) + id: 1 (number, required) + version: 1 (number, required) + post_time: `2018-02-06T22:24:11.098122-08:00` (string, required) - Post time in ISO 8601 + data (EvaluationDataV1, required) + votes_score: `-3` (number, required) ## EvaluationDataV1 (object) + attitude: 1 (number, required) + availability: 1 (number, required) + clarity: 1 (number, required) + grading_speed: 1 (number, required) + resourcefulness: 1 (number, required) + easiness: 1 (number, required) + workload: 1 (number, required) + recommended: 1 (number, required) + comment: Love the lectures (string, required) ## Major (object) + id: 1 (number, required) + name: Mathematics (string, required) ## Professor (object) + id: 1 (number, required) + first_name: John (string, required) + last_name: Doe (string, required) ## Quarter (object) + id: 1 (number, required) + year: 2018 (number, required) + name: Spring (string, required) + current: true (boolean, required) ## Student (User) + gender: m, f, o (enum[string], required) + graduation_year: 2020 (number, required) + majors (array[number], required) - An array of majors ids ## User (object) + id: 1 (number, required) + university_id: 1 (number, required) + email: [email protected] (string, required) + first_name: John (string, required) + last_name: Doe (string, required) + picture: https://foo.bar/d3hj2d2lk8 (string, required) - The URL to the user's picture + roles (array[number], required) - An array of roles ids
Fix incorrect parameter type
Fix incorrect parameter type
API Blueprint
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
963ce8e54296af05a48ea9c31be2254402820d10
apiary.apib
apiary.apib
FORMAT: 1A # SCU Evals The SCU Evals API powers the SCU Evals front-end by managing all the data and actions. ## Meta [/] ### Get API Status [GET] + Response 200 (application/json) + Attributes + status: ok (string, required) ## Authentication [/auth] ### Authenticate New/Old User [POST] + Request (application/json) + Attributes + id_token (string, required) + Response 200 (application/json) + Attributes + status: ok, new, incomplete (enum[string], required, fixed) + jwt (string, required) + Response 500 (application/json) + Attributes + message: `failed to get certificates from Google: <reason>` (string, required) + Response 401 (application/json) + Attributes + message: `token is expired` (string, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed-type) + `invalid id_token` + `invalid id_token: <reason>` + `invalid id_token format: <reason>` + Response 403 (application/json) + Attributes + status: non-student (string, required, fixed) ### Validate User [GET /auth/validate] + Response 200 (application/json) + Attributes + jwt (string, required) - New JWT ### Authenticate API Key [POST /auth/api] + Request (application/json) + Attributes + api_key (string, required) + Response 200 (application/json) + Attributes + jwt (string, required) ## Classes [/classes/{quarter_id}/{professor_id}/{course_id}] ### Get Class Details [GET] + Parameters + quarter_id: 3900 (number) - The ID of the quarter that the class was taught + professor_id: 1 (number) - The ID of the professor that taught the class + course_id: 1 (number) - The ID of the course that was taught + Response 200 (application/json) + Attributes + course (Course, required) + quarter (Quarter, required) + professor (Professor, required) + user_posted: false (boolean, required) Whether the current user has posted an evaluation or not for this combination + Response 404 (application/json) + Attributes + message: class does not exist (string, required, fixed) ## Courses [/courses] ### List All Courses [GET /courses{?quarter_id,professor_id}] + Parameters + quarter_id (optional, number) - Limit the list to courses that were taught during the specified quarter + professor_id (optional, number) - Limit the list to courses that were taught by the specified professor + Response 200 (application/json) + Attributes (array[Course], fixed-type) ### Post Courses [POST] + Request (application/json) + Attributes + courses (array, fixed-type) + (object, required) + term: 3900 (string, required) + subject: ANTH (string, required) + catalog_nbr: 1 (number, required) + class_descr: Intro to Bio Anth (string, required) + instr_1: Doe, John (string, required) + instr_2 (string, required) + instr_3 (string, required) + Response 200 (application/json) + Attributes + result: success (string, fixed) + updated_count: 248 (number, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed) + Members + `The request was well-formed but was unable to be followed due to semantic errors.` + missing department to COEN ### Get Course Details [GET /courses/{id}{?embed}] + Parameters + id: 1 (number) - The course for which to get details + embed (enum[string], optional) Which other data to embed. Specifying `professors` gives you a list of professors that has taught the course. + Members + `professors` + Response 200 (application/json) Example response with the professors embedded. + Attributes (Course, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + professors (array[Professor], optional) + Response 404 (application/json) + Attributes + message: course with the specified id not found (string, required, fixed) ## Departments [/departments] ### List All Departments [GET] + Response 200 (application/json) + Attributes (array[Department], required, fixed-type) ### Post Departments [POST] + Request (application/json) + Attributes + departments (array, required, fixed-type) + (object) + value: ACTG (string, required) + label: `Accounting (ACTG)` (string, required) + school: BUS (string, required) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + updated_count: 74 (number, required) + Response 422 (application/json) + Attributes + message: `The request was well-formed but was unable to be followed due to semantic errors.` (string, required, fixed) ## Evaluations [/evaluations] ### List All Your Own Evaluations [GET] + Response 200 (application/json) + Attributes (array, required, fixed-type) + (Evaluation) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### List Recent Evaluations [GET /evaluations/recent{?count}] + Parameters + count (number, optional) - How many recent evaluations to return. + Default: 10 + Response 200 (application/json) + Attributes (array, required) + (Evaluation, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### Get Evaluation Details [GET /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 200 (application/json) + Attributes (Evaluation, required) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) ### Submit Evaluation [POST] + Request (application/json) + Attributes + quarter_id: 3900 (number, required) + professor_id: 1 (number, required) + course_id: 1 (number, required) + display_grad_year: false (boolean, required) + display_majors: true (boolean, required) + evaluation (EvaluationDataV1, required) + Response 201 (application/json) + Attributes + result: success (string, required, fixed) + Response 422 (application/json) + Attributes + message: `invalid quarter/course/professor combination` (string, required, fixed) + Response 409 + Attributes + message: `evaluation for this combination already exists` (string, required, fixed) ### Delete Evaluation [DELETE /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `you are only allowed to delete your own evaluations` (string, required, fixed) ## Evaluation Votes [/evaluations/{id}/vote] + Parameters + id: 1 (number, required) ### Add/Overwrite Vote [PUT] + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `not allowed to vote on your own evaluations` (string, required, fixed) ### Delete Vote [DELETE /evaluations/{eval_id}/vote/{vote_id}] + Parameters + eval_id: 1 (number, required) + vote_id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message (enum[string], required, fixed) + `evaluation with the specified id not found` + `vote not found` ## Majors [/majors] ### List All Majors [GET] + Response 200 (application/json) + Attributes (array[Major], required, fixed-type) ### Post Majors [POST] + Request (application/json) + Attributes + majors (array[string], required, fixed-type) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + Response 422 (application/json) + Attributes + message: `failed to insert majors: <db error>` (string, required) ## Professors [/professors] ### List All Professors [GET /professors{?course_id,quarter_id}] + Parameters + course_id: 1 (number, optional) - Limit the list to professors that taught the specified course. + quarter_id: 3900 (number, optional) - Limit the list to professors who taught during the specified quarter. + Response 200 (application/json) + Attributes (array[Professor], required, fixed-type) ### Get Professor Details [GET /professors/{id}{?embed}] + Parameters + id: 1 (number) - The professor for which to get details. + embed (enum[string], optional) Which other data to embed. Specifying `courses` gives you a list of courses that this professor has taught. + Members + `courses` + Response 200 (application/json) Example response with the courses embedded. + Attributes (Professor, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + course (Course, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + courses (array[Course], optional) + Response 404 (application/json) + Attributes + message: professor with the specified id not found (string, required, fixed) ## Quarters [/quarters{?course_id,professor_id}] ### List All Quarters [GET] + Parameters + course_id: 1 (number, optional) - Limit the list to quarters during which the specified course was taught. + professor_id: 1 (number, optional) - Limit the list to quarters during which the specified professor taught. + Response 200 (application/json) + Attributes (array[Quarter], required, fixed-type) ## Search [/search{?q,limit}] + Parameters + q: Mat (string, required) - The search query. + limit (number, optional) - Limit the number of results. Max is 50. + Default: 50 ### Search For Classes And Professors [GET] + Response 200 (application/json) + Attributes + courses (array[Course], required, fixed-type) + professors (array[Professor], required, fixed-type) ## Students [/students/{id}] + Parameters + id: 1 (number, required) ### Update Info [PATCH] + Request (application/json) + Attributes + graduation_year: 2020 (number, required) + gender: m, f, o (enum[string], required, fixed) + majors: 1, 4 (array[number], required) - Between 1 and 3 major IDs. + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 403 (application/json) + Attributes + message: `you do not have the rights to modify another student` (string, required, fixed) + Response 422 (application/json) + Attributes + message: `invalid major(s) specified` (string, required, fixed) # Data Structures ## Course (object) + id: 1 (number, required) + number: 42 (number, required) + title: What is Life (string, required) + department_id: 3 (number, required) ## Department (object) + id: 1 (number, required) + abbr: COEN (string, required) + name: Computer Science & Engineering (string, required) + school: EGR (string, required) ## Evaluation (object) + id: 1 (number, required) + version: 1 (number, required) + post_time: `2018-02-06T22:24:11.098122-08:00` (string, required) - Post time in ISO 8601 + data (EvaluationDataV1, required) + votes_score: `-3` (number, required) ## EvaluationDataV1 (object) + attitude: 1 (number, required) + availability: 1 (number, required) + clarity: 1 (number, required) + grading_speed: 1 (number, required) + resourcefulness: 1 (number, required) + easiness: 1 (number, required) + workload: 1 (number, required) + recommended: 1 (number, required) + comment: Love the lectures (string, required) ## Major (object) + id: 1 (number, required) + name: Mathematics (string, required) ## Professor (object) + id: 1 (number, required) + first_name: John (string, required) + last_name: Doe (string, required) ## Quarter (object) + id: 1 (number, required) + year: 2018 (number, required) + name: Spring (string, required) + current: true (boolean, required) ## Student (User) + gender: m, f, o (enum[string], required) + graduation_year: 2020 (number, required) + majors (array[number], required) - An array of majors ids ## User (object) + id: 1 (number, required) + university_id: 1 (number, required) + email: [email protected] (string, required) + first_name: John (string, required) + last_name: Doe (string, required) + picture: https://foo.bar/d3hj2d2lk8 (string, required) - The URL to the user's picture + roles (array[number], required) - An array of roles ids
FORMAT: 1A # SCU Evals The SCU Evals API powers the SCU Evals front-end by managing all the data and actions. ## Meta [/] ### Get API Status [GET] + Response 200 (application/json) + Attributes + status: ok (string, required) ## Authentication [/auth] ### Authenticate New/Old User [POST] + Request (application/json) + Attributes + id_token (string, required) + Response 200 (application/json) + Attributes + status: ok, new, incomplete (enum[string], required, fixed) + jwt (string, required) + Response 500 (application/json) + Attributes + message: `failed to get certificates from Google: <reason>` (string, required) + Response 401 (application/json) + Attributes + message: `token is expired` (string, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed-type) + `invalid id_token` + `invalid id_token: <reason>` + `invalid id_token format: <reason>` + Response 403 (application/json) + Attributes + status: non-student (string, required, fixed) ### Validate User [GET /auth/validate] + Response 200 (application/json) + Attributes + jwt (string, required) - New JWT ### Authenticate API Key [POST /auth/api] + Request (application/json) + Attributes + api_key (string, required) + Response 200 (application/json) + Attributes + jwt (string, required) ## Classes [/classes/{quarter_id}/{professor_id}/{course_id}] ### Get Class Details [GET] + Parameters + quarter_id: 3900 (number) - The ID of the quarter that the class was taught + professor_id: 1 (number) - The ID of the professor that taught the class + course_id: 1 (number) - The ID of the course that was taught + Response 200 (application/json) + Attributes + course (Course, required) + quarter (Quarter, required) + professor (Professor, required) + user_posted: false (boolean, required) Whether the current user has posted an evaluation or not for this combination + Response 404 (application/json) + Attributes + message: class does not exist (string, required, fixed) ## Courses [/courses] ### List All Courses [GET /courses{?quarter_id,professor_id}] + Parameters + quarter_id (optional, number) - Limit the list to courses that were taught during the specified quarter + professor_id (optional, number) - Limit the list to courses that were taught by the specified professor + Response 200 (application/json) + Attributes (array[Course], fixed-type) ### Post Courses [POST] + Request (application/json) + Attributes + courses (array, fixed-type) + (object, required) + term: 3900 (string, required) + subject: ANTH (string, required) + catalog_nbr: 1 (number, required) + class_descr: Intro to Bio Anth (string, required) + instr_1: Doe, John (string, required) + instr_2 (string, required) + instr_3 (string, required) + Response 200 (application/json) + Attributes + result: success (string, fixed) + updated_count: 248 (number, required) + Response 422 (application/json) + Attributes + message (enum[string], required, fixed) + Members + `The request was well-formed but was unable to be followed due to semantic errors.` + missing department to COEN ### Get Course Details [GET /courses/{id}{?embed}] + Parameters + id: 1 (number) - The course for which to get details + embed (enum[string], optional) Which other data to embed. Specifying `professors` gives you a list of professors that has taught the course. + Members + `professors` + Response 200 (application/json) Example response with the professors embedded. + Attributes (Course, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + professors (array[Professor], optional) + Response 404 (application/json) + Attributes + message: course with the specified id not found (string, required, fixed) ## Departments [/departments] ### List All Departments [GET] + Response 200 (application/json) + Attributes (array[Department], required, fixed-type) ### Post Departments [POST] + Request (application/json) + Attributes + departments (array, required, fixed-type) + (object) + value: ACTG (string, required) + label: `Accounting (ACTG)` (string, required) + school: BUS (string, required) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + updated_count: 74 (number, required) + Response 422 (application/json) + Attributes + message: `The request was well-formed but was unable to be followed due to semantic errors.` (string, required, fixed) ## Evaluations [/evaluations] ### List All Your Own Evaluations [GET] + Response 200 (application/json) + Attributes (array, required, fixed-type) + (Evaluation) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### List Recent Evaluations [GET /evaluations/recent{?count}] + Parameters + count (number, optional) - How many recent evaluations to return. + Default: 10 + Response 200 (application/json) + Attributes (array, required) + (Evaluation, required) + quarter_id: 3900 (number, required) + professor (Professor, required) + course (Course, required) ### Get Evaluation Details [GET /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 200 (application/json) + Attributes (Evaluation, required) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) ### Submit Evaluation [POST] + Request (application/json) + Attributes + quarter_id: 3900 (number, required) + professor_id: 1 (number, required) + course_id: 1 (number, required) + display_grad_year: false (boolean, required) + display_majors: true (boolean, required) + evaluation (EvaluationDataV1, required) + Response 201 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 422 (application/json) + Attributes + message: `invalid quarter/course/professor combination` (string, required, fixed) + Response 409 + Attributes + message: `evaluation for this combination already exists` (string, required, fixed) ### Delete Evaluation [DELETE /evaluations/{id}] + Parameters + id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `you are only allowed to delete your own evaluations` (string, required, fixed) ## Evaluation Votes [/evaluations/{id}/vote] + Parameters + id: 1 (number, required) ### Add/Overwrite Vote [PUT] + Response 204 (application/json) + Response 404 (application/json) + Attributes + message: `evaluation with the specified id not found` (string, required, fixed) + Response 403 (application/json) + Attributes + message: `not allowed to vote on your own evaluations` (string, required, fixed) ### Delete Vote [DELETE /evaluations/{eval_id}/vote/{vote_id}] + Parameters + eval_id: 1 (number, required) + vote_id: 1 (number, required) + Response 204 (application/json) + Response 404 (application/json) + Attributes + message (enum[string], required, fixed) + `evaluation with the specified id not found` + `vote not found` ## Majors [/majors] ### List All Majors [GET] + Response 200 (application/json) + Attributes (array[Major], required, fixed-type) ### Post Majors [POST] + Request (application/json) + Attributes + majors (array[string], required, fixed-type) + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + Response 422 (application/json) + Attributes + message: `failed to insert majors: <db error>` (string, required) ## Professors [/professors] ### List All Professors [GET /professors{?course_id,quarter_id}] + Parameters + course_id: 1 (number, optional) - Limit the list to professors that taught the specified course. + quarter_id: 3900 (number, optional) - Limit the list to professors who taught during the specified quarter. + Response 200 (application/json) + Attributes (array[Professor], required, fixed-type) ### Get Professor Details [GET /professors/{id}{?embed}] + Parameters + id: 1 (number) - The professor for which to get details. + embed (enum[string], optional) Which other data to embed. Specifying `courses` gives you a list of courses that this professor has taught. + Members + `courses` + Response 200 (application/json) Example response with the courses embedded. + Attributes (Professor, required) + evaluations (array, required, fixed-type) + (Evaluation, required) + user_vote: true (boolean, required) + quarter_id: 3900 (number, required) + course (Course, required) + author (required) + self: false (boolean, required) + majors: 1, 3 (array[number], required) + graduation_year: 2020 (number, required) + courses (array[Course], optional) + Response 404 (application/json) + Attributes + message: professor with the specified id not found (string, required, fixed) ## Quarters [/quarters{?course_id,professor_id}] ### List All Quarters [GET] + Parameters + course_id: 1 (number, optional) - Limit the list to quarters during which the specified course was taught. + professor_id: 1 (number, optional) - Limit the list to quarters during which the specified professor taught. + Response 200 (application/json) + Attributes (array[Quarter], required, fixed-type) ## Search [/search{?q,limit}] + Parameters + q: Mat (string, required) - The search query. + limit (number, optional) - Limit the number of results. Max is 50. + Default: 50 ### Search For Classes And Professors [GET] + Response 200 (application/json) + Attributes + courses (array[Course], required, fixed-type) + professors (array[Professor], required, fixed-type) ## Students [/students/{id}] + Parameters + id: 1 (number, required) ### Update Info [PATCH] + Request (application/json) + Attributes + graduation_year: 2020 (number, required) + gender: m, f, o (enum[string], required, fixed) + majors: 1, 4 (array[number], required) - Between 1 and 3 major IDs. + Response 200 (application/json) + Attributes + result: success (string, required, fixed) + jwt (string, required) + Response 403 (application/json) + Attributes + message: `you do not have the rights to modify another student` (string, required, fixed) + Response 422 (application/json) + Attributes + message: `invalid major(s) specified` (string, required, fixed) # Data Structures ## Course (object) + id: 1 (number, required) + number: 42 (number, required) + title: What is Life (string, required) + department_id: 3 (number, required) ## Department (object) + id: 1 (number, required) + abbr: COEN (string, required) + name: Computer Science & Engineering (string, required) + school: EGR (string, required) ## Evaluation (object) + id: 1 (number, required) + version: 1 (number, required) + post_time: `2018-02-06T22:24:11.098122-08:00` (string, required) - Post time in ISO 8601 + data (EvaluationDataV1, required) + votes_score: `-3` (number, required) ## EvaluationDataV1 (object) + attitude: 1 (number, required) + availability: 1 (number, required) + clarity: 1 (number, required) + grading_speed: 1 (number, required) + resourcefulness: 1 (number, required) + easiness: 1 (number, required) + workload: 1 (number, required) + recommended: 1 (number, required) + comment: Love the lectures (string, required) ## Major (object) + id: 1 (number, required) + name: Mathematics (string, required) ## Professor (object) + id: 1 (number, required) + first_name: John (string, required) + last_name: Doe (string, required) ## Quarter (object) + id: 1 (number, required) + year: 2018 (number, required) + name: Spring (string, required) + current: true (boolean, required) ## Student (User) + gender: m, f, o (enum[string], required) + graduation_year: 2020 (number, required) + majors (array[number], required) - An array of majors ids ## User (object) + id: 1 (number, required) + university_id: 1 (number, required) + email: [email protected] (string, required) + first_name: John (string, required) + last_name: Doe (string, required) + picture: https://foo.bar/d3hj2d2lk8 (string, required) - The URL to the user's picture + roles (array[number], required) - An array of roles ids
Update evaluation post docs
Update evaluation post docs
API Blueprint
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
cf0fa85d053fb0c58c986ac816f5886901449afa
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://polls.apiblueprint.org/ # inpassing A web API for managing the lending and borrowing of passes. ## Group Orgs ## Org [/orgs] + Attribute + id: 2 (number) + name: Locust Valley High School (string) ### Create a new org [POST] + Request (application/json) { "name": "Locust Valley High School" } + Response 201 + Headers Location: /orgs/2 ### Search orgs by name [GET /orgs/search{?q}] + Parameters - q: `Locust Valley` (string) - Query string + Response 200 (application/json) [ { "id": 2, "name": "Locust Valley High School" } ] ### Query an org [GET /orgs/{id}] + Parameters - id (number) - Org ID + Request Anonymous Without authentication, only basic information about an org will be returned. + Body + Response 200 (application/json) + Attributes (Org) + Request Authenticated Use authentication to get more information about an org relevant to the user's role in that org. + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Org) + greeting_fmt: `Today is a {} day` (string) - The greeting format ## Org Participant collection [/orgs/{id}/participants] ### Query participants [GET] Returns a list of participants of a given org. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (array[User]) + Response 403 The authenticated user must be a mod of this organization. + Body ### Add user [POST] Makes a user a participant of an org. This must either be a user adding itself or a mod adding people. + Request (application/json) + Headers Authorization: Bearer JWT + Attributes + user_id: 2 (number) - The user to make a participant of this organization. + Response 202 (application/json) The org will receive the users request to participate in an org. + Body + Response 204 (application/json) The user submitted is now a participant of this org. + Header Location: /orgs/2/participants/2 ### Query user [GET /orgs/{org_id}/participants/{user_id}] Returns the user object of an org participant. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (User) + Response 404 (application/json) The user may not exist, or the authenticated user may not have permission to view it. + Body ## Org Moderator collection [/orgs/{id}/moderators] ### Query moderators [GET] Returns a list of moderators of a given org. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (array[User]) + Response 403 The authenticated user must be a mod of this organization. + Body ### Add user [POST] Makes a user a mod of an org. The authenticated user must be a moderator itself. + Request (application/json) + Headers Authorization: Bearer JWT + Attributes + user_id: 2 (number) - The user to make a moderator of this organization. + Response 204 (application/json) The user submitted is now a moderator of this org. + Header Location: /orgs/2/moderators/2 ### Query user [GET /orgs/{org_id}/moderators/{user_id}] Returns the user object of an org moderator. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (User) + Response 404 (application/json) The user may not exist, or the authenticated user may not have permission to view it. + Body ## Day State [/orgs/{org_id}/daystates] + Attributes + id: 1 (number) - The ID of the day state. + Include Day State Create ### Query state collection [GET] Return information about an org day state. + Parameters + org_id: 2 (number) - The org whose states are to be queried. + Request The authenticated user must be a participant or moderator of the org to query states. + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (array[Day State]) ### Create a state [POST] Creates a new day state associated with a given organization. + Parameters + org_id: 2 (number) - The org that will receive the new state. + Request The authenticated user must moderate the org + Header Authorization: Bearer JWT + Attributes (Day State Create) + Response 201 (application/json) + Attributes (Day State) ### Query a state [GET /orgs/{org_id}/daystates/{daystate_id}] Returns a particular day state object. + Request + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Day State) ### Update a state [PUT /orgs/{org_id}/daystates/{daystate_id}] Changes the identifier and/or greeting of a day state. + Request (application/json) + Header Authorization: Bearer JWT + Attributes + identifier: `A` (string, optional) + greeting: `Updated greeting - A day` (string, optional) + Response 200 (application/json) + Attributes (Day State) ### Get the current day state [GET /orgs/{org_id}/daystates/current] Returns the current day state, this will change on a day by day basis. + Request + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Day State) + Response 404 (application/json) This occurs when an org has no rules defined for day states (or no day states to begin with). + Body ## Group Users ## User [/users] + Attributes + id (number) + first_name (string) + last_name (string) + email (string) + moderates (array[Org]) + participates (array[Org]) + passes (array[Pass]) ### Create a user [POST] + Request (application/json) + Attributes + first_name: Luke (string) - User first name + last_name: San Antonio Bialecki (string) - User last name + email: `[email protected]` (string) - User email (used to log in) + password: `iUs3tHe$aMepAs$wOrdF0rEvEritHiNg` (string) - User password + Response 201 + Headers Location: /users/2 ### Authenticate as user [POST /users/auth] + Request (application/json) { "email": "[email protected]", "password": "iUs3tHe$aMepAs$wOrdF0rEvEritHiNg" } + Response 200 (application/json) { "access_token": "<JWT_TOKEN>" } + Response 403 (application/json) { "msg": "invalid username or password" } ## Self [/me] ### Query self [GET] Returns an object describing the authenticated user. + Request + Header Authentication: Bearer JWT + Response 200 (application/json) + Body { "id": 2, "first_name": "Luke" "last_name": "San Antonio Bialecki", "email": "[email protected]", "participates": [ { "id": 2, "name": "Locust Valley High School" } ], "moderates": [ { "id": 1, "name": "Test org" } ], "passes": [ { "id": 3, "org_id": 2, "owner_id": 2, "request_time": "2017-02-03:23:00:12", "requested_state_id": 2, "requested_spot_num": 20, "assigned_time": "2017-02-04:07:42:12", "assigned_state_id": 2, "assigned_spot_num": 15 }, { "id": 4, "org_id": 2, "owner_id": 2, "request_time": "2017-02-06:13:55:32", "requested_state_id": 2, "requested_spot_num": 20, "assigned_time": null, "assigned_state_id": null, "assigned_spot_num": null } ] } ### Borrow a pass [POST /me/borrow] Creates a request to borrow a pass on behalf of the authenticated user for every day in the date range. + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 ### Stop borrowing a pass [POST /me/unborrow] Removes a request to borrow a pass on behalf of the authenticated user in a given date range. + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 ## Group Passes ## Pass [/passes{?org_id,user_id,verified}] + Attributes + id: 2 (number) - The pass ID + org_id: 1 (number) - The org that this pass belongs to + owner_id: 3 (number, nullable) - The user owner of the pass + request_time: `2017-02-03;23:00:12` (string) - Date and time of the pass request + requested_state_id: 2 (number) - Pass state requested by the user + requested_spot_num: 20 (number) - Pass spot requested by the user + assigned_time: `2017-02-03;23:15:12` (string, nullable) - Date and time when the pass was assigned / verified + assigned_state_id: 2 (number, nullable) - Pass state assigned to this pass + assigned_spot_num: 25 (number, nullable) - Pass spot number assigned to this pass ### Query pass collection [GET] Filters all the passes that the user has access to. If the user is the mod of an org, all org passes are available to filter. + Parameters + org_id (number, optional) - Return passes associated with this Org + user_id (number, optional) - Return passes associated with this user + verified (boolean, optional) - Filter verified passes. If this is null or omitted, all passes will be returned. + Request (application/json) + Header Authentication: Bearer JWT + Response 200 (application/json) + Attributes (array[Pass]) ### Request a new pass [POST] Requests a new pass from an Org on behalf of the authenticated user. + Request (application/json) + Header Authentication: Bearer JWT + Attributes + org_id: 2 (number) - The Org that the pass is to be requested from + state_id: 1 (number) - The requested day state of the pass + spot_num: 25 (number) - The requested spot number + Response 201 (application/json) Note that although the pass object exists, the org will still need to verify it for it to be useful. + Header Location: /passes/2 + Attributes (Pass) + assigned_time - null + assigned_state_id - null + assigned_spot_num - null ### Query pass [GET /passes/{id}] Get specific pass object + Request + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Pass) + Response 403 (application/json) You can only query passes that you would have access to either as an org moderator or a user! + Body { "msg": "not authenticated to view this pass", "error_code": "foreign_pass" } ### Delete a pass [DELETE /passes/{id}] Deletes a pass. + Request + Header Authorization: Bearer JWT + Response 202 ### Assign pass [PUT /passes/{id}] Used to verify passes or re-assign them to different states or spot numbers. Any changes to the pass resulting from this call will result in `assigned_time` being updated. + Request + Header Authorization: Bearer JWT + Attributes + state_id (number, optional) - The new state of the pass + spot_num (number, optional) - The new spot number of the pass + Response 200 (application/json) + Attributes (Pass) ### Lend a pass [POST /passes/{pass_id}/lend] Creates a request to lend a pass on behalf of the user for every day in the date range. The pass will not be lent out on days that the user does not have access to the pass, but it is not an error to include these days in the date range. + Parameters + pass_id (number) - The pass to lend + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 ### Stop lending a pass [POST /passes/{pass_id}/unlend] Removes a request to lend a pass on behalf of the user in the given date range. + Parameters + pass_id (number) - The pass to unlend + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 # Data Structures ## Date + date: `2017-03-05` (string) - Date ## Date Range (object) + start_date: `2017-11-15` (string) - Start date + end_date: `2018-01-04` (string) - End date ## Date Selection (enum) + (Date) + (Date Range) ## Day State Create (object) + identifier: M (string) - A recognizable short name / character for the state + greeting: `Today is a Monday` (string) - The greeting used to inform clients of the state of the current day.
FORMAT: 1A HOST: http://polls.apiblueprint.org/ # inpassing A web API for managing the lending and borrowing of passes. ## Group Orgs ## Org [/orgs] + Attribute + id: 2 (number) + name: Locust Valley High School (string) ### Create a new org [POST] Create a new Org. The authenticated user will become a moderator. + Request (application/json) + Headers Authorization: Bearer JWT + Body { "name": "Locust Valley High School" } + Response 201 + Headers Location: /orgs/2 ### Search orgs by name [GET /orgs/search{?q}] + Parameters - q: `Locust Valley` (string) - Query string + Response 200 (application/json) [ { "id": 2, "name": "Locust Valley High School" } ] ### Query an org [GET /orgs/{id}] + Parameters - id (number) - Org ID + Request Anonymous Without authentication, only basic information about an org will be returned. + Body + Response 200 (application/json) + Attributes (Org) + Request Authenticated Use authentication to get more information about an org relevant to the user's role in that org. + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Org) + greeting_fmt: `Today is a {} day` (string) - The greeting format ## Org Participant collection [/orgs/{id}/participants] ### Query participants [GET] Returns a list of participants of a given org. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (array[User]) + Response 403 The authenticated user must be a mod of this organization. + Body ### Add user [POST] Makes a user a participant of an org. This must either be a user adding itself or a mod adding people. + Request (application/json) + Headers Authorization: Bearer JWT + Attributes + user_id: 2 (number) - The user to make a participant of this organization. + Response 202 (application/json) The org will receive the users request to participate in an org. + Body + Response 204 (application/json) The user submitted is now a participant of this org. + Header Location: /orgs/2/participants/2 ### Query user [GET /orgs/{org_id}/participants/{user_id}] Returns the user object of an org participant. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (User) + Response 404 (application/json) The user may not exist, or the authenticated user may not have permission to view it. + Body ## Org Moderator collection [/orgs/{id}/moderators] ### Query moderators [GET] Returns a list of moderators of a given org. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (array[User]) + Response 403 The authenticated user must be a mod of this organization. + Body ### Add user [POST] Makes a user a mod of an org. The authenticated user must be a moderator itself. + Request (application/json) + Headers Authorization: Bearer JWT + Attributes + user_id: 2 (number) - The user to make a moderator of this organization. + Response 204 (application/json) The user submitted is now a moderator of this org. + Header Location: /orgs/2/moderators/2 ### Query user [GET /orgs/{org_id}/moderators/{user_id}] Returns the user object of an org moderator. + Request + Headers Authorization: Bearer JWT + Response 200 (application/json) + Attributes (User) + Response 404 (application/json) The user may not exist, or the authenticated user may not have permission to view it. + Body ## Day State [/orgs/{org_id}/daystates] + Attributes + id: 1 (number) - The ID of the day state. + Include Day State Create ### Query state collection [GET] Return information about an org day state. + Parameters + org_id: 2 (number) - The org whose states are to be queried. + Request The authenticated user must be a participant or moderator of the org to query states. + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (array[Day State]) ### Create a state [POST] Creates a new day state associated with a given organization. + Parameters + org_id: 2 (number) - The org that will receive the new state. + Request The authenticated user must moderate the org + Header Authorization: Bearer JWT + Attributes (Day State Create) + Response 201 (application/json) + Attributes (Day State) ### Query a state [GET /orgs/{org_id}/daystates/{daystate_id}] Returns a particular day state object. + Request + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Day State) ### Update a state [PUT /orgs/{org_id}/daystates/{daystate_id}] Changes the identifier and/or greeting of a day state. + Request (application/json) + Header Authorization: Bearer JWT + Attributes + identifier: `A` (string, optional) + greeting: `Updated greeting - A day` (string, optional) + Response 200 (application/json) + Attributes (Day State) ### Get the current day state [GET /orgs/{org_id}/daystates/current] Returns the current day state, this will change on a day by day basis. + Request + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Day State) + Response 404 (application/json) This occurs when an org has no rules defined for day states (or no day states to begin with). + Body ## Group Users ## User [/users] + Attributes + id (number) + first_name (string) + last_name (string) + email (string) + moderates (array[Org]) + participates (array[Org]) + passes (array[Pass]) ### Create a user [POST] + Request (application/json) + Attributes + first_name: Luke (string) - User first name + last_name: San Antonio Bialecki (string) - User last name + email: `[email protected]` (string) - User email (used to log in) + password: `iUs3tHe$aMepAs$wOrdF0rEvEritHiNg` (string) - User password + Response 201 + Headers Location: /users/2 ### Authenticate as user [POST /users/auth] + Request (application/json) { "email": "[email protected]", "password": "iUs3tHe$aMepAs$wOrdF0rEvEritHiNg" } + Response 200 (application/json) { "access_token": "<JWT_TOKEN>" } + Response 403 (application/json) { "msg": "invalid username or password" } ## Self [/me] ### Query self [GET] Returns an object describing the authenticated user. + Request + Header Authentication: Bearer JWT + Response 200 (application/json) + Body { "id": 2, "first_name": "Luke" "last_name": "San Antonio Bialecki", "email": "[email protected]", "participates": [ { "id": 2, "name": "Locust Valley High School" } ], "moderates": [ { "id": 1, "name": "Test org" } ], "passes": [ { "id": 3, "org_id": 2, "owner_id": 2, "request_time": "2017-02-03:23:00:12", "requested_state_id": 2, "requested_spot_num": 20, "assigned_time": "2017-02-04:07:42:12", "assigned_state_id": 2, "assigned_spot_num": 15 }, { "id": 4, "org_id": 2, "owner_id": 2, "request_time": "2017-02-06:13:55:32", "requested_state_id": 2, "requested_spot_num": 20, "assigned_time": null, "assigned_state_id": null, "assigned_spot_num": null } ] } ### Borrow a pass [POST /me/borrow] Creates a request to borrow a pass on behalf of the authenticated user for every day in the date range. + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 ### Stop borrowing a pass [POST /me/unborrow] Removes a request to borrow a pass on behalf of the authenticated user in a given date range. + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 ## Group Passes ## Pass [/passes{?org_id,user_id,verified}] + Attributes + id: 2 (number) - The pass ID + org_id: 1 (number) - The org that this pass belongs to + owner_id: 3 (number, nullable) - The user owner of the pass + request_time: `2017-02-03;23:00:12` (string) - Date and time of the pass request + requested_state_id: 2 (number) - Pass state requested by the user + requested_spot_num: 20 (number) - Pass spot requested by the user + assigned_time: `2017-02-03;23:15:12` (string, nullable) - Date and time when the pass was assigned / verified + assigned_state_id: 2 (number, nullable) - Pass state assigned to this pass + assigned_spot_num: 25 (number, nullable) - Pass spot number assigned to this pass ### Query pass collection [GET] Filters all the passes that the user has access to. If the user is the mod of an org, all org passes are available to filter. + Parameters + org_id (number, optional) - Return passes associated with this Org + user_id (number, optional) - Return passes associated with this user + verified (boolean, optional) - Filter verified passes. If this is null or omitted, all passes will be returned. + Request (application/json) + Header Authentication: Bearer JWT + Response 200 (application/json) + Attributes (array[Pass]) ### Request a new pass [POST] Requests a new pass from an Org on behalf of the authenticated user. + Request (application/json) + Header Authentication: Bearer JWT + Attributes + org_id: 2 (number) - The Org that the pass is to be requested from + state_id: 1 (number) - The requested day state of the pass + spot_num: 25 (number) - The requested spot number + Response 201 (application/json) Note that although the pass object exists, the org will still need to verify it for it to be useful. + Header Location: /passes/2 + Attributes (Pass) + assigned_time - null + assigned_state_id - null + assigned_spot_num - null ### Query pass [GET /passes/{id}] Get specific pass object + Request + Header Authorization: Bearer JWT + Response 200 (application/json) + Attributes (Pass) + Response 403 (application/json) You can only query passes that you would have access to either as an org moderator or a user! + Body { "msg": "not authenticated to view this pass", "error_code": "foreign_pass" } ### Delete a pass [DELETE /passes/{id}] Deletes a pass. + Request + Header Authorization: Bearer JWT + Response 202 ### Assign pass [PUT /passes/{id}] Used to verify passes or re-assign them to different states or spot numbers. Any changes to the pass resulting from this call will result in `assigned_time` being updated. + Request + Header Authorization: Bearer JWT + Attributes + state_id (number, optional) - The new state of the pass + spot_num (number, optional) - The new spot number of the pass + Response 200 (application/json) + Attributes (Pass) ### Lend a pass [POST /passes/{pass_id}/lend] Creates a request to lend a pass on behalf of the user for every day in the date range. The pass will not be lent out on days that the user does not have access to the pass, but it is not an error to include these days in the date range. + Parameters + pass_id (number) - The pass to lend + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 ### Stop lending a pass [POST /passes/{pass_id}/unlend] Removes a request to lend a pass on behalf of the user in the given date range. + Parameters + pass_id (number) - The pass to unlend + Request + Header Authentication: Bearer JWT + Attributes (Date Selection) + Response 204 # Data Structures ## Date + date: `2017-03-05` (string) - Date ## Date Range (object) + start_date: `2017-11-15` (string) - Start date + end_date: `2018-01-04` (string) - End date ## Date Selection (enum) + (Date) + (Date Range) ## Day State Create (object) + identifier: M (string) - A recognizable short name / character for the state + greeting: `Today is a Monday` (string) - The greeting used to inform clients of the state of the current day.
Improve documentation for POST /orgs
Improve documentation for POST /orgs
API Blueprint
mit
lukesanantonio/inpassing-backend,lukesanantonio/inpassing-backend
d759dec156b038d06ff5eac71efe68d61f5b73b5
blueprint/examplecode.apib
blueprint/examplecode.apib
FORMAT: 1A [Example code directory on Github](https://github.com/the-grid/apidocs/tree/master/code-examples) # Dart ## Authenticate and get user information <!-- include(code-examples/dart/auth-getuser.dart) --> <!-- include(code-examples/dart/README.md) -->
FORMAT: 1A # Example code for using The Grid API [Example code directory on Github](https://github.com/the-grid/apidocs/tree/master/code-examples) # Dart ## Authenticate and get user information <!-- include(code-examples/dart/auth-getuser.dart) --> <!-- include(code-examples/dart/README.md) --> # Python ## Share a file <!-- include(code-examples/python/share-file.py) --> <!-- include(code-examples/python/README.md) -->
Add Python example
examplecode: Add Python example
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
e19137b76ede76447176be185fbeca8b8679cf1c
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://sandbox-api01.clanofthecloud.com # ClanOfthecloud APIs [ClanOfTheCloud](http://www.clanofthecloud.com) is a Mobile Gaming Backend as a Service (Baas) Company. You can create an account on our website, and try us with your next social game! We're multiplateform and offer a full API. ## Authentication Once you've created an account, you can provision a Game in the FrontOffice application. We're using a classic APIKEY / APISECRET couple to authenticate all requests. Every request should have two headers set with your game credentials : |Header | | |--- |--- | |x-apikey |Your API key | |x-apisecret|Your API secret| # Gamers routes In addition to the Authentication above, gamers are authenticated too. In the Clan, every user starts as an anonymous user. He can then opt-in to authenticate with Facebook or Google+. He can then use FB to authenticate even on other devices or to other games. There's no account creation... It's just an anonymous login (which creates an account that *should* be reused if possible), then Facebook or Google+ identities are automatically linked to his account as needed. ## Anonymous Login [/v1/gamer/login/anonymous] Before playing, the gamer needs an identity... Anonymous login provides such an identity. The response contains a `gamer_id` and a `gamer_token`. Both are opaque values and will be used to authenticate the gamer (with HTTP Basic Authentication). It is your responsibility to store the gamer_id and gamer_token to help the user log in later. ### Anonymous login [POST] + Request (application/json) + Headers x-apikey : test_api_key x-apisecret : test_api_secret + Response 200 (application/json) { "gamer_id" : "qsfd32sdf654g321d" , "gamer_token" : "dfg54g2dfg54sqdf32wfds54fqdf" , "api_version" : "v1" } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "Invalid App Credentials" } ## Login [/v1/gamer/login] The login route is used for : * returning anonymous gamers * gamers who want to change the account they use to play * gamers who want to associate another auth method with their current account The choice of the correct behavior is the responsibility of the server side: you don't have to worry about it! As a consequence, when calling login, you must provide credentials you already have **and** possibly other credentials too. HTTP Basic Authentication is used to authenticate all requests, including this one. * if you have saved a previous anonymous gamer, use these credentials Login for authenticated gamers will need two components: * anonymous user credentials: use the `gamer_id` and `gamer_token` above, saved locally from last connection * Facebook identity: use the `ID` and the `oauth token` from Facebook * Google+ identity: use the `ID` and the `oauth token` from Google+ * email and password: use the `user` and `password` It is necessary to specify both the Authorization header **and** the json document. ### Login [POST] + Request (application/json) + Headers x-apikey : test_api_key x-apisecret : test_api_secret Authorization: Basic `base 64 encoding of user:pass or id:token` + Response 200 (application/json) { "network" : "anonymous" "gamer_id" : "qsfd32sdf654g321d" , "gamer_token" : "dfg54g2dfg54sqdf32wfds54fqdf" } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "Invalid App Credentials" } ## Gamer Session [/gamer/session] ### sign in [PUT] ## register a new gamer, or reconnect after a lost of gamertoken this appends when at game first launch, after reinstalling game or after a logout |Header Field|Description|Value| |---|---|---| |Authentication|string, require| Authentication : Basic **apptoken** ###### body description |Field|Description|Value| |---|---|---| |network|string, require|can be one of ["email", "facebook", "googleplus", "anonymous"] |facebooktoken|string, required when {network=facebook}| the token returned by facebook login |googleplustoken|string, required when {network=googleplus}| the token returned by google login |email|string, required when {network=email}| gamer well formed email |password|string, required when {network=email}| gamer registered password *no fields are needed in case of 'anonymous' network* ###### response description |Field|Description|Value| |---|---|---| |gamerid|string| id related to the gamer for the current app, used by requests like postevent, addfriend, ... |gamertoken|string| token used in basic authentication for gamer authenticate requests |profile|json| gamer's profile, including "name", "email", "nickname", ... |vfs|json| list of key/value associated to the app/game |gamervfs|json| list of key/value associated to the gamer |matches|json| array of match currently in open state of the gamer + Request (application/json) + Headers Authentication : Basic apptoken + Body { "network": "cotc|facebook|googleplus|anonymous", "id" : "network dependant id", "token" : "network dependant authentification" } + Response 200 (application/json) { "gamerid" : "identifier of the user" , "gamertoken" : "reusable token used by gamer related requests" , "profile" : {}, "vfs" : {}, "gamervfs" : {}, "matches" : [] } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "optional short error message", "data" : "optional error data" } ### login [GET] ## login an existing gamer with an already known gamertoken this append when the gamertoken was saved ###### header description |Header Field|Description|Value| |---|---|---| |Authentication|string, require| Authentication : Basic **gamertoken** ###### response description this request as the same response a the login request except for the fields gamerid and gamertoken which are missing! + Request + Headers Authentication : Basic gamertoken + Response 200 (application/json) { "profile" : {}, "vfs" : {}, "gamervfs" : {}, "matches" : [] } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "the gamer token is no longer available, call signin!", "data" : "optional error data" } ### logout [DELETE] ## logout a gamer ### implementation * the gamertoken is removed from our cache (redis) * it has to be deleted on client-side! ###### header description |Header Field|Description|Value| |---|---|---| |Authentication|string, require| Authentication : Basic **gamertoken** + Request + Headers Authentication : Basic gamertoken + Response 200 ## Gamer VFS [/gamer/vfs] ### retieve gamer's data [GET] ###### header description |Header Field|Description|Value| |---|---|---| |Authentication|string, require| Authentication : Basic **gamertoken** ###### response description |Field|Description|Value| |---|---|---| |gamervfs|json| list of key/value associated to the gamer + Request + Headers Authentication : Basic gamertoken + Response 200 (application/json) { "gamervfs" : {} } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "the gamer token is no longer available, call signin!", "data" : "optional error data" }
FORMAT: 1A HOST: https://sandbox-api01.clanofthecloud.com # ClanOfthecloud APIs [ClanOfTheCloud](http://www.clanofthecloud.com) is a Mobile Gaming Backend as a Service (Baas) Company. You can create an account on our website, and try us with your next social game! We're multiplateform and offer a full API. ## Authentication Once you've created an account, you can provision a Game in the FrontOffice application. We're using a classic APIKEY / APISECRET couple to authenticate all requests. Every request should have two headers set with your game credentials : |Header | | |--- |--- | |x-apikey |Your API key | |x-apisecret|Your API secret| # Gamers routes In addition to the Authentication above, gamers are authenticated too. Before playing, the gamer needs an identity... Login provides such an identity. ## Login [/v1/gamer/login] The login route is used for authenticate a gamer HTTP Basic Authentication is used to authenticate all other requests, using the token returned by the request. The response contains a `gamer_token`. Its an opaque value and will be used to authenticate the gamer (with HTTP Basic Authentication). It is your responsibility to store the gamer_token to help the user log in later. Login for authenticated gamers will one of theese components: * Facebook identity: use the `ID` and the `oauth token` from Facebook * Google+ identity: use the `ID` and the `oauth token` from Google+ ###### body description |Field|Description|Value| |---|---|---| |network|string, required|can be one of ["email", "facebook", "googleplus"] |facebookid|string, required when {network=facebook}| the ID returned by facebook sdk |facebooktoken|string, required when {network=facebook}| the token returned by facebook sdk |googleplusid|string, required when {network=googleplus}| the ID returned by google sdk |googleplustoken|string, required when {network=googleplus}| the token returned by google sdk ###### response description |Field|Description|Value| |---|---|---| |gamertoken|string| token used in basic authentication for gamer authenticate requests |profile|json| gamer's profile, including "name", "email", "nickname", ... |vfs|json| list of key/value associated to the app/game |gamervfs|json| list of key/value associated to the gamer |matches|json| array of match currently in open state of the gamer ### Login [POST] + Request (application/json) + Headers x-apikey : test_api_key x-apisecret : test_api_secret + Body { "network": "facebook", "facebookid" : "1000001010", "facebooktoken" : "CAAIoRjU6xxYBAAy5Ymu...7XAehrcVQBUOG7oBVNatEUZD" } + Response 200 (application/json) { "gamer_token" : "dfg54g2dfg54sqdf32wfds54fqdf", "profile" : {}, "vfs" : {}, "gamervfs" : {} } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "Invalid App Credentials" } ### logout [DELETE] logout a gamer ### implementation * the gamer token has to be deleted on client-side! ###### header description |Header Field|Description|Value| |---|---|---| |Authentication|string, require| Authentication : Basic **gamertoken** + Request + Headers Authentication : Basic gamertoken + Response 200 ## Gamer VFS [/gamer/vfs/{key}] ### retieve gamer's data [GET] ###### header description |Header Field|Description|Value| |---|---|---| |Authentication|string, require| Authentication : Basic **gamertoken** ###### response description |Field|Description|Value| |---|---|---| |gamervfs|json| list of key/value associated to the gamer + Parameters + key (required, string) ... the desired key + Request + Headers Authentication : Basic gamertoken + Response 200 (application/json) { "gamervfs" : { "key" :"value" } } + Response 401 (application/json) { "code" : "Unauthorized", "message" : "the gamer token is no longer available, call signin!", "data" : "optional error data" }
remove sessions and anonymous
remove sessions and anonymous
API Blueprint
apache-2.0
clanofthecloud/api
142fa586252708bc3d4148b5df7d21fa1b81e6fd
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://datemo.info # Datemo Datemo is an API for documents. ## Documents Collection [/documents] ### Create a New Document [POST] You may create your own document using this action. - doc-string (string) - The document as an html string. - type (string) - The type of document (note, or document). + Request (application/json) { "doc-string": "<p>This is a paragraph.</p>", } + Response 201 (application/hal+json) { "_links": { "self": { "href": "/document/<id> } } "_embedded": { "doc-string": "<h1>Title</h1><p>This is a paragraph.</p>", "publishedAt": "2014-11-11T08:40:51.620Z", } } ## Document Resources [/documents/:id] ### View an Existing Document [GET] + Response 200 (application/hal+json) { "_links": { "self": { "href": "/document/<id> } } "_embedded": { "doc-string": "<h1>Title</h1><p>This is a paragraph.</p>", "publishedAt": "2014-11-11T08:40:51.620Z", } } ### Update an Existing Document [PUT] + Request (application/json) { "doc-string": "<p>Update for the document</p>" } + Response 200 (application/hal+json) { "_links": { "self": { "href": "/document/<id> } } "_embedded": { "doc-string": "<h1>Title</h1><p>This is a paragraph.</p>", "publishedAt": "2014-11-11T08:40:51.620Z", } }
FORMAT: 1A HOST: http://datemo.info # Datemo Datemo is an API for documents. ## Documents Collection [/documents] ### Create a New Document [POST] You may create your own document using this action. - doc-string (string) - The document as an html string. - type (string) - The type of document (note, or document). + Request (application/json) { "doc-string": "<p>This is a paragraph.</p>", } + Response 201 (application/hal+json) { "_links": { "self": { "href": "/document/58ca459f-a49f-46da-8bef-4b6cc2006696" } } "_embedded": { "id": "58ca459f-a49f-46da-8bef-4b6cc2006696", "doc-string": "<h1>Title</h1><p>This is a paragraph.</p>", "publishedAt": "2014-11-11T08:40:51.620Z", } } ## Document Resources [/documents/:id] ### View an Existing Document [GET] + Response 200 (application/hal+json) { "_links": { "self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" } } "_embedded": { "id": "58ca459f-a49f-46da-8bef-4b6cc2006696", "doc-string": "<h1>Title</h1><p>This is a paragraph.</p>", "publishedAt": "2014-11-11T08:40:51.620Z", } } ### Update an Existing Document [PUT] + Request (application/json) { "id": "58ca459f-a49f-46da-8bef-4b6cc2006696", "doc-string": "<p>Update for the document</p>" } + Response 200 (application/hal+json) { "_links": { "self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" } } "_embedded": { "doc-string": "<p>Updated for the document</p>", "lastUpdatedAt": "2014-12-30T09:00:23.340Z", "publishedAt": "2014-11-11T08:40:51.620Z", } }
Update api blueprint
Update api blueprint
API Blueprint
epl-1.0
ezmiller/datemo
647b9e61df96ef25c3cee99f4984eaed51b27cbd
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://api.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service. # Articles Article related resources of the **Money Advice Service**. ## Article [/articles/{id}] A single Article object with all its details + Parameters + id (required, string, `foo-bar`) ... String `id` of the Article to perform action with. Has example value. ### Retrieve a Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "id": "where-to-go-to-get-free-debt-advice", "title": "Where to go to get free debt advice" }
FORMAT: 1A HOST: https://api.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service. # Articles Article related resources of the **Money Advice Service**. ## Article [/articles/{id}] A single Article object with all its details + Parameters + id (required, string, `foo-bar`) ... String `id` of the Article to perform action with. Has example value. ### Retrieve a Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "id": "where-to-go-to-get-free-debt-advice", "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt" }
Add article description to API Blueprint
Add article description to API Blueprint
API Blueprint
mit
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
acde9158c27cc18261701aa81823274b8fcd9457
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://tidepool.io # tidepool-user-api The Tidepool User API is used to manage the user login information and pretty much nothing else. Temporarily, it also manages sessions. That will change. The apiary page is [here](http://docs.tidepooluserapi.apiary.io/). # Group User User related resources of the **User API** ## Status [/status] ### Retrieve status information [GET] Returns a status health check with a list of status of its dependencies + Response 200 If the server is operating properly and all dependencies are up and running. { "up" : [ "mongo" ], "down" : [] } + Response 500 If the server is *not* operating properly and one or more dependencies have failed to start or are no longer running. { "up" : [], "down" : [ "mongo" ] } ## Testing Status [/status/{statusvalue}] ### Retrieve status information [GET] Returns whatever status it was sent as a parameter + Parameters + statusvalue (required, integer, `404`) ... The return code you want from the status call + Response 404 ## Login [/login] ### Log in an existing user [POST] + Request + Headers X-Tidepool-UserID: blipuser X-Tidepool-Password: my_1337_password + Response 200 (application/json) + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Body { "userid": "ebe58036a5", "username": "[email protected], "emails" : [ "[email protected]" ] } + Response 401 When the username/password combination fails. ## Machine Login [/serverlogin] ### Log in an existing user [POST] + Request + Headers X-Tidepool-Server-Name: OtherServer X-Tidepool-Server-Secret: serversharedsecret + Response 200 (application/json) + Headers x-tidepool-session-token : 66sadf99.123adf840.aasd90JKj + Body { "userid": "ebe58036a5", "username": "[email protected], "emails" : [ "[email protected]" ] } + Response 401 When the servername/secret combination fails. + Response 400 When the login info is improperly set up or not supported by this installation ### Refresh a session token [GET] This call takes a token, and if the token was still valid, issues a new (different) token; it also returns the userid in the body. This may be a bad idea. + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 (application/json) + Headers x-tidepool-session-token : 1324234234.adfa234.123ad34 + Body { "userid": "123123abcd", } + Response 401 When the token is invalid. + Response 404 When the token is not provided. ## Logout [/logout] ### Log out from an existing session [POST] + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 + Response 401 When the token is invalid or not provided or has expired. ## User records [/user] ### Retrieve current user's info [GET] + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 (application/json) + Body { "userid": "ebe58036a5", "username": "[email protected], "emails" : [ "[email protected]" ] } + Response 401 When the token is invalid or not provided. ### Create a user [POST] + Request (application/json) + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Body { "username": "[email protected]", "emails" : [ "[email protected]" ], "password" : "secret" } + Response 201 (application/json) + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Body { "userid": "ebe58036a5", "username": "[email protected]", "emails" : [ "[email protected]" ] } + Response 400 When the body information is invalid (usually because something is not unique) + Response 401 When the token is invalid or not provided. ## User info for another user [/user/{userid}] ### Retrieve other user's info [GET] + Parameters + userid (required, string, `123123abcd`) ... Tidepool-assigned user ID + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 (application/json) + Body { "userid": userid, "username": "[email protected]", "emails" : [ "[email protected]" ] } + Response 401 When the token is invalid or not provided. + Response 404 When the userid was not found.
FORMAT: 1A HOST: http://tidepool.io # tidepool-user-api The Tidepool User API is used to manage the user login information and pretty much nothing else. Temporarily, it also manages sessions. That will change. The apiary page is [here](http://docs.tidepooluserapi.apiary.io/). # Group User User related resources of the **User API** ## Status [/status] ### Retrieve status information [GET] Returns a status health check with a list of status of its dependencies. If the server is operating properly and all dependencies are up and running, returns 200, otherwise 500. In either case, the body contains a list of up and down dependencies. + Response 200 { "up" : [ "mongo" ], "down" : [] } + Response 500 If the server is *not* operating properly and one or more dependencies have failed to start or are no longer running. { "up" : [], "down" : [ "mongo" ] } ## Testing Status [/status/{statusvalue}] ### Retrieve status information [GET] Returns whatever status it was sent as a parameter + Parameters + statusvalue (required, integer, `404`) ... The return code you want from the status call + Response 404 ## Login [/login] ### Log in an existing user [POST] + Request + Headers X-Tidepool-UserID: blipuser X-Tidepool-Password: my_1337_password + Response 200 (application/json) + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Body { "userid": "ebe58036a5", "username": "[email protected], "emails" : [ "[email protected]" ] } + Response 401 When the username/password combination fails. ### Refresh a session token [GET] This call takes a token, and if the token was still valid, issues a new (different) token; it also returns the userid in the body. This may be a bad idea. + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 (application/json) + Headers x-tidepool-session-token : 1324234234.adfa234.123ad34 + Body { "userid": "123123abcd", } + Response 401 When the token is invalid. + Response 404 When the token is not provided. ## Logout [/logout] ### Log out from an existing session [POST] + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 + Response 401 When the token is invalid or not provided or has expired. ## User records [/user] ### Retrieve current user's info [GET] + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 (application/json) + Body { "userid": "ebe58036a5", "username": "[email protected], "emails" : [ "[email protected]" ] } + Response 401 When the token is invalid or not provided. ### Create a user [POST] + Request (application/json) + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Body { "username": "[email protected]", "emails" : [ "[email protected]" ], "password" : "secret" } + Response 201 (application/json) + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Body { "userid": "ebe58036a5", "username": "[email protected]", "emails" : [ "[email protected]" ] } + Response 400 When the body information is invalid (usually because something is not unique) + Response 401 When the token is invalid or not provided. ## User info for another user [/user/{userid}] ### Retrieve other user's info [GET] + Parameters + userid (required, string, `123123abcd`) ... Tidepool-assigned user ID + Request + Headers x-tidepool-session-token : 23sadf87.123840.aasd90JKj + Response 200 (application/json) + Body { "userid": userid, "username": "[email protected]", "emails" : [ "[email protected]" ] } + Response 401 When the token is invalid or not provided. + Response 404 When the userid was not found. ## Check token validity [/token/{usertoken}] ### Check to see if a token is valid [GET] The session token passed in must be a server-side token. This request is valid only for Tidepool servers. The userid returned is the userid associated with the usertoken. + Parameters + usertoken (required, string, `123123abcd`) ... Tidepool-assigned user token + Request + Headers x-tidepool-session-token : 44sadf87.12x3840.aasd90JKj + Response 200 (application/json) + Body { "userid": userid, } + Response 401 When the session token is invalid or not provided. + Response 404 When the usertoken was not found in the token store.
Add token check, fix some undisplayed text.
Add token check, fix some undisplayed text.
API Blueprint
bsd-2-clause
tidepool-org/user-api,tidepool-org/user-api
92c4cab4bd3aa932e69ef3bfc1efd908eae51ffe
apiary.apib
apiary.apib
FORMAT: 1A # elasticthought REST API wrapper for Caffe # Group User Related resources of the **User API** ## Users Collection [/users] ### Create a User [POST] + Request (application/json) { "username": "foo", "email": "[email protected]", "password": "bar" } + Response 201 # Group Data Related resources of the **Data API** ## Datafiles Collection [/datafiles] ### Create a Datafile [POST] The url passed in the JSON must point to a .tar.gz file. That is currently the only format allowed. + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "url": "http://s3.com/mnist-data.tar.gz" } + Response 201 (application/json) { "id": "datafile-uuid" } ## Datasets Collection [/datasets] ### Create a Dataset [POST] + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "datafile-id": "datafile-uuid", "training": { "split-percentage": 0.7 }, "testing": { "split-percentage": 0.3 } } + Response 201 (application/json) { "_id": "dataset-uuid" "datafile-id": "datafile-uuid", "processing-state": "pending", "training": { "split-percentage": 0.7 }, "testing": { "split-percentage": 0.3 } } # Group Training Related resources of the **Training API** ## Solvers Collection [/solvers] ### Create a Solver [POST] + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "engine": "caffe", "caffe": { "specification-url": "http://s3.com/mnist_solver.prototxt", "specification-net-url": "http://s3.com/mnist_train_test.prototxt", "environment": { "training-source": "dataset-uuid/training", "testing-source": "dataset-uuid/testing" } } } + Response 201 (application/json) { "id": "solver-uuid" } ## Training Jobs Collection [/training-jobs] After a solver is defined, create a training job that will use the solver to train a model. ### Create a Training Job [POST] + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "solver": "solver-uuid" } + Response 201 (application/json) { "id": "training-job-uuid", "status": "/training-jobs/{training-job-uuid}/status", "logs": "/training-jobs/{training-job-uuid}/logs" } ## Training Job Status [/training-jobs/{id}/status] The status of the Training Job + Parameters + id (required, string, `training-job-uuid`) ... The id of the training job. ### Training Job Status [GET] + Request + Headers Authorization: Token 527d11fe429f3426cb8dbeba183a0d80 + Response 200 (application/json) { "id": "training-job-uuid", "state": "running", "loss": 0.0013, "last-iteration": 2000, "max-iterations": 10000, "logs": "/training-jobs/{training-job-uuid}/logs" } ## Training Job Logs [/training-jobs/{id}/logs] The logs of the Training Job. Currently returns entire text file, but in the future it will support websocket streaming. + Parameters + id (required, string, `training-job-uuid`) ... The id of the training job. ### Training Job Logs [GET] + Request + Headers Authorization: Token 527d11fe429f3426cb8dbeba183a0d80 + Response 200 (text/plain) # Group Prediction Related resources of the **Prediction API**
FORMAT: 1A # elasticthought REST API wrapper for Caffe # Group User Related resources of the **User API** ## Users Collection [/users] ### Create a User [POST] + Request (application/json) { "username": "foo", "email": "[email protected]", "password": "bar" } + Response 201 # Group Data Related resources of the **Data API** ## Datafiles Collection [/datafiles] ### Create a Datafile [POST] The url passed in the JSON must point to a .tar.gz file. That is currently the only format allowed. + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "url": "http://s3.com/mnist-data.tar.gz" } + Response 201 (application/json) { "id": "datafile-uuid" } ## Datasets Collection [/datasets] ### Create a Dataset [POST] + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "datafile-id": "datafile-uuid", "training": { "split-percentage": 0.7 }, "testing": { "split-percentage": 0.3 } } + Response 201 (application/json) { "_id": "dataset-uuid" "datafile-id": "datafile-uuid", "processing-state": "pending", "training": { "split-percentage": 0.7 }, "testing": { "split-percentage": 0.3 } } # Group Training Related resources of the **Training API** ## Solvers Collection [/solvers] ### Create a Solver [POST] + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "dataset-id": "<dataset-uuid>", "specification-url": "http://s3.com/mnist_solver.prototxt", "specification-net-url": "http://s3.com/mnist_train_test.prototxt" } + Response 201 (application/json) { "id": "solver-uuid" } ## Training Jobs Collection [/training-jobs] After a solver is defined, create a training job that will use the solver to train a model. ### Create a Training Job [POST] + Request (application/json) + Header Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== + Body { "solver": "solver-uuid" } + Response 201 (application/json) { "id": "training-job-uuid", "processing-state": "pending" } ## Training Job Status [/training-jobs/{id}/status] The status of the Training Job + Parameters + id (required, string, `training-job-uuid`) ... The id of the training job. ### Training Job Status [GET] + Request + Headers Authorization: Token 527d11fe429f3426cb8dbeba183a0d80 + Response 200 (application/json) { "id": "training-job-uuid", "state": "running", "loss": 0.0013, "last-iteration": 2000, "max-iterations": 10000, "logs": "/training-jobs/{training-job-uuid}/logs" } ## Training Job Logs [/training-jobs/{id}/logs] The logs of the Training Job. Currently returns entire text file, but in the future it will support websocket streaming. + Parameters + id (required, string, `training-job-uuid`) ... The id of the training job. ### Training Job Logs [GET] + Request + Headers Authorization: Token 527d11fe429f3426cb8dbeba183a0d80 + Response 200 (text/plain) # Group Prediction Related resources of the **Prediction API**
update API
update API
API Blueprint
apache-2.0
tleyden/elastic-thought,tleyden/elastic-thought,aaam/elastic-thought,aaam/elastic-thought,tleyden/elastic-thought,aaam/elastic-thought
a16baa6bc4d062aa8d10c483619a370f762c0508
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://api.gtdtodoapi.com # GTD TODO API This API source is synced on GitHub – see the <https://github.com/zdne/gistfox-api> repository. This is an example API, originally written as a companion to a [Quickly Prototype APIs with Apiary](http://sendgrid.com/blog/quickly-prototype-apis-apiary/) blog post at SendGrid.com. Extended by [@zdne](https://github.com/zdne) put emphasis on hyperlinks. ## GTD TODO API [/] The API entry point. Root of the API. Main node of the mind map. This entry point resource does not have any attributes, instead it offers root API affordances. ### Affordances + `show` (`self`) ... API entry point + `folders` ... Lists all folders ## Retrieve the API Root [GET] + Response 200 (application/hal+json) { "_links": { "self": { "href": "/" }, "folders": { "href": "/folders"} } } ## Folder [/folders/{id}] A single Folder object. ### Attributes + `id` ... Id of a folder. Automatically assigned + `name` ... Name of the folder + `description` ... Description of the folder + `parent` ... ID of folder that is the parent. Set to 0 if no parent + `meta` ... A catch-all attribute to add custom features ### Affordances + `show` (`self`) ... A single Folder + `edit` ... Update or delete the Folder + Parameters + id (required, int, `0`) ... Unique folder ID in the form of an integer + Model (application/hal+json) { "_links": { "self": { "href": "/folders/1" }, "edit": { "href": "/folders/1" } }, "id": 1, "name": "Health", "description": "This represents projects that are related to health", "parent": 0, "meta": "NULL" } ## Retrieve a single Folder [GET] + Response 200 [Folder][] ### Edit a Folder [PATCH] + Request (application/json) { "description": "A collection of health related projects" } + Response 200 [Folder][] ## Delete a Folder [DELETE] + Response 204 # Folder Collection [/folders] Collections of all folders. ### Attributes + `folder_count` ... Total count of all folders ### Affordances + `show` (`self`) ... List of all Folders + `create` ... Create a new Folder + Model (application/hal+json) { "_links": { "self": { "href": "/folders" }, "create": { "href": "/folders" } }, "folder_count": 2, "_embedded": { "folders" : [ { "_links": { "self": { "href": "/folders/1" } }, "id": 1, "name": "Health", "description": "This represents projects that are related to health" }, { "_links": { "self": { "href": "/folders/2" } }, "id": 2, "name": "Diet", "description": "A collection of projects related to Diet" } ] } } ## List all Folders [GET] + Response 200 [Folder Collection][] ## Create a Folder [POST] + Request (application/json) Represents a folder to be created. At minimum it must contain the `name` and `description` attributes. Optionally it may contain `parent` and `meta` attributes of the Folder being created. + Body { "name": "Diet", "description": "A collection of projects related to Diet", "parent": 1 } + Response 201 [Folder][]
FORMAT: 1A HOST: http://api.gtdtodoapi.com # GTD TODO API https://github.com/zdne/todoapi This API source is synced on GitHub – see the <https://github.com/zdne/todoapi> repository. This is an example API, originally written as a companion to a [Quickly Prototype APIs with Apiary](http://sendgrid.com/blog/quickly-prototype-apis-apiary/) blog post at SendGrid.com. Extended by [@zdne](https://github.com/zdne) put emphasis on hyperlinks. ## GTD TODO API [/] The API entry point. Root of the API. Main node of the mind map. This entry point resource does not have any attributes, instead it offers root API affordances. ### Affordances + `show` (`self`) ... API entry point + `folders` ... Lists all folders ## Retrieve the API Root [GET] + Response 200 (application/hal+json) { "_links": { "self": { "href": "/" }, "folders": { "href": "/folders"} } } ## Folder [/folders/{id}] A single Folder object. ### Attributes + `id` ... Id of a folder. Automatically assigned + `name` ... Name of the folder + `description` ... Description of the folder + `parent` ... ID of folder that is the parent. Set to 0 if no parent + `meta` ... A catch-all attribute to add custom features ### Affordances + `show` (`self`) ... A single Folder + `edit` ... Update or delete the Folder + Parameters + id (required, int, `0`) ... Unique folder ID in the form of an integer + Model (application/hal+json) { "_links": { "self": { "href": "/folders/1" }, "edit": { "href": "/folders/1" } }, "id": 1, "name": "Health", "description": "This represents projects that are related to health", "parent": 0, "meta": "NULL" } ## Retrieve a single Folder [GET] + Response 200 [Folder][] ### Edit a Folder [PATCH] + Request (application/json) { "description": "A collection of health related projects" } + Response 200 [Folder][] ## Delete a Folder [DELETE] + Response 204 # Folder Collection [/folders] Collections of all folders. ### Attributes + `folder_count` ... Total count of all folders ### Affordances + `show` (`self`) ... List of all Folders + `create` ... Create a new Folder + Model (application/hal+json) { "_links": { "self": { "href": "/folders" }, "create": { "href": "/folders" } }, "folder_count": 2, "_embedded": { "folders" : [ { "_links": { "self": { "href": "/folders/1" } }, "id": 1, "name": "Health", "description": "This represents projects that are related to health" }, { "_links": { "self": { "href": "/folders/2" } }, "id": 2, "name": "Diet", "description": "A collection of projects related to Diet" } ] } } ## List all Folders [GET] + Response 200 [Folder Collection][] ## Create a Folder [POST] + Request (application/json) Represents a folder to be created. At minimum it must contain the `name` and `description` attributes. Optionally it may contain `parent` and `meta` attributes of the Folder being created. + Body { "name": "Diet", "description": "A collection of projects related to Diet", "parent": 1 } + Response 201 [Folder][]
Fix GH Link
Fix GH Link
API Blueprint
mit
zdne/todoapi
4e96f08c2ee531ebd3494fb5f40f95eef27d6fce
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://gbptm-stage.herokuapp.com/api # Great British Public Toilet Map The GBPTM API is a service for collection, submission and discovery of Public Toilets in the UK # Group Loos Loos related resources of the **GBPTM API** ## Loos Collection [/loos] ### List all Loos [GET] + Response 200 (application/json) [{ "id": 1, "name": "Loo 1" }, { "id": 2, "name": "Loo 2" }]
FORMAT: 1A HOST: http://gbptm-api-stage.herokuapp.com/api # Great British Public Toilet Map The GBPTM API is a service for collection, submission and discovery of Public Toilets in the UK # Group Loos Loos related resources of the **GBPTM API** ## Loos Collection [/loos] ### List all Loos [GET] + Response 200 (application/json) [{ "id": 1, "name": "Loo 1" }, { "id": 2, "name": "Loo 2" }]
Tweak docs
Tweak docs
API Blueprint
mit
jimhbanks/gbptm,neontribe/gbptm,neontribe/gbptm,neontribe/gbptm
0f52311eac46e6d1c0a53f8cec88ec5b2bbcfbff
blueprint/index.apib
blueprint/index.apib
FORMAT: 1A HOST: https://thegrid.io/ # The Grid API Want to straight to the details? * [Authentication](authentication.html) * [Content Management](api.html) * [User Management](passport.html) # Purpose [The Grid](https://thegrid.io/) is a next-generation web publishing platform. The service provides a complete user experience for making, editing content across multiple devices, but also has a complete API available. This document describes that API and how it can be used by developers, including third-party. Functionality provided includes * Web page auto-design, layout and publishing * Content import and analysis * Image processing * Handling payments (TDB) What The Grid is not. Not a web-hosting platform to run arbitrary PHP/Python/Ruby or databases on. # Access API access is available to all users on The Grid. If you wish to develop with The Grid, [become a founding member now](https://thegrid.io/). *Note: we are currently still [launching](http://launchstatus.thegrid.io)* When your plan has been activated, you may log in and register new apps on your [accounts page](https://passport.thegrid.io/) # Example uses ## Mobile apps Either single-purpose apps, or full-featured The Grid apps for platforms which are not officially supported like Windows Phone, Firefox OS, Jolla etc ## Social media integration Like a Twitter or Facebook app which syncs content to your The Grid site. ## Content migration For importing all of the content from your current website, like Wordpress, Squarespace, Medium or Tumblr ## Embedded/autonomous devices Devices that automatically publish their state or results, for instance a timelapse camera or 3d-printer. ## Desktop & web app integration For instance "Share to The Grid" functionality ## Custom content editing user interfaces Using specialized user interactions, making use of new technology or increased accessibility # Known consumers Existing examples of apps and libraries using this API. * [Flowhub](https://flowhub.io) and [noflo-ui](https://github.com/noflo/noflo-ui) * The Grid Android app * The Grid iOS app * The Grid Chrome extension * [thegrid.io](https://thegrid.io) website, including purchasing process Libraries * [passport-thegrid](https://www.npmjs.com/package/passport-thegrid): Authentication strategy for [Passport.js](http://passportjs.org/) # Issues or Questions? This API documentation is [on GitHub](https://github.com/the-grid/apidocs). Got any questions or found issues in the documentation? [File issues](https://github.com/the-grid/apidocs/issues) or create a [pull request](https://github.com/the-grid/apidocs/pulls).
FORMAT: 1A HOST: https://thegrid.io/ # The Grid API Want to straight to the details? * [Authentication](authentication.html) * [Content Management](api.html) * [User Management](passport.html) * [Design Systems](designsystems.html) # Purpose [The Grid](https://thegrid.io/) is a next-generation web publishing platform. The service provides a complete user experience for making, editing content across multiple devices, but also has a complete API available. This document describes that API and how it can be used by developers, including third-party. Functionality provided includes * Web page auto-design, layout and publishing * Content import and analysis * Image processing * Handling payments (TDB) What The Grid is not. Not a web-hosting platform to run arbitrary PHP/Python/Ruby or databases on. # Access API access is available to all users on The Grid. If you wish to develop with The Grid, [become a founding member now](https://thegrid.io/). *Note: we are currently still [launching](http://launchstatus.thegrid.io)* When your plan has been activated, you may log in and register new apps on your [accounts page](https://passport.thegrid.io/) # Example uses ## Mobile apps Either single-purpose apps, or full-featured The Grid apps for platforms which are not officially supported like Windows Phone, Firefox OS, Jolla etc ## Social media integration Like a Twitter or Facebook app which syncs content to your The Grid site. ## Content migration For importing all of the content from your current website, like Wordpress, Squarespace, Medium or Tumblr ## Embedded/autonomous devices Devices that automatically publish their state or results, for instance a timelapse camera or 3d-printer. ## Desktop & web app integration For instance "Share to The Grid" functionality ## Custom content editing user interfaces Using specialized user interactions, making use of new technology or increased accessibility # Known consumers Existing examples of apps and libraries using this API. * [Flowhub](https://flowhub.io) and [noflo-ui](https://github.com/noflo/noflo-ui) * The Grid Android app * The Grid iOS app * The Grid Chrome extension * [thegrid.io](https://thegrid.io) website, including purchasing process Libraries * [passport-thegrid](https://www.npmjs.com/package/passport-thegrid): Authentication strategy for [Passport.js](http://passportjs.org/) # Issues or Questions? This API documentation is [on GitHub](https://github.com/the-grid/apidocs). Got any questions or found issues in the documentation? [File issues](https://github.com/the-grid/apidocs/issues) or create a [pull request](https://github.com/the-grid/apidocs/pulls).
Add link to design systems page
index: Add link to design systems page
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
493a9ab84a6ced138fef29894204a30989809106
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://gisela.apiblueprint.org/ # Gisela API Gisela is a simple API allowing consumers to track and tag timelogs. ## Tags Collection [/tags] Timelogs can be tagged to identify the time for later evaluation. ### List All Tags [GET] + Response 200 (application/json) [ { "success": true, "data": { "id": id, "name": "Foo", "description": "Foo description" } } ] ### Create a New Tag [POST] You may create your tags using this action. It takes a JSON object containing the name and a short description of the tag. + Request (application/json) { "name": "Foo", "description": "Foo description" } + Response 201 (application/json) + Headers Location: /questions/2 + Body { "success": true, "data": { "id": id, "name": "Foo", "description": "Foo description" } } ## Tag [/tag/{tag_id}] + Parameters + tag_id (number) - ID of the Tag in the form of an integer ### Read a tag detail [GET] + Response 200 (application/json) [ { "success": true, "data": { "id": id, "name": "Foo", "description": "Foo description" } } ] ### Update a tag detail [PUT] You may update the details of a tag using this action. It takes a JSON object containing the name and a short description of the tag. + Request (application/json) { "name": "Foo", "description": "Foo description" } + Response 200 (application/json) { "success": true, "data": { "id": id, "name": "Foo", "description": "Foo description" } } ### Delete a tag [DELETE] You can delete a tag using this action. + Response 200 (application/json) { "success": true, "data": null } ## Timelogs Collection [/times] A timelog description a period of time defined by its duration. ### List All Timelogs [GET] + Response 200 (application/json) [ { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 1, "tags": [] } } ] ### Create a New Timelog [POST] You may create your tags using this action. It takes a JSON object containing the name and a short description of the tag. + Request (application/json) { "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "tags": [1, 2] } + Response 201 (application/json) + Headers Location: /times/1 + Body { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 0, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } } ## Timelog [/tag/{timelog_id}] + Parameters + timelog_id (number) - ID of the Timelog in the form of an integer ### Read a timelog detail [GET] + Response 200 (application/json) { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } } ### Update a tag detail [PUT] You may update the details of a timelog using this action. It takes a JSON object containing the following data. + Request (application/json) { "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "tags": [1, 2] } + Response 200 (application/json) { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 1, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } } ### Delete a timelog [DELETE] You can delete a timelog using this action. + Response 204 ### Start a timelog [PUT /times/{timelog_id}/start] + Response 200 (application/json) { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 1, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } } ### Pause a timelog [PUT /times/{timelog_id}/start] + Response 200 (application/json) { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 2, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } } ### Stop a timelog [PUT /times/{timelog_id}/stop] + Response 200 (application/json) { "success": true, "data": { "id": id, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 0, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } }
FORMAT: 1A HOST: http://gisela.apiblueprint.org/ # Gisela API Gisela is a simple API allowing consumers to track and tag timelogs. ## Tags Collection [/tags] Timelogs can be tagged to identify the time for later evaluation. ### List All Tags [GET] + Response 200 (application/json) [ { "id": 1, "name": "Foo", "description": "Foo description" } ] ### Create a New Tag [POST] You may create your tags using this action. It takes a JSON object containing the name and a short description of the tag. + Request (application/json) { "name": "Foo", "description": "Foo description" } + Response 201 (application/json) + Headers Location: /questions/2 + Body { "id": 1, "name": "Foo", "description": "Foo description" } ## Tag [/tag/{tag_id}] + Parameters + tag_id (number) - ID of the Tag in the form of an integer ### Read a tag detail [GET] + Response 200 (application/json) [ { "id": 1, "name": "Foo", "description": "Foo description" } ] ### Update a tag detail [PUT] You may update the details of a tag using this action. It takes a JSON object containing the name and a short description of the tag. + Request (application/json) { "name": "Foo", "description": "Foo description" } + Response 200 (application/json) { "id": 1, "name": "Foo", "description": "Foo description" } ### Delete a tag [DELETE] You can delete a tag using this action. + Response 200 (application/json) { "success": true, "data": null } ## Timelogs Collection [/times] A timelog description a period of time defined by its duration. ### List All Timelogs [GET] + Response 200 (application/json) [ { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 1, "tags": [] } ] ### Create a New Timelog [POST] You may create your tags using this action. It takes a JSON object containing the name and a short description of the tag. + Request (application/json) { "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "tags": [1, 2] } + Response 201 (application/json) + Headers Location: /times/1 + Body { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 0, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } ## Timelog [/tag/{timelog_id}] + Parameters + timelog_id (number) - ID of the Timelog in the form of an integer ### Read a timelog detail [GET] + Response 200 (application/json) { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } ### Update a tag detail [PUT] You may update the details of a timelog using this action. It takes a JSON object containing the following data. + Request (application/json) { "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "tags": [1, 2] } + Response 200 (application/json) { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 1, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } ### Delete a timelog [DELETE] You can delete a timelog using this action. + Response 204 ### Start a timelog [PUT /times/{timelog_id}/start] + Response 200 (application/json) { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 1, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } ### Pause a timelog [PUT /times/{timelog_id}/start] + Response 200 (application/json) { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 2, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] } ### Stop a timelog [PUT /times/{timelog_id}/stop] + Response 200 (application/json) { "id": 1, "name": "Bar", "start_data": "2015-11-18 20:53:00", "duration": 50, "description": "Bar description", "state": 0, "tags": [ { "id": 1, "name": "Foo", "description": "Foo description" }, { "id": 2, "name": "Baz", "description": "Baz description" } ] }
Remove evelope according to http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#envelope
Remove evelope according to http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#envelope
API Blueprint
mit
toirl/gisela,toirl/gisela,toirl/gisela
f7421585c4067bba63d8121e481b36d38d350afc
apiary.apib
apiary.apib
FORMAT: 1A # Helpful API Helpful API is a service to interact with helpful.io It provides API access to all the resources in the app. ## Authentication API authentication is done using OAuth2. Helpful acts as an OAuth2 provider. In order to develop an API client against Helpful, your app will need to be registered. More details here: * https://github.com/applicake/doorkeeper/wiki/Authorization-Code-Flow * http://tools.ietf.org/html/rfc6749#section-4.1 Roughly, as a Helpful user, you can: * Create your own "applications" (OAuth clients) that can then participate in the OAuth flow. Use the "/oauth/applications" URL. * Authorize other applications (or your own) to "act" on your behalf (make API calls to resources you control). Use the "/oauth/authorized_applications" URL. Here's how to do it in development: 1. Log in as normal 2. Visit http://localhost:3000/oauth/applications 3. Create a new application (use `urn:ietf:wg:oauth:2.0:oob` as the callback URL) 4. Copy the application_id and secret key When your app/client code wants to access Helpful as a user, it must request an auth_code. That is done by having the user you want to act on behalf of visit the authorize_url: ```ruby callback = "urn:ietf:wg:oauth:2.0:oob" app_id = "f9682933bb81c9a76cc4dc6d7b2f4ba7a1db006cc986fa5e8e28d05fafde6dd9" secret = "23c7ebff714494e3871cf0ab163bb4e9b87bd4ad201521a3ce9e2e1ca984feda" client = OAuth2::Client.new(app_id, secret, site: "http://localhost:3000/") client.auth_code.authorize_url(redirect_uri: callback) # => "http://localhost:3000/oauth/authorize?response_type=code&client_id=f9682933bb81c9a76cc4dc6d7b2f4ba7a1db006cc986fa5e8e28d05fafde6dd9&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob" ``` 5. This URL will prompt the browser user if they want to allow the app and will return to you an auth_code (via callback or in the browser window). 6. Your app should remember this auth_code! 7. Then "trade-in" the auth_code for an access_token (Access tokens are short lived (2 hours). Whenever it expires, you'll have to get a new one. ``` auth_code = "b789332903d1a6e3ec07f1831c8c4e3d20031f576e19ff2ae24dcbb26285b205" access = client.auth_code.get_token auth_code, redirect_uri: callback token = access.token # => "fd7958b3d3d17ba9130718096b3a4cd4a4d8088cb29d41e4d74513fc9aeff5a8" access.get '/api/messages' # => #<OAuth2::Response:0x000000027c2778 .... (Normal HTTP Response stuff from the API call here) ``` # Helpful API Root [/api] NOT IMPLEMENTED - BUT LEFT FOR FUTURE REFERENCE Helpful API entry point. This resource does not have any attributes. Instead it offers the initial API affordances in the form of the HTTP Link header and HAL links. ## Retrieve Entry Point [GET] + Response 200 (application/json) + Headers Link: <https://helpful.io/api/>;rel="self",<https://helpful.io/api/messages>;rel="conversations" + Body { "_links": { "self": { "href": "/" }, "messages": { "href": "/messages?{since}", "templated": true } } } # Group Messages Messages related resources of *Helpful API*. ## Message [/message/{id}] A single Message object. The Message resource represents a single message that is part of a conversation. The Message resource has the following attributes: - id - conversation_id - person_id - content - data - created - updated The states *id* and *created_at* are assigned by the Helpful API at the moment of creation. + Parameters + id (UUID) ... ID of the Message + Model (application/hal+json) JSON representation of Message Resource. In addition to representing its state in the JSON form it offers affordances in the form of the HTTP Link header and HAL links. + Body { "id":"d06a5c13-0981-435d-9510-67e05277191b", "conversation_id":"b9df99ba-ce31-4cc1-827d-a8c900a879ee", "person_id":"81b303ca-258e-453c-bc84-5eafba8cef87", "content":"Voluptatem ab. Ipsum quo.", "data":null, "created_at":"2013-12-08T13:08:14.758Z", "updated_at":"2013-12-08T13:08:14.758Z" } ### Retrieve a Single Message [GET] + Response 200 [Message][] ## Messages Collection [/messages{?since}] Collection of all Messages. The Message Collection resource has the following attribute: - total In addition it **embeds** *Message Resources* in the Helpful API. + Model (application/json) JSON representation of Message Collection Resource. The Message resources in collections are embedded. Note the embedded Messages resource are incomplete representations of the Message in question. Use the respective Message link to retrieve its full representation. + Headers Link: <https://helpful.io/api/messages>;rel="self" + Body { "messages": [ { "id":"d06a5c13-0981-435d-9510-67e05277191b", "conversation_id":"b9df99ba-ce31-4cc1-827d-a8c900a879ee", "person_id":"81b303ca-258e-453c-bc84-5eafba8cef87", "content":"Voluptatem ab. Ipsum quo.", "data":null, "created_at":"2013-12-08T13:08:14.758Z", "updated_at":"2013-12-08T13:08:14.758Z" } ] } ### List All Messages [GET] + Parameters + since (optional, string) ... Timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ` Only Messages updated at or after this time are returned. + Response 200 [Messages Collection][] ### Create a Message [POST] TODO
FORMAT: 1A HOST: https://helpful.io # Helpful API Helpful API is a service to interact with helpful.io It provides API access to all the resources in the app. ## Authentication API authentication is done using OAuth2. Helpful acts as an OAuth2 provider. In order to develop an API client against Helpful, your app will need to be registered. More details here: * https://github.com/applicake/doorkeeper/wiki/Authorization-Code-Flow * http://tools.ietf.org/html/rfc6749#section-4.1 Roughly, as a Helpful user, you can: * Create your own "applications" (OAuth clients) that can then participate in the OAuth flow. Use the "/oauth/applications" URL. * Authorize other applications (or your own) to "act" on your behalf (make API calls to resources you control). Use the "/oauth/authorized_applications" URL. Here's how to do it in development: 1. Log in as normal 2. Visit http://localhost:3000/oauth/applications 3. Create a new application (use `urn:ietf:wg:oauth:2.0:oob` as the callback URL) 4. Copy the application_id and secret key When your app/client code wants to access Helpful as a user, it must request an auth_code. That is done by having the user you want to act on behalf of visit the authorize_url: ```ruby callback = "urn:ietf:wg:oauth:2.0:oob" app_id = "f9682933bb81c9a76cc4dc6d7b2f4ba7a1db006cc986fa5e8e28d05fafde6dd9" secret = "23c7ebff714494e3871cf0ab163bb4e9b87bd4ad201521a3ce9e2e1ca984feda" client = OAuth2::Client.new(app_id, secret, site: "http://localhost:3000/") client.auth_code.authorize_url(redirect_uri: callback) # => "http://localhost:3000/oauth/authorize?response_type=code&client_id=f9682933bb81c9a76cc4dc6d7b2f4ba7a1db006cc986fa5e8e28d05fafde6dd9&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob" ``` 5. This URL will prompt the browser user if they want to allow the app and will return to you an auth_code (via callback or in the browser window). 6. Your app should remember this auth_code! 7. Then "trade-in" the auth_code for an access_token (Access tokens are short lived (2 hours). Whenever it expires, you'll have to get a new one. ``` auth_code = "b789332903d1a6e3ec07f1831c8c4e3d20031f576e19ff2ae24dcbb26285b205" access = client.auth_code.get_token auth_code, redirect_uri: callback token = access.token # => "fd7958b3d3d17ba9130718096b3a4cd4a4d8088cb29d41e4d74513fc9aeff5a8" access.get '/api/messages' # => #<OAuth2::Response:0x000000027c2778 .... (Normal HTTP Response stuff from the API call here) ``` # Helpful API Root [/api] NOT IMPLEMENTED - BUT LEFT FOR FUTURE REFERENCE Helpful API entry point. This resource does not have any attributes. Instead it offers the initial API affordances in the form of the HTTP Link header and HAL links. ## Retrieve Entry Point [GET] + Response 200 (application/json) + Headers Link: <https://helpful.io/api/>;rel="self",<https://helpful.io/api/messages>;rel="conversations" + Body { "_links": { "self": { "href": "/" }, "messages": { "href": "/messages?{since}", "templated": true } } } # Messages Messages are a fundamental model in Helpful. ## Message [/message/{id}] A single Message object. The Message resource represents a single message that is part of a conversation. The Message resource has the following attributes: - id - conversation_id - person_id - content - data - created - updated The states *id* and *created_at* are assigned by the Helpful API at the moment of creation. + Parameters + id (UUID) ... ID of the Message + Model (application/hal+json) JSON representation of Message Resource. In addition to representing its state in the JSON form it offers affordances in the form of the HTTP Link header and HAL links. + Body { "id":"d06a5c13-0981-435d-9510-67e05277191b", "conversation_id":"b9df99ba-ce31-4cc1-827d-a8c900a879ee", "person_id":"81b303ca-258e-453c-bc84-5eafba8cef87", "content":"Voluptatem ab. Ipsum quo.", "data":null, "created_at":"2013-12-08T13:08:14.758Z", "updated_at":"2013-12-08T13:08:14.758Z" } ### Retrieve a Single Message [GET] + Response 200 [Message][] ## Messages Collection [/messages{?since}] Collection of all Messages. The Message Collection resource has the following attribute: - total In addition it **embeds** *Message Resources* in the Helpful API. + Model (application/json) JSON representation of Message Collection Resource. The Message resources in collections are embedded. Note the embedded Messages resource are incomplete representations of the Message in question. Use the respective Message link to retrieve its full representation. + Headers Link: <https://helpful.io/api/messages>;rel="self" + Body { "messages": [ { "id":"d06a5c13-0981-435d-9510-67e05277191b", "conversation_id":"b9df99ba-ce31-4cc1-827d-a8c900a879ee", "person_id":"81b303ca-258e-453c-bc84-5eafba8cef87", "content":"Voluptatem ab. Ipsum quo.", "data":null, "created_at":"2013-12-08T13:08:14.758Z", "updated_at":"2013-12-08T13:08:14.758Z" } ] } ### List All Messages [GET] + Parameters + since (optional, string) ... Timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ` Only Messages updated at or after this time are returned. + Response 200 [Messages Collection][] ### Create a Message [POST] TODO # Group Message ## Message [/messages/{id}] A single Message object. The Message resource is a central resource in the Helpful API. It represents one message between People (either support agents or customers). The Gist resource has the following attributes: - id - content - person - conversation - data - created - updated The states `id` and `created` are assigned by the Helpful API at when the Message is created. The `updated` state is assigned by the Helpful API when a Message is created and when it's updated. ### Create a Message [POST] ## Conversation [/conversations/{id}] - id - number - account - created - updated ## Person [/people/{id}] - id - name - email - twitter - user - account - created - updated ## Read Receipt [/messages/{message_id}/read-receipts/{id}] - id - person - message - created ## User [/users/{id}] - id - email - confirmed - locked - created - updated ## Account [/accounts/{id}] - id - name - slug - billing_plan - billing_status - created - updated ## Membership [/memberships/{id}] - id - role - user - account - created - updated ## Billing Plan [/billing-plans/{id}] - id - name - slug - max_conversations - price - created - updated
Document objects and attributes for the API.
Document objects and attributes for the API. This is just a start.
API Blueprint
agpl-3.0
nikhilmat/helpful-web,asm-helpful/helpful-web,asm-helpful/helpful-web,nikhilmat/helpful-web,asm-helpful/helpful-web,asm-helpful/helpful-web,nikhilmat/helpful-web
4a09673cc7f07393f990fafeb5da7a65ddf8f2d1
apiary.apib
apiary.apib
HOST: http://dcp.jboss.org/v1 --- Distributed Contribution Platform API v1 --- --- # Overview **Distributed Contribution Platform** provides **Rest API** for data manipulation and search. # DCP Content object This is main content object which can be pushed/retrieved or searched. DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure. However this document is during push to DCP and reindex normalized and internal DCP data are added. Those data are prefixed by dcp_. DCP Content described by example: { Free JSON Structure repsesenting content. Can be one key value pair or something more structured. It's defined only by source provider. "tags": ["Content tag1", "tag2", "tag2"], "dcp_content_id": "Any value from content provider", "dcp_content_typev: "Source provider type like 'issue'" "dcp_content_provider": "Name of content provider like JIRA River" "dcp_id": "internal_id" "dcp_title": "Content Title" "dcp_url_view": "URL representing content view" "dcp_description": "Short description used by search GUI" "dcp_type": "Normalized internal type of content" "dcp_updated": "Timestamp of last update" "dcp_project": "Normalized internal project" "dcp_contributors": ["Firstname Lastname <e-mail>", "Firstname Lastname <e-mail>"] "dcp_activity_dates": [Timestamp1, Timestamp2] "dcp_tags": ["Tags constructed from 'tags' tag and user tags from persistance storage"] } All DCP Internal data are set during push and reindex except these which can be defined during data push: * `dcp_title` * `dcp_url_view` * `dcp_description` --- -- Authentication Distinct operations needs to be authenticated. Content provider provides credintials by URL parameters provider and password or via standard HTTP Basic authentication. If authentication is not successfull then standard forbidden http code is returned. -- -- Content -- Return Document JSON data GET /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } All content for specified type. GET /rest/content/{type} < 200 < Content-Type: application/json { "total": "count of returned values", "hits": [ { "id": "internal dcp id of document" "data": "document content" } ] } JSON document in http body which is pushed to DCP. Http body empty POST /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } Document deleted DELETE /rest/content/{type}/{id} < 200 -- Search -- Search contributions. GET /rest/search?TODO < 200 -- Search Suggestions -- Get suggestions for user query. GET /rest/suggestions/query_string?q={user_query_string} < 200 { "view": { "search": { "caption": "Search", "options": ["${query_string}"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ {}, {}, {} ] } } Example for user query 'Hiberna'. GET /rest/suggestions/query_string?q=Hiberna < 200 { "view": { "search": { "caption": "Search", "options": ["Hiberna"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "Hiberna" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ {}, {}, {} ] } }
HOST: http://dcp.jboss.org/v1 --- Distributed Contribution Platform API v1 --- --- # Overview **Distributed Contribution Platform** provides **Rest API** for data manipulation and search. # DCP Content object This is main content object which can be pushed/retrieved or searched. DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure. However this document is during push to DCP and reindex normalized and internal DCP data are added. Those data are prefixed by dcp_. DCP Content described by example: { Free JSON Structure repsesenting content. Can be one key value pair or something more structured. It's defined only by source provider. "tags": ["Content tag1", "tag2", "tag2"], "dcp_content_id": "Any value from content provider", "dcp_content_typev: "Source provider type like 'issue'" "dcp_content_provider": "Name of content provider like JIRA River" "dcp_id": "internal_id" "dcp_title": "Content Title" "dcp_url_view": "URL representing content view" "dcp_description": "Short description used by search GUI" "dcp_type": "Normalized internal type of content" "dcp_updated": "Timestamp of last update" "dcp_project": "Normalized internal project" "dcp_contributors": ["Firstname Lastname <e-mail>", "Firstname Lastname <e-mail>"] "dcp_activity_dates": [Timestamp1, Timestamp2] "dcp_tags": ["Tags constructed from 'tags' tag and user tags from persistance storage"] } All DCP Internal data are set during push and reindex except these which can be defined during data push: * `dcp_title` * `dcp_url_view` * `dcp_description` --- -- Authentication Distinct operations needs to be authenticated. Content provider provides credintials by URL parameters provider and password or via standard HTTP Basic authentication. If authentication is not successfull then standard forbidden http code is returned. -- -- Content -- Return Document JSON data GET /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } All content for specified type. GET /rest/content/{type} < 200 < Content-Type: application/json { "total": "count of returned values", "hits": [ { "id": "internal dcp id of document" "data": "document content" } ] } JSON document in http body which is pushed to DCP. Http body empty POST /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } Document deleted DELETE /rest/content/{type}/{id} < 200 -- Search -- Search contributions. GET /rest/search?TODO < 200 { "foo": "bar" } -- Search Suggestions -- Get suggestions for user query. GET /rest/suggestions/query_string?q={user_query_string} < 200 { "view": { "search": { "caption": "Search", "options": ["${query_string}"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ {}, {}, {} ] } } Example for user query 'Hiberna'. GET /rest/suggestions/query_string?q=Hiberna < 200 { "view": { "search": { "caption": "Search", "options": ["Hiberna"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "Hiberna" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ {}, {}, {} ] } }
fix format
fix format
API Blueprint
apache-2.0
ollyjshaw/searchisko,searchisko/searchisko,searchisko/searchisko,searchisko/searchisko,ollyjshaw/searchisko,ollyjshaw/searchisko
4491ce967d463beb6878fc65969656ef97e8268e
STATION-METADATA-API-BLUEPRINT.apib
STATION-METADATA-API-BLUEPRINT.apib
FORMAT: 1A Station Metadata API ============================= # General information This Service exists to provide the canonical API for querying and returning MeteoGroup stations and their capabilities. The output response with requested stations is always in GEOJson format. The API supports various combinations for querying stations meta data by area/region (bounding box, polygon, multi-polygon), by provider or type, by stations where MeteoGroup produces forecast or has observation data available. ## Authentication To access active-warning-service the request has to be authorised with a valid JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server `https://auth.weather.mg/oauth/token` with according client credentials. The required scope is `station-metadata`. The documentation about how to authenticate against MeteoGroup Weather API with OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md) ### Querying MeteoGroup stations data Here is the information about all supported HTTP request parameters and HTTP Headers: + Headers + Authorization: Bearer {ENCRYPTED TOKEN HERE} + If-Modified-Since: {DATE} + Parameters + locatedWithin: - {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box - {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]} - polygon coordinates; same as in [GeoJSON Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) - {"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]} - a multi-polygon, as in [GeoJSON MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) + accessVisibility: `public` (string, optional) - station access visibility, valid values is `public` and `private` + provider: `WMO,MG` (string, optional) - currently filter by provider or providers. All possible providers are described in section: **Get all providers** + type: `SKI_RESORT` (string, optional) - currently filter by type. All possible types are described in section: **Get all station types** + hasForecastData: `false` (boolean, optional) - station has forecast data. + hasObservationData: `true` (boolean, optional) - station has observation data. + countryIsoCode: `GB` (string, optional) - station located in this country. ISO Code refers to the [ISO 3166 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166) + meteoGroupStationId: `1004,1005` (string, optional) - filter stations by MeteoGroup station id/(comma separated ids). + fields: accessVisibility,icaoCode,countryIsoCode,provider,type,hasForecastData,wmoCountryId,hasObservationData,countryIsoCode, meteoGroupStationId,name,stationTimeZoneName - metadata fields in response, geometry is present in every success response. If fields is absent all fields are returned. Here are a couple of examples how to query by provider and type, bounding box and polygon. #### Querying by provider or type Query example: ``` GET /stations?accessVisibility=public&provider=WMO&hasForecastData=true&hasObservationData=false&countryIsoCode=UA&meteoGroupStationId=1004,1005 ``` + Response 200 (application/json) + Headers Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + Body ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "ENAS", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1004, "name": "Ny-Alesund II", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 11.9222, 78.9233, 16 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1005, "name": "Isfjord Radio", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 13.6333, 78.0667, 5 ] } } ] } ``` ```` POST /stations ```` { "locatedWithin": {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]}, "accessVisibility": "public", "provider": "WMO", "type": "WMO", "hasForecastData": "true", "hasObservationData": "true", "countryIsoCode": "TG" } + Response 200 (application/json) { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "DXTA", "countryIsoCode": "TG", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 221, "meteoGroupStationId": 65380, "name": "Tabligbo", "hasObservationData": true, "stationTimeZoneName": "Africa/Lome", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 1.5, 6.58333, 44 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "DXXX", "countryIsoCode": "TG", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 221, "meteoGroupStationId": 65387, "name": "Lome", "hasObservationData": true, "stationTimeZoneName": "Africa/Lome", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 1.25, 6.16667, 25 ] } } ] } ### Queries by area or region (bounding box, polygone or multipolygone) When querying stations within a region queries have to formated, like geometries in [GeoJSON](https://tools.ietf.org/html/rfc7946). See the following examples. #### Querying by bounding box Query example for getting stations by bounding box: ```locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22bbox%22%2C%22coordinates%22%3A%5B%5B-10%2C80%5D%2C%5B10%2C5%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ The response body is the same as for querying stations by provider and type. #### Querying by polygon Example GeoJSON polygon: ```{"type":"polygon","coordinates":[[[-0.16,51.70],[-0.43,51.29],[0.18,51.30],[-0.16,51.70]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22polygon%22%2C%22coordinates%22%3A%5B%5B%5B-0.16%2C51.70%5D%2C%5B-0.43%2C51.29%5D%2C%5B0.18%2C51.30%5D%2C%5B-0.16%2C51.70%5D%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Querying by multi-polygon Example GeoJSON multi-polygon: ```{"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22multipolygon%22%2C%22coordinates%22%3A%5B%5B%5B%5B102.0%2C2.0%5D%2C%5B103.0%2C2.0%5D%2C%5B103.0%2C3.0%5D%2C%5B102.0%2C3.0%5D%2C%5B102.0%2C2.0%5D%5D%5D%2C%5B%5B%5B100.0%2C0.0%5D%2C%5B101.0%2C0.0%5D%2C%5B101.0%2C1.0%5D%2C%5B100.0%2C1.0%5D%2C%5B100.0%2C0.0%5D%5D%2C%5B%5B100.2%2C0.2%5D%2C%5B100.8%2C0.2%5D%2C%5B100.8%2C0.8%5D%2C%5B100.2%2C0.8%5D%2C%5B100.2%2C0.2%5D%5D%5D%5D%7D ``` **NOTE**: The `locatedWithin` parameter has to be encoded before putting it to the request. There are free online URL encoder available, for rapid manual testing: e.g. http://www.url-encode-decode.com/ If the query value is not proper encoded, you will receive an empty response with status code ```400 Bad Request```. #### Get all station types Query example: ``` GET /stations/types ``` Returns a list containing all current known station types. This list can be extended in the future. + Response 200 (application/json) ``` { "types": [ "AIRQUALITY", "AVIATION", "MARINE", "MG_NETWORK", "NMI_SECONDARY", "OTHER_OBS_HQ", "OTHER_OBS_LQ", "RAIL", "ROAD", "SKI_RESORT", "SPECIAL_OBS", "VIRTUAL", "WMO" ], "_links": { "AIRQUALITY": { "href": "http://station-metadata.weather.mg/stations?type=AIRQUALITY" }, "AVIATION": { "href": "http://station-metadata.weather.mg/stations?type=AVIATION" }, "MARINE": { "href": "http://station-metadata.weather.mg/stations?type=MARINE" }, "MG_NETWORK": { "href": "http://station-metadata.weather.mg/stations?type=MG_NETWORK" }, "NMI_SECONDARY": { "href": "http://station-metadata.weather.mg/stations?type=NMI_SECONDARY" }, "OTHER_OBS_HQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_HQ" }, "OTHER_OBS_LQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_LQ" }, "RAIL": { "href": "http://station-metadata.weather.mg/stations?type=RAIL" }, "ROAD": { "href": "http://station-metadata.weather.mg/stations?type=ROAD" }, "SKI_RESORT": { "href": "http://station-metadata.weather.mg/stations?type=SKI_RESORT" }, "SPECIAL_OBS": { "href": "http://station-metadata.weather.mg/stations?type=SPECIAL_OBS" }, "VIRTUAL": { "href": "http://station-metadata.weather.mg/stations?type=VIRTUAL" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?type=WMO" } } } ``` #### Get all providers Query example: ``` GET /stations/providers ``` Returns a list containing all current known data providers. This list can be extended in the future. + Response 200 (application/json) ``` { "providers": [ "ICAO", "KNMI", "MG", "WMO", ... ], "_links": { "ICAO": { "href": "http://station-metadata.weather.mg/stations?provider=ICAO" }, "KNMI": { "href": "http://station-metadata.weather.mg/stations?provider=KNMI" }, "MG": { "href": "http://station-metadata.weather.mg/stations?provider=MG" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?provider=WMO" }, ... } } ``` ### Cache control headers: The service offer regular HTTP caching hints in the reponse header. All clients are requested to follow good API citizen guidelines and respect these cache information. Example: f data unchanged since this date using the If-Modified-Since request header the server will return with an empty body with the 304 response code. Ex: + Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + If-Modified-Since: Thu, 13 Jul 2017 10:55:53 GMT
FORMAT: 1A Station Metadata API ============================= # General information This Service exists to provide the canonical API for querying and returning MeteoGroup stations and their capabilities. The output response with requested stations is always in GEOJson format. The API supports various combinations for querying stations meta data by area/region (bounding box, polygon, multi-polygon), by provider or type, by stations where MeteoGroup produces forecast or has observation data available. ## Authentication To access active-warning-service the request has to be authorised with a valid JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server `https://auth.weather.mg/oauth/token` with according client credentials. The required scope is `station-metadata`. The documentation about how to authenticate against MeteoGroup Weather API with OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md) ### Querying MeteoGroup stations data Here is the information about all supported HTTP request parameters and HTTP Headers: + Headers + Authorization: Bearer {ENCRYPTED TOKEN HERE} + If-Modified-Since: {DATE} + Parameters + locatedWithin: - {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box - {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]} - polygon coordinates; same as in [GeoJSON Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) - {"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]} - a multi-polygon, as in [GeoJSON MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) + accessVisibility: `public` (string, optional) - station access visibility, valid values is `public` and `private` + provider: `WMO,MG` (string, optional) - currently filter by provider or providers. All possible providers are described in section: **Get all providers** + type: `SKI_RESORT` (string, optional) - currently filter by type. All possible types are described in section: **Get all station types** + hasForecastData: `false` (boolean, optional) - station has forecast data. + hasObservationData: `true` (boolean, optional) - station has observation data. + countryIsoCode: `GB` (string, optional) - station located in this country. ISO Code refers to the [ISO 3166 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166) + meteoGroupStationId: `1004,1005` (string, optional) - filter stations by MeteoGroup station id/(comma separated ids). + fields: accessVisibility,icaoCode,countryIsoCode,provider,type,hasForecastData,wmoCountryId,hasObservationData,countryIsoCode, meteoGroupStationId,name,stationTimeZoneName - metadata fields in response, geometry is present in every success response. If fields is absent all fields are returned. Here are a couple of examples how to query by provider and type, bounding box and polygon. #### Querying by provider or type Query example: ``` GET /stations?accessVisibility=public&provider=WMO&hasForecastData=true&hasObservationData=false&countryIsoCode=UA&meteoGroupStationId=1004,1005 ``` + Response 200 (application/json) + Headers Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + Body ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "ENAS", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1004, "name": "Ny-Alesund II", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 11.9222, 78.9233, 16 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1005, "name": "Isfjord Radio", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 13.6333, 78.0667, 5 ] } } ] } ``` ```` POST /stations ```` { "locatedWithin": {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]}, "accessVisibility": "public", "provider": "WMO", "type": "WMO", "hasForecastData": "true", "hasObservationData": "true", "countryIsoCode": "TG" } + Response 200 (application/json) { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "DXTA", "countryIsoCode": "TG", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 221, "meteoGroupStationId": 65380, "name": "Tabligbo", "hasObservationData": true, "stationTimeZoneName": "Africa/Lome", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 1.5, 6.58333, 44 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "DXXX", "countryIsoCode": "TG", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 221, "meteoGroupStationId": 65387, "name": "Lome", "hasObservationData": true, "stationTimeZoneName": "Africa/Lome", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 1.25, 6.16667, 25 ] } } ] } ### Queries by area or region (bounding box, polygone or multipolygone) When querying stations within a region queries have to formated, like geometries in [GeoJSON](https://tools.ietf.org/html/rfc7946). See the following examples. #### Querying by bounding box Query example for getting stations by bounding box: ```locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22bbox%22%2C%22coordinates%22%3A%5B%5B-10%2C80%5D%2C%5B10%2C5%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ The response body is the same as for querying stations by provider and type. #### Querying by polygon Example GeoJSON polygon: ```{"type":"polygon","coordinates":[[[-0.16,51.70],[-0.43,51.29],[0.18,51.30],[-0.16,51.70]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22polygon%22%2C%22coordinates%22%3A%5B%5B%5B-0.16%2C51.70%5D%2C%5B-0.43%2C51.29%5D%2C%5B0.18%2C51.30%5D%2C%5B-0.16%2C51.70%5D%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Querying by multi-polygon Example GeoJSON multi-polygon: ```{"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22multipolygon%22%2C%22coordinates%22%3A%5B%5B%5B%5B102.0%2C2.0%5D%2C%5B103.0%2C2.0%5D%2C%5B103.0%2C3.0%5D%2C%5B102.0%2C3.0%5D%2C%5B102.0%2C2.0%5D%5D%5D%2C%5B%5B%5B100.0%2C0.0%5D%2C%5B101.0%2C0.0%5D%2C%5B101.0%2C1.0%5D%2C%5B100.0%2C1.0%5D%2C%5B100.0%2C0.0%5D%5D%2C%5B%5B100.2%2C0.2%5D%2C%5B100.8%2C0.2%5D%2C%5B100.8%2C0.8%5D%2C%5B100.2%2C0.8%5D%2C%5B100.2%2C0.2%5D%5D%5D%5D%7D ``` **NOTE**: The `locatedWithin` parameter has to be encoded before putting it to the request. There are free online URL encoder available, for rapid manual testing: e.g. http://www.url-encode-decode.com/ If the query value is not proper encoded, you will receive an empty response with status code ```400 Bad Request```. #### Get all station types Query example: ``` GET /stations/types ``` Returns a list containing all current known station types. This list can be extended in the future. + Response 200 (application/json) ``` { "types": [ "AIRQUALITY", "AVIATION", "BUOY", "MARINE", "MG_NETWORK", "NMI_SECONDARY", "OTHER_OBS_HQ", "OTHER_OBS_LQ", "RAIL", "ROAD", "SKI_RESORT", "SPECIAL_OBS", "VIRTUAL", "WMO" ], "_links": { "AIRQUALITY": { "href": "http://station-metadata.weather.mg/stations?type=AIRQUALITY" }, "AVIATION": { "href": "http://station-metadata.weather.mg/stations?type=AVIATION" }, "BUOY": { "href": "http://station-metadata.weather.mg/stations?type=BUOY" }, "MARINE": { "href": "http://station-metadata.weather.mg/stations?type=MARINE" }, "MG_NETWORK": { "href": "http://station-metadata.weather.mg/stations?type=MG_NETWORK" }, "NMI_SECONDARY": { "href": "http://station-metadata.weather.mg/stations?type=NMI_SECONDARY" }, "OTHER_OBS_HQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_HQ" }, "OTHER_OBS_LQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_LQ" }, "RAIL": { "href": "http://station-metadata.weather.mg/stations?type=RAIL" }, "ROAD": { "href": "http://station-metadata.weather.mg/stations?type=ROAD" }, "SKI_RESORT": { "href": "http://station-metadata.weather.mg/stations?type=SKI_RESORT" }, "SPECIAL_OBS": { "href": "http://station-metadata.weather.mg/stations?type=SPECIAL_OBS" }, "VIRTUAL": { "href": "http://station-metadata.weather.mg/stations?type=VIRTUAL" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?type=WMO" } } } ``` #### Get all providers Query example: ``` GET /stations/providers ``` Returns a list containing all current known data providers. This list can be extended in the future. + Response 200 (application/json) ``` { "providers": [ "ICAO", "KNMI", "MG", "WMO", ... ], "_links": { "ICAO": { "href": "http://station-metadata.weather.mg/stations?provider=ICAO" }, "KNMI": { "href": "http://station-metadata.weather.mg/stations?provider=KNMI" }, "MG": { "href": "http://station-metadata.weather.mg/stations?provider=MG" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?provider=WMO" }, ... } } ``` ### Cache control headers: The service offer regular HTTP caching hints in the reponse header. All clients are requested to follow good API citizen guidelines and respect these cache information. Example: f data unchanged since this date using the If-Modified-Since request header the server will return with an empty body with the 304 response code. Ex: + Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + If-Modified-Since: Thu, 13 Jul 2017 10:55:53 GMT
Add BUOY type
Add BUOY type
API Blueprint
apache-2.0
MeteoGroup/weather-api,MeteoGroup/weather-api
9f307c27fb2e3a89d4d5f4e139440e5e13f3051c
apiary.apib
apiary.apib
FORMAT:alpha-1 HOST: https://aceofblades-bschmoker.c9users.io # Ace of Blades Take a regular deck and remove all face cards, leave only the ace of spades and numbered cards (37 total) Start each player with starts with 5 cards from a shuffled deck > The first player to discard their entire hand wins ## Starting a New Game [/new] Create a new game for two players + Parameters + creator_id (required, number) - unique ID for player creating the game + rival_id (required, number) - unique ID for opponent player to challenge ### Start a new game [GET] + Response 200 (application/json) { "game_id": '42', "player_id" : '31337', "hand" : [ {value: '2', suit:'diamonds'] ## Playing the Game [/play] Make a move or check the current game state ### Get the current game state [GET] Get information about a given game (including their current hand) for a player + Parameters + game_id (required, number) - unique ID for the game + player_id (required, number) - Your player ID + Response 200 (application/json) { "game_id": '42', "creator_id": '31337', "rival_id": '8888', "status": "active", "player_id" : '31337', "hand" : [ {value: '2', suit:'diamonds'] } + Response 401 player_id was invalid for the provided game_ ### Play a Card [POST] Choose a card value to play. Until your opponent chooses their card for this round, you may update the card you wish to play + Parameters + game_id (required, number) - unique ID for the game + player_id (required, number) - your unique player ID + card (required, number) - the card value you wish to play (suits are ignored) + Request (application/json) { "game_id": '42', "player_id": '31337', "card": '7' } + Response 200 (application/json) Once both players have chosen a card value, the server will resolve the round and update each player's hand + Response 401 player_id was invalid for the provided game_ + Response 403 player_id did not have access to the provided card value
FORMAT:alpha-1 HOST: https://aceofblades-bschmoker.c9users.io # Ace of Blades Take a regular deck and remove all face cards, leave only the ace of spades and numbered cards (37 total) Start each player with starts with 5 cards from a shuffled deck > Win by discarding your entire hand, or having the fewest cards when the draw pile is empty ## Starting a New Game [/new] Create a new game for two players + Parameters + creator_id (required, number) - unique ID for player creating the game + rival_id (required, number) - unique ID for opponent player to challenge ### Start a new game [GET] + Response 200 (application/json) { "game_id": '42', "player_id" : '31337', "hand" : [ {value: '2', suit:'diamonds'] ## Playing the Game [/play] Make a move or check the current game state ### Get the current game state [GET] Get information about a given game (including their current hand) for a player + Parameters + game_id (required, number) - unique ID for the game + player_id (required, number) - Your player ID + Response 200 (application/json) { "game_id": '42', "creator_id": '31337', "rival_id": '8888', "status": "active", "hand" : { "player_id" : '31337' "cards": [ {value: '2', suit:'diamonds'}] } } + Response 401 player_id was invalid for the provided game_ ### Play a Card [POST] Choose a card value to play. Until your opponent chooses their card for this round, you may update the card you wish to play After the round is resolved, both players draw a card from the shuffled deck Once the deck is empty, the player with the fewest cards wins. If your card is *lower* than our opponents, your card is discarded and theirs returns to their hand. If both cards are the same value, both are discarded Playing the Ace of Spades lets you discard any card while *also* discarding your opponent's card After playing the Ace, it moves to your opponent's hand + Parameters + game_id (required, number) - unique ID for the game + player_id (required, number) - your unique player ID + card (required, number) - the card value you wish to play (suits are ignored) + ace (optional, boolean) - whether you want to play the ace of spades + Request (application/json) { "game_id": '42', "player_id": '31337', "card": '7' } + Response 200 (application/json) Once both players have chosen a card value, the server will resolve the round and update each player's hand + Response 401 player_id was invalid for the provided game_ + Response 403 player_id did not have the selected card
update api spec
update api spec
API Blueprint
mit
bschmoker/highnoon,bschmoker/aceofblades
89f53f5d72186062f7c95d4c3dd71cbb96f4ea9f
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://polls.apiblueprint.org/ # scifgif Humorous image microservice for isolated networks - xkcd and giphy full text search API ## xkcd [/xkcd] ### Get Random Xkcd Comic [GET] ## xkcd [/xkcd/number/{number}] ### Get Xkcd by Number [GET] + Parameters + number: `1319` (number, required) - The xkcd comic ID ## xkcd [/xkcd/search] ### Get Xkcd Search [GET] + ```query```: Query (string, required) - Search terms ## xkcd [/xkcd/slash] ### Send xkcd slash query [POST] + ```text```: Query (string, required) - Search terms ## xkcd [/xkcd/new_post] ### Send xkcd outgoing-webhook query [POST] + ```token```: Token (string, required) - Integration token + ```trigger_word```: Query (string, required) - Search ## Giphy [/giphy] ### Get Random Giphy Gif [GET] ## Giphy [/giphy/search] ### Get Giphy Search [GET] + ```query```: Query (string, required) - Search terms ## Giphy [/giphy/slash] ### Send Giphy slash query [POST] + ```text```: Query (string, required) - Search terms ## Giphy [/giphy/new_post] ### Send Giphy outgoing-webhook query [POST] + ```token```: Token (string, required) - Integration token + ```trigger_word```: Query (string, required) - Search ## image [/image/{folder}/{file}] ### Get Image [GET] + Parameters + source: `(xkcd|giphy)` (string, required) - The image source + file: `some.png` (string, required) - The image filename ### Delete Image [DELETE] Allows users to delete possibly offensive images + Parameters + source: `(xkcd|giphy)` (string, required) - The image source + file: `some.png` (string, required) - The image filename
FORMAT: 1A HOST: http://localhost:3993 # scifgif Humorous image microservice for isolated networks - xkcd and giphy full text search API ## xkcd [/xkcd] ### Get Random Xkcd Comic [GET] ## xkcd [/xkcd/number/{number}] ### Get Xkcd by Number [GET] + Parameters + number: `1319` (number, required) - The xkcd comic ID ## xkcd [/xkcd/search] ### Get Xkcd Search [GET] + ```query```: Query (string, required) - Search terms ## xkcd [/xkcd/slash] ### Send xkcd slash query [POST] + ```text```: Query (string, required) - Search terms ## xkcd [/xkcd/new_post] ### Send xkcd outgoing-webhook query [POST] + ```token```: Token (string, required) - Integration token + ```trigger_word```: Query (string, required) - Search ## Giphy [/giphy] ### Get Random Giphy Gif [GET] ## giphy GET [/giphy/search] ### Get Giphy Search [GET] + ```query```: Query (string, required) - Search terms ## Giphy [/giphy/slash] ### Send Giphy slash query [POST] + ```text```: Query (string, required) - Search terms ## Giphy [/giphy/new_post] ### Send Giphy outgoing-webhook query [POST] + ```token```: Token (string, required) - Integration token + ```trigger_word```: Query (string, required) - Search ## image [/image/{folder}/{file}] ### Get Image [GET] + Parameters + source: `(xkcd|giphy)` (string, required) - The image source + file: `some.png` (string, required) - The image filename ### Delete Image [DELETE] Allows users to delete possibly offensive images + Parameters + source: `(xkcd|giphy)` (string, required) - The image source + file: `some.png` (string, required) - The image filename + Response 200 (text/plain) HTTP/1.1 200 OK Content-Length: 27 Content-Type: text/plain; charset=utf-8 Date: Thu, 03 Aug 2017 19:45:20 GMT image successfully removed
update api docs
update api docs
API Blueprint
mit
blacktop/scifgif,blacktop/scifgif,blacktop/scifgif,blacktop/scifgif,blacktop/scifgif
355d19af67684fbb66450df5a3954d5b3534081d
STATION-METADATA-API-BLUEPRINT.apib
STATION-METADATA-API-BLUEPRINT.apib
FORMAT: 1A Station Metadata API ============================= # General information This Service exists to provide the canonical API for querying and returning MeteoGroup stations and their capabilities. The output response with requested stations is always in GEOJson format. ## Requesting the Data The GEOJson information about stations might be requested either by bounding box or by polygon. ## Authentication To access active-warning-service the request has to be authorised with a valid JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server `https://auth.weather.mg/oauth/token` with according client credentials. The required scope is `station-metadata`. The documentation about how to authenticate against MeteoGroup Weather API with OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/refactor-2-guideline/authorization/Authentication.md) ### Cache control headers: if data unchanged since this date using the If-Modified-Since request header the server will return with an empty body with the 304 response code. Ex: + Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + If-Modified-Since: Thu, 13 Jul 2017 10:55:53 GMT ### Querying MeteoGroup stations data Here is the information about all supported HTTP request parameters and HTTP Headers: + Headers + Authorization: Bearer {ENCRYPTED TOKEN HERE} + If-Modified-Since: {DATE} + Parameters + locatedWithin: - {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box; - {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]} - polygon coordinates. - {"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]} - An array of separate polygons. - First polygons array describes polygon and another describe holes in it. - **lon** in degree numeric format and in range <-180,180> eg. -123.454, 179.864 - **lat** in degree numeric format and in range <-90,90> eg. -85.541, 5.32, + accessVisibility: `public` (string, optional) - station access visibility, valid values is `public` and `private` + provider: `WMO,MG` (string, optional) - currently filter by provider or providers. All possible providers are described in section: **Get all providers** + type: `SKI_RESORT` (string, optional) - currently filter by type. All possible types are described in section: **Get all station types** + hasForecastData: `false` (boolean, optional) - station has forecast data. + hasObservationData: `true` (boolean, optional) - station has observation data. + countryIsoCode: `GB` (string, optional) - station located in this country. ISO Code refers to the [ISO 3166 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166) The API supports various combinations for querying stations data by bounding box, polygon, multi-polygon, by provider and type, by stations that produce forecast and observation data. Here are a couple of examples how to query by provider and type, bounding box and polygon. #### Querying by provider and type Query example: ``` GET /stations?accessVisibility=public&provider=WMO&hasForecastData=true&hasObservationData=false&countryIsoCode=Ukraine ``` + Response 200 (application/json) + Headers Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + Body ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "ENAS", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1004, "name": "Ny-Alesund II", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 11.9222, 78.9233, 16 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1005, "name": "Isfjord Radio", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 13.6333, 78.0667, 5 ] } } ] } ``` #### Querying by bounding box Query example for getting stations by bounding box: ```locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22bbox%22%2C%22coordinates%22%3A%5B%5B-10%2C80%5D%2C%5B10%2C5%5D%5D%7D ``` If the station data are queried by bounding box, its important to set up the correct **locatedWithin** parameter: **"type":"box", "coordinates":{...}**. **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ The response body is the same as for querying stations by provider and type. #### Querying by polygon Query example for getting stations by polygon: ```locatedWithin={"type":"polygon","coordinates":[[[-0.16,51.70],[-0.43,51.29],[0.18,51.30],[-0.16,51.70]]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22polygon%22%2C%22coordinates%22%3A%5B%5B%5B-0.16%2C51.70%5D%2C%5B-0.43%2C51.29%5D%2C%5B0.18%2C51.30%5D%2C%5B-0.16%2C51.70%5D%5D%5D%7D ``` If the station data are queried by polygon box, appropriate "type" in **locatedWithin** parameter must be mentioned: **"type":"polygon", "coordinates":{...}**. **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Querying by multi-polygon Query example for getting stations by multi-polygon: ```locatedWithin={"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22multipolygon%22%2C%22coordinates%22%3A%5B%5B%5B%5B102.0%2C2.0%5D%2C%5B103.0%2C2.0%5D%2C%5B103.0%2C3.0%5D%2C%5B102.0%2C3.0%5D%2C%5B102.0%2C2.0%5D%5D%5D%2C%5B%5B%5B100.0%2C0.0%5D%2C%5B101.0%2C0.0%5D%2C%5B101.0%2C1.0%5D%2C%5B100.0%2C1.0%5D%2C%5B100.0%2C0.0%5D%5D%2C%5B%5B100.2%2C0.2%5D%2C%5B100.8%2C0.2%5D%2C%5B100.8%2C0.8%5D%2C%5B100.2%2C0.8%5D%2C%5B100.2%2C0.2%5D%5D%5D%5D%7D ``` If the station data are queried by polygon box, appropriate "type" in **locatedWithin** parameter must be mentioned: **"type":"polygon", "coordinates":{...}**. **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Get all station types Query example: ``` GET /stations/types ``` Return all station types ``` [ "WMO", "ROAD", "VIRTUAL", "OTHER_OBS_HQ", "AVIATION", "NMI_SECONDARY", "SPECIAL_OBS", "SKI", "MARINE", "MG_NETWORK", "AIRQUALITY", "RAIL", "OTHER_OBS_LQ" ] ``` #### Get all providers Query example: ``` GET /stations/providers ``` Return all providers ``` [ "ENGLN", "NOWCAST", "WMO", "MG", "VARIOUS", "ICAO", "CUSTOMER", "MADIS/RAWS", "DWD", "SKI", "EAUK", "DACOM", "SMHI", "METEOSWISS", "METEOFRANCE", "KNMI", "RAIL", "USAF", "BZIT", "DWD/BuWe", "MICKS", "AMATEUR", "TEMES", "FUB", "NATO" ] ```
FORMAT: 1A Station Metadata API ============================= # General information This Service exists to provide the canonical API for querying and returning MeteoGroup stations and their capabilities. The output response with requested stations is always in GEOJson format. ## Requesting the Data The GEOJson information about stations might be requested either by bounding box or by polygon. ## Authentication To access active-warning-service the request has to be authorised with a valid JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server `https://auth.weather.mg/oauth/token` with according client credentials. The required scope is `station-metadata`. The documentation about how to authenticate against MeteoGroup Weather API with OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/refactor-2-guideline/authorization/Authentication.md) ### Cache control headers: if data unchanged since this date using the If-Modified-Since request header the server will return with an empty body with the 304 response code. Ex: + Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + If-Modified-Since: Thu, 13 Jul 2017 10:55:53 GMT ### Querying MeteoGroup stations data Here is the information about all supported HTTP request parameters and HTTP Headers: + Headers + Authorization: Bearer {ENCRYPTED TOKEN HERE} + If-Modified-Since: {DATE} + Parameters + locatedWithin: - {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box; - {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]} - polygon coordinates. - {"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]} - An array of separate polygons. - First polygons array describes polygon and another describe holes in it. - **lon** in degree numeric format and in range <-180,180> eg. -123.454, 179.864 - **lat** in degree numeric format and in range <-90,90> eg. -85.541, 5.32, + accessVisibility: `public` (string, optional) - station access visibility, valid values is `public` and `private` + provider: `WMO,MG` (string, optional) - currently filter by provider or providers. All possible providers are described in section: **Get all providers** + type: `SKI_RESORT` (string, optional) - currently filter by type. All possible types are described in section: **Get all station types** + hasForecastData: `false` (boolean, optional) - station has forecast data. + hasObservationData: `true` (boolean, optional) - station has observation data. + countryIsoCode: `GB` (string, optional) - station located in this country. ISO Code refers to the [ISO 3166 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166) The API supports various combinations for querying stations data by bounding box, polygon, multi-polygon, by provider and type, by stations that produce forecast and observation data. Here are a couple of examples how to query by provider and type, bounding box and polygon. #### Querying by provider and type Query example: ``` GET /stations?accessVisibility=public&provider=WMO&hasForecastData=true&hasObservationData=false&countryIsoCode=Ukraine ``` + Response 200 (application/json) + Headers Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + Body ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "ENAS", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1004, "name": "Ny-Alesund II", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 11.9222, 78.9233, 16 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1005, "name": "Isfjord Radio", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 13.6333, 78.0667, 5 ] } } ] } ``` #### Querying by bounding box Query example for getting stations by bounding box: ```locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22bbox%22%2C%22coordinates%22%3A%5B%5B-10%2C80%5D%2C%5B10%2C5%5D%5D%7D ``` If the station data are queried by bounding box, its important to set up the correct **locatedWithin** parameter: **"type":"box", "coordinates":{...}**. **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ The response body is the same as for querying stations by provider and type. #### Querying by polygon Query example for getting stations by polygon: ```locatedWithin={"type":"polygon","coordinates":[[[-0.16,51.70],[-0.43,51.29],[0.18,51.30],[-0.16,51.70]]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22polygon%22%2C%22coordinates%22%3A%5B%5B%5B-0.16%2C51.70%5D%2C%5B-0.43%2C51.29%5D%2C%5B0.18%2C51.30%5D%2C%5B-0.16%2C51.70%5D%5D%5D%7D ``` If the station data are queried by polygon box, appropriate "type" in **locatedWithin** parameter must be mentioned: **"type":"polygon", "coordinates":{...}**. **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Querying by multi-polygon Query example for getting stations by multi-polygon: ```locatedWithin={"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22multipolygon%22%2C%22coordinates%22%3A%5B%5B%5B%5B102.0%2C2.0%5D%2C%5B103.0%2C2.0%5D%2C%5B103.0%2C3.0%5D%2C%5B102.0%2C3.0%5D%2C%5B102.0%2C2.0%5D%5D%5D%2C%5B%5B%5B100.0%2C0.0%5D%2C%5B101.0%2C0.0%5D%2C%5B101.0%2C1.0%5D%2C%5B100.0%2C1.0%5D%2C%5B100.0%2C0.0%5D%5D%2C%5B%5B100.2%2C0.2%5D%2C%5B100.8%2C0.2%5D%2C%5B100.8%2C0.8%5D%2C%5B100.2%2C0.8%5D%2C%5B100.2%2C0.2%5D%5D%5D%5D%7D ``` If the station data are queried by polygon box, appropriate "type" in **locatedWithin** parameter must be mentioned: **"type":"polygon", "coordinates":{...}**. **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Get all station types Query example: ``` GET /stations/types ``` Return all station types ``` [ "WMO", "ROAD", "VIRTUAL", "OTHER_OBS_HQ", "AVIATION", "NMI_SECONDARY", "SPECIAL_OBS", "SKI", "MARINE", "MG_NETWORK", "AIRQUALITY", "RAIL", "OTHER_OBS_LQ" ] ``` #### Get all providers Query example: ``` GET /stations/providers ``` Return all providers ``` [ "ENGLN", "NOWCAST", "WMO", "MG", "VARIOUS", "ICAO", "CUSTOMER", "MADIS/RAWS", "DWD", "SKI", "EAUK", "DACOM", "SMHI", "METEOSWISS", "METEOFRANCE", "KNMI", "RAIL", "USAF", "BZIT", "DWD/BuWe", "MICKS", "AMATEUR", "TEMES", "FUB", "NATO" ] ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. If you do not, you will receive **empty** response with status code **400 Bad Request**.
Add note
Add note
API Blueprint
apache-2.0
MeteoGroup/weather-api,MeteoGroup/weather-api
d0d27eb575825a1e465c977283e245feafb4d1e4
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service, to be consumed by the responsive frontend. # Group Categories Category related resources of the **Money Advice Service**. ## Category [/{locale}/categories/{id}] A single category object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Category. + Values + `en` + `cy` + id (required, string, `mortgages-and-buying-property`) ... ID of the Category. ### Retrieve a Category [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd" + Body { "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "id":"life-events", "content":[ { "id":"setting-up-home", "type":"category", "title":"Setting up home", "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" }, { "id":"how-much-rent-can-you-afford", "type":"guide", "title":"How much rent can you afford?", "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in" } ] } # Group Articles Article related resources of the **Money Advice Service**. ## Article [/{locale}/articles/{id}] A single Article object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Article. + Values + `en` + `cy` + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. ### Retrieve an Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt", "body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>" } # Group Action Plans Action Plan related resources of the **Money Advice Service**. ## Action Plan [/{locale}/action_plans/{id}] A single Action Plan object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. + Values + `en` + `cy` ### Retrieve an Action Plan [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol" + Body { "title": "Prepare for the cost of having a baby", "description": "A handy action plan which can help with planning of the costs involved in having a new baby", "body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>" }
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service, to be consumed by the responsive frontend. # Group Categories Category related resources of the **Money Advice Service**. ## Category [/{locale}/categories/{id}] A single category object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Category. + Values + `en` + `cy` + id (required, string, `life-events`) ... ID of the Category. ### Retrieve a Category [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd" + Body { "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "id":"life-events", "content":[ { "id":"setting-up-home", "type":"category", "title":"Setting up home", "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" }, { "id":"how-much-rent-can-you-afford", "type":"guide", "title":"How much rent can you afford?", "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in" } ] } # Group Articles Article related resources of the **Money Advice Service**. ## Article [/{locale}/articles/{id}] A single Article object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Article. + Values + `en` + `cy` + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. ### Retrieve an Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt", "body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>" } # Group Action Plans Action Plan related resources of the **Money Advice Service**. ## Action Plan [/{locale}/action_plans/{id}] A single Action Plan object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. + Values + `en` + `cy` ### Retrieve an Action Plan [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol" + Body { "title": "Prepare for the cost of having a baby", "description": "A handy action plan which can help with planning of the costs involved in having a new baby", "body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>" }
Correct example id for category blueprint
Correct example id for category blueprint
API Blueprint
mit
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
82e564866f636c564d2ca60b31ade93f8399f58d
src/api.apib
src/api.apib
FORMAT: 1A # YOUR AWESOME API NAME *This API blueprint is subject to change due to technology restrictions, performance optimizations or changing requirements.* ## Authentication + This API uses [JWT](http://jwt.io/) for authentication, + Every token MUST be refreshed before its expiration time, + Token MUST be provided in `Authorization` header, + Toke MUST be provided for each request that requires authentication, + This API issues a **long-lived acces tokens** for consumers. A long-lived JWT generally SHOULD lasts about **30 days**. If no requests are made, the token MUST expire and the user MUST go through the login flow again to get a new one. ### Example Header ``` Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhNnZoQW8zRkc3dDEiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE0NzA1OTg5NzIsImV4cCI6MTQ3MDY4NTM3Mn0.ltA9zZmJKszBJuuV7pTWtY7LzLXrRUfebJDhy_jGMeM ``` ### Claims + `exp` - The exp ( *expiration time* ) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. + `iat` - The iat ( *issued at* ) claim identifies the time at which the JWT was issued. + `sub` - The aud ( *audience* ) claim identifies the subject of this token (for e.g. a user id). + `iss` - The iss ( *issuer* ) claim identifies the principal that issued the JWT. ## Consumer Identification This API uses `User-Agent` and `Application-Id` headers to identify API consumer. `Application-Id` MUST contain an UUID that uniquely identifies a particular consumer installation. ### Example Headers ``` User-Agent: Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36 Application-Id: 6454d937-0a18-44a8-b482-bb48684f1ed4 ``` ## Filtering, Ordering, Pagination & Searching ### Filtering This API can filter returned collections based on provided query parameters. Virtually any model field can be used as a filter. For example, when requesting a list of movies from the /movies endpoint, you may want to limit these to only those of drama genre. This could be accomplished with a request like `GET /movies?genre=drama`. Here, genre is a query parameter that implements a filter. ### Ordering This API can sort returned collections. A generic query parameter `sort` is used to describe sorting rules. This parameter can take a list of comma separated field, each with a possible unary negative to imply descending sort order. E.g. `GET /movies?sort=-rating` - Retrieves a list of movies in descending order of user rating. By default all resources are ordered by their creation time, from newest to oldest. ### Pagintation This API uses the [Link header - RFC 5988](http://tools.ietf.org/html/rfc5988#page-6) to include pagination details. An example of a Link header is described in [GitHub documentation](https://developer.github.com/guides/traversing-with-pagination/). This API returns total count of paged resources in `Total-Count` HTTP header. ### Searching This API uses a generic parameter `search` to expose a full text search mechanism. ## HTTP Methods This API uses HTTP verbs (methods) as following: + `GET` - *Read* - used to **read** (or retrieve) a representation of a resource, + `POST` - *Create* - used to **create** new resources. In particular, it's used to create subordinate resources. + `PUT` - *Update/Replace* - used for **update** capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource. ⚠️ On successful request, replaces identified resource with the request body. + `PATCH` - *Update/Modify* - used for **modify** capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource. + `DELETE` - *Delete* - used to **delete** a resource identified by a URI. ## Localization This API uses `Accept-Language` header to identify the locale. `Accept-Language: en` This header SHOULD be present in every request. If not, API MUST use the **english** language/locale.
FORMAT: 1A # YOUR AWESOME API NAME *This API blueprint is subject to change due to technology restrictions, performance optimizations or changing requirements.* ## Authentication + This API uses [JWT](http://jwt.io/) for authentication, + Every token MUST be refreshed before its expiration time, + Token MUST be provided in `Authorization` header, + Toke MUST be provided for each request that requires authentication, + This API issues a **long-lived acces tokens** for consumers. A long-lived JWT generally SHOULD lasts about **30 days**. If no requests are made, the token MUST expire and the user MUST go through the login flow again to get a new one. ### Example Header ``` Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhNnZoQW8zRkc3dDEiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE0NzA1OTg5NzIsImV4cCI6MTQ3MDY4NTM3Mn0.ltA9zZmJKszBJuuV7pTWtY7LzLXrRUfebJDhy_jGMeM ``` ### Claims + `exp` - The exp ( *expiration time* ) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. + `iat` - The iat ( *issued at* ) claim identifies the time at which the JWT was issued. + `sub` - The aud ( *audience* ) claim identifies the subject of this token (for e.g. a user id). + `iss` - The iss ( *issuer* ) claim identifies the principal that issued the JWT. ## Consumer Identification This API uses `User-Agent` and `Application-Id` headers to identify API consumer. `Application-Id` MUST contain an UUID that uniquely identifies a particular consumer installation. ### Example Headers ``` User-Agent: Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36 Application-Id: 6454d937-0a18-44a8-b482-bb48684f1ed4 ``` ## Filtering, Ordering, Pagination & Searching ### Filtering This API can filter returned collections based on provided query parameters. Virtually any model field can be used as a filter. For example, when requesting a list of movies from the /movies endpoint, you may want to limit these to only those of drama genre. This could be accomplished with a request like `GET /movies?genre=drama`. Here, genre is a query parameter that implements a filter. ### Ordering This API can sort returned collections. A generic query parameter `sort` is used to describe sorting rules. This parameter can take a list of comma separated field, each with a possible unary negative to imply descending sort order. E.g. `GET /movies?sort=-rating` - Retrieves a list of movies in descending order of user rating. By default all resources are ordered by their creation time, from newest to oldest. ### Pagintation This API uses the [Link header - RFC 5988](http://tools.ietf.org/html/rfc5988#page-6) to include pagination details. An example of a Link header is described in [GitHub documentation](https://developer.github.com/guides/traversing-with-pagination/). This API returns total count of paged resources in `Total-Count` HTTP header. ### Searching This API uses a generic parameter `search` to expose a full text search mechanism. ## HTTP Methods This API uses HTTP verbs (methods) as following: + `GET` - *Read* - used to **read** (or retrieve) a representation of a resource, + `POST` - *Create* - used to **create** new resources. In particular, it's used to create subordinate resources. + `PUT` - *Update/Replace* - used for **update** capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource. ⚠️ On successful request, replaces identified resource with the request body. + `PATCH` - *Update/Modify* - used for **modify** capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource. + `DELETE` - *Delete* - used to **delete** a resource identified by a URI. ## Localization This API uses `Accept-Language` header to identify the locale. `Accept-Language: en` This header SHOULD be present in every request. If not, API MUST use the **english** language/locale. ## Media Type Where applicable this API MUST use the JSON media-type. Requests with a message-body are using plain JSON to set or update resource states. `Content-type: application/json` and `Accept: application/json` headers SHOULD be set on all requests if not stated otherwise.
Add Media Type
Add Media Type
API Blueprint
mit
jsynowiec/api-blueprint-boilerplate,jsynowiec/api-blueprint-boilerplate
0a49305bf6a3b491ba138c003257338c62f8fee9
src/api.apib
src/api.apib
FORMAT: 1A # YOUR AWESOME API NAME *This API blueprint is subject to change due to technology restrictions, performance optimizations or changing requirements.* ## Authentication + This API uses [JWT](http://jwt.io/) for authentication, + Every token MUST be refreshed before its expiration time, + Token MUST be provided in `Authorization` header, + Toke MUST be provided for each request that requires authentication, + This API issues a **long-lived acces tokens** for consumers. A long-lived JWT generally SHOULD lasts about **30 days**. If no requests are made, the token MUST expire and the user MUST go through the login flow again to get a new one. ### Example Header ``` Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhNnZoQW8zRkc3dDEiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE0NzA1OTg5NzIsImV4cCI6MTQ3MDY4NTM3Mn0.ltA9zZmJKszBJuuV7pTWtY7LzLXrRUfebJDhy_jGMeM ``` ### Claims + `exp` - The exp ( *expiration time* ) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. + `iat` - The iat ( *issued at* ) claim identifies the time at which the JWT was issued. + `sub` - The aud ( *audience* ) claim identifies the subject of this token (for e.g. a user id). + `iss` - The iss ( *issuer* ) claim identifies the principal that issued the JWT. ## Consumer Identification This API uses `User-Agent` and `Application-Id` headers to identify API consumer. `Application-Id` MUST contain an UUID that uniquely identifies a particular consumer installation. ### Example Headers ``` User-Agent: Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36 Application-Id: 6454d937-0a18-44a8-b482-bb48684f1ed4 ``` ## Filtering, Ordering, Pagination & Searching ### Filtering This API can filter returned collections based on provided query parameters. Virtually any model field can be used as a filter. For example, when requesting a list of movies from the /movies endpoint, you may want to limit these to only those of drama genre. This could be accomplished with a request like `GET /movies?genre=drama`. Here, genre is a query parameter that implements a filter. ### Ordering This API can sort returned collections. A generic query parameter `sort` is used to describe sorting rules. This parameter can take a list of comma separated field, each with a possible unary negative to imply descending sort order. E.g. `GET /movies?sort=-rating` - Retrieves a list of movies in descending order of user rating. By default all resources are ordered by their creation time, from newest to oldest. ### Pagintation This API uses the [Link header - RFC 5988](http://tools.ietf.org/html/rfc5988#page-6) to include pagination details. An example of a Link header is described in [GitHub documentation](https://developer.github.com/guides/traversing-with-pagination/). This API returns total count of paged resources in `Total-Count` HTTP header. ### Searching This API uses a generic parameter `search` to expose a full text search mechanism. ## HTTP Methods This API uses HTTP verbs (methods) as following: + `GET` - *Read* - used to **read** (or retrieve) a representation of a resource, + `POST` - *Create* - used to **create** new resources. In particular, it's used to create subordinate resources. + `PUT` - *Update/Replace* - used for **update** capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource. ⚠️ On successful request, replaces identified resource with the request body. + `PATCH` - *Update/Modify* - used for **modify** capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource. + `DELETE` - *Delete* - used to **delete** a resource identified by a URI. ## Localization This API uses `Accept-Language` header to identify the locale. `Accept-Language: en` This header SHOULD be present in every request. If not, API MUST use the **english** language/locale. ## Media Type Where applicable this API MUST use the JSON media-type. Requests with a message-body are using plain JSON to set or update resource states. `Content-type: application/json` and `Accept: application/json` headers SHOULD be set on all requests if not stated otherwise. ## Notational Conventions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119).
FORMAT: 1A # YOUR AWESOME API NAME *This API blueprint is subject to change due to technology restrictions, performance optimizations or changing requirements.* ## Authentication + This API uses [JWT](http://jwt.io/) for authentication, + Every token MUST be refreshed before its expiration time, + Token MUST be provided in `Authorization` header, + Toke MUST be provided for each request that requires authentication, + This API issues a **long-lived acces tokens** for consumers. A long-lived JWT generally SHOULD lasts about **30 days**. If no requests are made, the token MUST expire and the user MUST go through the login flow again to get a new one. ### Example Header ``` Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhNnZoQW8zRkc3dDEiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE0NzA1OTg5NzIsImV4cCI6MTQ3MDY4NTM3Mn0.ltA9zZmJKszBJuuV7pTWtY7LzLXrRUfebJDhy_jGMeM ``` ### Claims + `exp` - The exp ( *expiration time* ) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. + `iat` - The iat ( *issued at* ) claim identifies the time at which the JWT was issued. + `sub` - The aud ( *audience* ) claim identifies the subject of this token (for e.g. a user id). + `iss` - The iss ( *issuer* ) claim identifies the principal that issued the JWT. ## Consumer Identification This API uses `User-Agent` and `Application-Id` headers to identify API consumer. `Application-Id` MUST contain an UUID that uniquely identifies a particular consumer installation. ### Example Headers ``` User-Agent: Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36 Application-Id: 6454d937-0a18-44a8-b482-bb48684f1ed4 ``` ## Filtering, Ordering, Pagination & Searching ### Filtering This API can filter returned collections based on provided query parameters. Virtually any model field can be used as a filter. For example, when requesting a list of movies from the /movies endpoint, you may want to limit these to only those of drama genre. This could be accomplished with a request like `GET /movies?genre=drama`. Here, genre is a query parameter that implements a filter. ### Ordering This API can sort returned collections. A generic query parameter `sort` is used to describe sorting rules. This parameter can take a list of comma separated field, each with a possible unary negative to imply descending sort order. E.g. `GET /movies?sort=-rating` - Retrieves a list of movies in descending order of user rating. By default all resources are ordered by their creation time, from newest to oldest. ### Pagintation This API uses the [Link header - RFC 5988](http://tools.ietf.org/html/rfc5988#page-6) to include pagination details. An example of a Link header is described in [GitHub documentation](https://developer.github.com/guides/traversing-with-pagination/). This API returns total count of paged resources in `Total-Count` HTTP header. ### Searching This API uses a generic parameter `search` to expose a full text search mechanism. ## HTTP Methods This API uses HTTP verbs (methods) as following: + `GET` - *Read* - used to **read** (or retrieve) a representation of a resource, + `POST` - *Create* - used to **create** new resources. In particular, it's used to create subordinate resources. + `PUT` - *Update/Replace* - used for **update** capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource. ⚠️ On successful request, replaces identified resource with the request body. + `PATCH` - *Update/Modify* - used for **modify** capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource. + `DELETE` - *Delete* - used to **delete** a resource identified by a URI. ## Localization This API uses `Accept-Language` header to identify the locale. `Accept-Language: en` This header SHOULD be present in every request. If not, API MUST use the **english** language/locale. ## Media Type Where applicable this API MUST use the JSON media-type. Requests with a message-body are using plain JSON to set or update resource states. `Content-type: application/json` and `Accept: application/json` headers SHOULD be set on all requests if not stated otherwise. ## Notational Conventions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119). ## Representation of Date and Time All exchange of date and time-related data MUST be done according to ISO 8601 standard and stored in UTC. When returning date and time-related data `YYYY-MM-DDThh:mm:ss.SSSZ` format MUST be used.
Add ISO 8601 date and time-related data format
Add ISO 8601 date and time-related data format
API Blueprint
mit
jsynowiec/api-blueprint-boilerplate,jsynowiec/api-blueprint-boilerplate
81ab97722dba6e994b014e26a87bba50c69b9ecc
blueprint/index.apib
blueprint/index.apib
FORMAT: 1A # The Grid API Want to get straight to the details? ## API Endpoints * [Authentication](authentication.html) * [Content Management API](api.html) * [User Management API](passport.html) * [Notifications API](notifications.html) * [Design Systems](designsystem.html) * [Code examples](examplecode.html) # Purpose [The Grid](https://thegrid.io/) is a next-generation web publishing platform. The service provides a full user experience for making, editing content across multiple devices, but also has a complete API available. This document describes that API and how it can be used by developers, including third-party. <iframe width="560" height="315" src="https://www.youtube.com/embed/6WC51nDYgCw" frameborder="0" allowfullscreen></iframe> Functionality provided includes * Webpage auto-design and layout * Content import and analysis * Image processing * Website serving * Handling payments (TBD) What The Grid is not: Not a web-hosting platform to run arbitrary PHP/Python/Ruby or databases on. # Programming language support The Grid API is based on HTTP REST with JSON payloads and OAuth2 authentication. It can be used from any programming language with libraries supporting these technologies. Popular choices include Python, Ruby, JavaScript, Java, C#. Unless otherwise noted, all API endpoints are [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) enabled. That means you can use the API in the browser on any website, also those who are not made with The Grid. # Access API access is available to all users on The Grid. If you wish to develop with The Grid, [get your plan](https://plans.thegrid.io/pro). When your plan has been activated, you may log in and register new apps on your [accounts page](https://passport.thegrid.io/) # API quotas API usage is tracked against the app ID and user UUID which is used to authenticate the request. We reserve the right to impose quotas (soft or hard), especially on heavy processing operations like image analytics and page solving. If you think your app or user may hit quotas limits, get in touch. # Known consumers Existing examples of apps and libraries using this API. * The Grid Android app * The Grid iOS app * The Grid Chrome extension * [thegrid.io](https://thegrid.io) website, including purchasing process Libraries * [passport-thegrid](https://www.npmjs.com/package/passport-thegrid): Authentication strategy for [Passport.js](http://passportjs.org/) # Issues or Questions? This API documentation is [on GitHub](https://github.com/the-grid/apidocs). Got any questions or found issues in the documentation? [File issues](https://github.com/the-grid/apidocs/issues) or create a [pull request](https://github.com/the-grid/apidocs/pulls).
FORMAT: 1A # The Grid API ## API Endpoints Want to get straight to the details? * [Authentication](authentication.html) * [Content Management API](api.html) * [User Management API](passport.html) * [Notifications API](notifications.html) * [Design Systems](designsystem.html) [Code examples](examplecode.html) # Purpose [The Grid](https://thegrid.io/) is a next-generation web publishing platform. The service provides a full user experience for making, editing content across multiple devices, but also has a complete API available. This document describes that API and how it can be used by developers, including third-party. <iframe width="560" height="315" src="https://www.youtube.com/embed/6WC51nDYgCw" frameborder="0" allowfullscreen></iframe> Functionality provided includes * Webpage auto-design and layout * Content import and analysis * Image processing * Website serving * Handling payments (TBD) What The Grid is not: Not a web-hosting platform to run arbitrary PHP/Python/Ruby or databases on. # Programming language support The Grid API is based on HTTP REST with JSON payloads and OAuth2 authentication. It can be used from any programming language with libraries supporting these technologies. Popular choices include Python, Ruby, JavaScript, Java, C#. Unless otherwise noted, all API endpoints are [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) enabled. That means you can use the API in the browser on any website, also those who are not made with The Grid. # Access API access is available to all users on The Grid. If you wish to develop with The Grid, [get your plan](https://plans.thegrid.io/pro). When your plan has been activated, you may log in and register new apps on your [accounts page](https://passport.thegrid.io/) # API quotas API usage is tracked against the app ID and user UUID which is used to authenticate the request. We reserve the right to impose quotas (soft or hard), especially on heavy processing operations like image analytics and page solving. If you think your app or user may hit quotas limits, get in touch. # Known consumers Existing examples of apps and libraries using this API. * The Grid Android app * The Grid iOS app * The Grid Chrome extension * [thegrid.io](https://thegrid.io) website, including purchasing process # Libraries * [passport-thegrid](https://www.npmjs.com/package/passport-thegrid): Authentication strategy for [Passport.js](http://passportjs.org/) # Issues or Questions? This API documentation is [on GitHub](https://github.com/the-grid/apidocs). Got any questions or found issues in the documentation? [File issues](https://github.com/the-grid/apidocs/issues) or create a [pull request](https://github.com/the-grid/apidocs/pulls).
Tweak intro, header for libraries
index: Tweak intro, header for libraries
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
88f95ad4620accb3dd26d0873455038dd9608c63
blueprint/index.apib
blueprint/index.apib
FORMAT: 1A # The Grid API (Beta) Want to get straight to the details? * [Authentication](authentication.html) * [Content Management](api.html) * [User Management](passport.html) * [Design Systems](designsystem.html) * [Notifications](notifications.html) * [Code examples](examplecode.html) # Purpose [The Grid](https://thegrid.io/) is a next-generation web publishing platform. The service provides a full user experience for making, editing content across multiple devices, but also has a complete API available. This document describes that API and how it can be used by developers, including third-party. <iframe width="560" height="315" src="https://www.youtube.com/embed/6WC51nDYgCw" frameborder="0" allowfullscreen></iframe> Functionality provided includes * Webpage auto-design and layout * Content import and analysis * Image processing * Website serving (currently backed by Github Pages) * Handling payments (TBD) What The Grid is not: Not a web-hosting platform to run arbitrary PHP/Python/Ruby or databases on. # Programming language support The Grid API is based on HTTP REST with JSON payloads and OAuth2 authentication. It can be used from any programming language with libraries supporting these technologies. Popular choices include Python, Ruby, JavaScript, Java, C#. Unless otherwise noted, all API endpoints are [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) enabled. That means you can use the API in the browser on any website, also those who are not made with The Grid. # Access API access is available to all users on The Grid. If you wish to develop with The Grid, [become a founding member now](https://thegrid.io/). *Note: we are currently in BETA and are not auto-activating users yet.* When your plan has been activated, you may log in and register new apps on your [accounts page](https://passport.thegrid.io/) # API quotas API usage is tracked against the app ID and user UUID which is used to authenticate the request. We reserve the right to impose quotas (soft or hard), especially on heavy processing operations like image analytics and page solving. If you think your app or user may hit quotas limits, get in touch. # Example uses ## Mobile apps Either single-purpose apps, or full-featured The Grid apps for platforms which are not officially supported like Windows Phone, Firefox OS, Jolla etc ## Social media integration Like a Twitter or Facebook app which syncs content to your The Grid site. ## Content migration For importing all of the content from your current website, like Wordpress, Squarespace, Medium or Tumblr ## Embedded/autonomous devices Devices that automatically publish their state or results, for instance a timelapse camera or 3d-printer. ## Desktop & web app integration For instance "Share to The Grid" functionality. ## Log in with The Grid Letting users use their The Grid account instead of having to do a new username/password signup. ## Custom content editing user interfaces Using specialized user interactions, making use of new technology or increased accessibility # Known consumers Existing examples of apps and libraries using this API. * [Flowhub](https://flowhub.io) and [noflo-ui](https://github.com/noflo/noflo-ui) * The Grid Android app * The Grid iOS app * The Grid Chrome extension * [thegrid.io](https://thegrid.io) website, including purchasing process Libraries * [passport-thegrid](https://www.npmjs.com/package/passport-thegrid): Authentication strategy for [Passport.js](http://passportjs.org/) # Issues or Questions? This API documentation is [on GitHub](https://github.com/the-grid/apidocs). Got any questions or found issues in the documentation? [File issues](https://github.com/the-grid/apidocs/issues) or create a [pull request](https://github.com/the-grid/apidocs/pulls).
FORMAT: 1A # The Grid API Want to get straight to the details? * [Authentication](authentication.html) * [Content Management](api.html) * [User Management](passport.html) * [Design Systems](designsystem.html) * [Notifications](notifications.html) * [Code examples](examplecode.html) # Purpose [The Grid](https://thegrid.io/) is a next-generation web publishing platform. The service provides a full user experience for making, editing content across multiple devices, but also has a complete API available. This document describes that API and how it can be used by developers, including third-party. <iframe width="560" height="315" src="https://www.youtube.com/embed/6WC51nDYgCw" frameborder="0" allowfullscreen></iframe> Functionality provided includes * Webpage auto-design and layout * Content import and analysis * Image processing * Website serving * Handling payments (TBD) What The Grid is not: Not a web-hosting platform to run arbitrary PHP/Python/Ruby or databases on. # Programming language support The Grid API is based on HTTP REST with JSON payloads and OAuth2 authentication. It can be used from any programming language with libraries supporting these technologies. Popular choices include Python, Ruby, JavaScript, Java, C#. Unless otherwise noted, all API endpoints are [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) enabled. That means you can use the API in the browser on any website, also those who are not made with The Grid. # Access API access is available to all users on The Grid. If you wish to develop with The Grid, [get your plan](https://plans.thegrid.io/pro). When your plan has been activated, you may log in and register new apps on your [accounts page](https://passport.thegrid.io/) # API quotas API usage is tracked against the app ID and user UUID which is used to authenticate the request. We reserve the right to impose quotas (soft or hard), especially on heavy processing operations like image analytics and page solving. If you think your app or user may hit quotas limits, get in touch. # Example uses ## Mobile apps Either single-purpose apps, or full-featured The Grid apps for platforms which are not officially supported like Windows Phone, Firefox OS, Jolla etc ## Social media integration Like a Twitter or Facebook app which syncs content to your The Grid site. ## Content migration For importing all of the content from your current website, like Wordpress, Squarespace, Medium or Tumblr ## Embedded/autonomous devices Devices that automatically publish their state or results, for instance a timelapse camera or 3d-printer. ## Desktop & web app integration For instance "Share to The Grid" functionality. ## Log in with The Grid Letting users use their The Grid account instead of having to do a new username/password signup. ## Custom content editing user interfaces Using specialized user interactions, making use of new technology or increased accessibility # Known consumers Existing examples of apps and libraries using this API. * [Flowhub](https://flowhub.io) and [noflo-ui](https://github.com/noflo/noflo-ui) * The Grid Android app * The Grid iOS app * The Grid Chrome extension * [thegrid.io](https://thegrid.io) website, including purchasing process Libraries * [passport-thegrid](https://www.npmjs.com/package/passport-thegrid): Authentication strategy for [Passport.js](http://passportjs.org/) # Issues or Questions? This API documentation is [on GitHub](https://github.com/the-grid/apidocs). Got any questions or found issues in the documentation? [File issues](https://github.com/the-grid/apidocs/issues) or create a [pull request](https://github.com/the-grid/apidocs/pulls).
Remove beta references, link to buying plan
index: Remove beta references, link to buying plan
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
b8fd7560d61caf9da8fff15ed6dedf15883b621c
source/apiary.apib
source/apiary.apib
FORMAT: 1A HOST: https://api.apiblueprint.org # API Blueprint API API Blueprint parsing service provides parsing of API Blueprint "as a service". ## Media Types The API uses [content negotiation](https://en.wikipedia.org/wiki/Content_negotiation) heavily. Send requests with the `Content-Type` header set to the right input media type and use the `Accept` header to select desired output as a response. ![Media Types](https://github.com/apiaryio/plutonium/blob/master/assets/mediatypes.svg?raw=true) ### Resource State Representation ``` application/hal+json ``` Where applicable this API uses the [HAL+JSON](https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md) media type to represent resource states and to provide available affordances. ### Error States The common [HTTP Response Status Codes](https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used. Error responses use the [vnd.error](https://github.com/blongden/vnd.error) media type. ## Service Root [/] API entry point. This resource does not have any attributes, instead it provides list of available affordances. ### Affordances - `parse` - Parse an API description See _API Description Parser_ resource's _Parser_ action for details. - `compose` - Composes an API description See _API Description Composer_ resource's _Compose_ action for details. ### List [GET] + Relation: index + Response 200 (application/hal+json) + Headers Link: <http://docs.apiblueprint.apiary.io>; rel="profile" + Body { "_links": { "self": {"href": "/"}, "parse": {"href": "/parser"}, "compose": {"href": "/composer"} } } ## API Description Parser [/parser] Parse an API description format. ### Parse [POST] API Blueprint parsing is performed as it is provided by the [Drafter](https://github.com/apiaryio/drafter) reference parser. #### Input Media Types ##### API Blueprint ``` text/vnd.apiblueprint ``` API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). #### Output Media Types ##### API Description Parse Result Namespace ``` application/vnd.refract.parse-result+json application/vnd.refract.parse-result+yaml ``` General-purpose result of the parsing operation. The parse result is in form of the Refract data structure as defined in its [specification](https://github.com/refractproject/refract-spec). The parse result data comply with the [Parse Result Namespace](https://github.com/refractproject/refract-spec/blob/master/namespaces/parse-result.md). ##### API Blueprint Parse Result ``` application/vnd.apiblueprint.parseresult+json application/vnd.apiblueprint.parseresult+yaml ``` API Blueprint Parse Result is just serialized API Blueprint AST (`application/vnd.apiblueprint.ast+json` or `application/vnd.apiblueprint.ast+yaml`) alongside with parser annotations (source map, warnings and errors) defined in [Parse Result Media Types](https://github.com/apiaryio/api-blueprint-ast/blob/master/Parse%20Result.md). Please keep in mind that the API Blueprint parse result media types are soon to be deprecated in favor of the API Description Parse Result Namespace. + Relation: parse + Request Parse API Blueprint into Parse Result Namespace as JSON (text/vnd.apiblueprint) + Headers Accept: application/vnd.refract.parse-result+json + Body :[](sample.apib) + Response 200 (application/vnd.refract.parse-result+json) :[](sample.refract.parse-result.json) + Request Parse API Blueprint into Parse Result Namespace as YAML (text/vnd.apiblueprint) + Headers Accept: application/vnd.refract.parse-result+yaml + Body :[](sample.apib) + Response 200 (application/vnd.refract.parse-result+yaml) :[](sample.refract.parse-result.yaml) + Request Parse API Blueprint into JSON Parse Result AST (text/vnd.apiblueprint) + Headers Accept: application/vnd.apiblueprint.parseresult+json; version=2.2 + Body :[](sample.apib) + Response 200 (application/vnd.apiblueprint.parseresult+json; version=2.2) :[](sample.apiblueprint.parse-result.json) + Request Parse API Blueprint into YAML Parse Result AST (text/vnd.apiblueprint) + Headers Accept: application/vnd.apiblueprint.parseresult+yaml; version=2.2 + Body :[](sample.apib) + Response 200 (application/vnd.apiblueprint.parseresult+yaml; version=2.2) :[](sample.apiblueprint.parse-result.yaml) ## API Description Composer [/composer] Reverse the parsing process--compose an API description format. ### Compose [POST] The composition of API Blueprint is performed as it is provided by the [Matter Compiler](https://github.com/apiaryio/matter_compiler) tool. #### Input Media Types ##### API Blueprint AST ``` application/vnd.apiblueprint.ast+json application/vnd.apiblueprint.ast+yaml ``` Serialized API Blueprint AST represented either in its JSON or YAML format as defined in [API Blueprint AST Serialization Media Types](https://github.com/apiaryio/api-blueprint-ast). Please keep in mind that the API Blueprint AST is soon to be deprecated in favor of the API Description Parse Result Namespace. #### Output Media Types ##### API Blueprint ``` text/vnd.apiblueprint ``` API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). + Relation: compose + Request Compose API Blueprint from AST 2.0 sent as YAML (application/vnd.apiblueprint.ast+yaml; version=2.0) :[](sample.apiblueprint.ast-2.0.yaml) + Response 200 (text/vnd.apiblueprint) :[](sample.apib) + Request Compose API Blueprint from AST 2.0 sent as JSON (application/vnd.apiblueprint.ast+json; version=2.0) :[](sample.apiblueprint.ast-2.0.json) + Response 200 (text/vnd.apiblueprint) :[](sample.apib)
FORMAT: 1A HOST: https://api.apiblueprint.org # API Blueprint API API Blueprint parsing service provides parsing of API Blueprint "as a service". ## Media Types The API uses [content negotiation](https://en.wikipedia.org/wiki/Content_negotiation) heavily. Send requests with the `Content-Type` header set to the right input media type and use the `Accept` header to select desired output as a response. ### Resource State Representation ``` application/hal+json ``` Where applicable this API uses the [HAL+JSON](https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md) media type to represent resource states and to provide available affordances. ### Error States The common [HTTP Response Status Codes](https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used. Error responses use the [vnd.error](https://github.com/blongden/vnd.error) media type. ## Service Root [/] API entry point. This resource does not have any attributes, instead it provides list of available affordances. ### Affordances - `parse` - Parse an API description See _API Description Parser_ resource's _Parser_ action for details. - `compose` - Composes an API description See _API Description Composer_ resource's _Compose_ action for details. ### List [GET] + Relation: index + Response 200 (application/hal+json) + Headers Link: <http://docs.apiblueprint.apiary.io>; rel="profile" + Body { "_links": { "self": {"href": "/"}, "parse": {"href": "/parser"}, "compose": {"href": "/composer"} } } ## API Description Parser [/parser] Parse an API description format. ### Parse [POST] API Blueprint parsing is performed as it is provided by the [Drafter](https://github.com/apiaryio/drafter) reference parser. #### Input Media Types ##### API Blueprint ``` text/vnd.apiblueprint ``` API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). #### Output Media Types ##### API Description Parse Result Namespace ``` application/vnd.refract.parse-result+json application/vnd.refract.parse-result+yaml ``` General-purpose result of the parsing operation. The parse result is in form of the Refract data structure as defined in its [specification](https://github.com/refractproject/refract-spec). The parse result data comply with the [Parse Result Namespace](https://github.com/refractproject/refract-spec/blob/master/namespaces/parse-result.md). ##### API Blueprint Parse Result ``` application/vnd.apiblueprint.parseresult+json application/vnd.apiblueprint.parseresult+yaml ``` API Blueprint Parse Result is just serialized API Blueprint AST (`application/vnd.apiblueprint.ast+json` or `application/vnd.apiblueprint.ast+yaml`) alongside with parser annotations (source map, warnings and errors) defined in [Parse Result Media Types](https://github.com/apiaryio/api-blueprint-ast/blob/master/Parse%20Result.md). Please keep in mind that the API Blueprint parse result media types are soon to be deprecated in favor of the API Description Parse Result Namespace. + Relation: parse + Request Parse API Blueprint into Parse Result Namespace as JSON (text/vnd.apiblueprint) + Headers Accept: application/vnd.refract.parse-result+json + Body :[](sample.apib) + Response 200 (application/vnd.refract.parse-result+json) :[](sample.refract.parse-result.json) + Request Parse API Blueprint into Parse Result Namespace as YAML (text/vnd.apiblueprint) + Headers Accept: application/vnd.refract.parse-result+yaml + Body :[](sample.apib) + Response 200 (application/vnd.refract.parse-result+yaml) :[](sample.refract.parse-result.yaml) + Request Parse API Blueprint into JSON Parse Result AST (text/vnd.apiblueprint) + Headers Accept: application/vnd.apiblueprint.parseresult+json; version=2.2 + Body :[](sample.apib) + Response 200 (application/vnd.apiblueprint.parseresult+json; version=2.2) :[](sample.apiblueprint.parse-result.json) + Request Parse API Blueprint into YAML Parse Result AST (text/vnd.apiblueprint) + Headers Accept: application/vnd.apiblueprint.parseresult+yaml; version=2.2 + Body :[](sample.apib) + Response 200 (application/vnd.apiblueprint.parseresult+yaml; version=2.2) :[](sample.apiblueprint.parse-result.yaml) ## API Description Composer [/composer] Reverse the parsing process--compose an API description format. ### Compose [POST] The composition of API Blueprint is performed as it is provided by the [Matter Compiler](https://github.com/apiaryio/matter_compiler) tool. #### Input Media Types ##### API Blueprint AST ``` application/vnd.apiblueprint.ast+json application/vnd.apiblueprint.ast+yaml ``` Serialized API Blueprint AST represented either in its JSON or YAML format as defined in [API Blueprint AST Serialization Media Types](https://github.com/apiaryio/api-blueprint-ast). Please keep in mind that the API Blueprint AST is soon to be deprecated in favor of the API Description Parse Result Namespace. #### Output Media Types ##### API Blueprint ``` text/vnd.apiblueprint ``` API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). + Relation: compose + Request Compose API Blueprint from AST 2.0 sent as YAML (application/vnd.apiblueprint.ast+yaml; version=2.0) :[](sample.apiblueprint.ast-2.0.yaml) + Response 200 (text/vnd.apiblueprint) :[](sample.apib) + Request Compose API Blueprint from AST 2.0 sent as JSON (application/vnd.apiblueprint.ast+json; version=2.0) :[](sample.apiblueprint.ast-2.0.json) + Response 200 (text/vnd.apiblueprint) :[](sample.apib)
Remove internal diagram from the blueprint
Remove internal diagram from the blueprint
API Blueprint
mit
apiaryio/api.apiblueprint.org,apiaryio/api.apiblueprint.org
5799b97a8d2b84ee05ec01a8678c8648fb7ee216
docs/ezra.apib
docs/ezra.apib
FORMAT: 1a # Ezra Ezra is a project intended to manage JPCC Community Classes. The name Ezra inspired from Nehemiah Book. # Group Participant Manage Participant ## Register [POST /participant] Register new participant + Request Register Participant (application/json) + Attributes (Participant) + Response 201 (application/json) + Attributes (Participant) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /participant{?num, cursor, year, batch}] Fetch participants + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of participant to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Participant]) ## Participant [/participant/{participant_id}] + Parameters + participant_id: `someparticipantid` (string) - Participant ID ### GET [GET] Get Participant + Response 200 (application/json) + Attributes (Participant) + Response 404 (application/json) If there is no participant with specified ID + Attributes (Error) ### Update [PUT] Update participant + Request (application/json) + Attributes (Participant) + Response 200 (application/json) + Attributes (Participant) + Response 404 (application/json) If there is no participant with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Unregister [DELETE] Unregister/remove participant + Response 204 (application/json) + Response 404 (application/json) If there is no participant with specified ID + Attributes (Error) # Group Presenter Manage Presenter ## Register [POST /presenter] Register new presenter + Request register presenter (application/json) + Attributes (Presenter) + Response 201 (application/json) + Attributes (Presenter) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /presenter{?num, cursor, year, batch}] Fetch Presenters + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of Presenter to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Presenter]) ## Presenter [/presenter/{presenter_id}] + Parameters + presenter_id: `somepresenterid` (string) - Presenter ID ### GET [GET] Get Presenter + Response 200 (application/json) + Attributes (Presenter) + Response 404 (application/json) If there is no Presenter with specified ID + Attributes (Error) ### Update [PUT] Update Presenter + Request (application/json) + Attributes (Presenter) + Response 200 (application/json) + Attributes (Presenter) + Response 404 (application/json) If there is no presenter with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Unregister [DELETE] Unregister/remove presenter + Response 204 (application/json) + Response 404 (application/json) If there is no presenter with specified ID + Attributes (Error) # Group Facilitator Manage Facilitator ## Register [POST /facilitator] Register new facilitator + Request Register Placement (application/json) + Attributes (Facilitator) + Response 201 (application/json) + Attributes (Facilitator) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /facilitator{?num, cursor, year, batch}] Fetch Facilitators + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of Facilitator to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Facilitator]) ## Facilitator [/facilitator/{facilitator_id}] + Parameters + facilitator_id: `somefacilitatorid` (string) - Facilitator ID ### GET [GET] Get Facilitator + Response 200 (application/json) + Attributes (Facilitator) + Response 404 (application/json) If there is no facilitator with specified ID + Attributes (Error) ### Update [PUT] Update Facilitator + Request (application/json) + Attributes (Facilitator) + Response 200 (application/json) + Attributes (Facilitator) + Response 404 (application/json) If there is no facilitator with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Unregister [DELETE] Unregister/remove Facilitator + Response 204 (application/json) + Response 404 (application/json) If there is no Facilitator with specified ID + Attributes (Error) ## Assign Facilitator to Class [/facilitator/{facilitator_id}/class/{class_id}] + Parameters + facilitator_id: `somefacilitatorid` (string) - Facilitator ID + class_id: `someclassid` (string) - Class ID ## Assign [POST] Assign facilitator to class + Response 200 + Response 404 (application/json) If there is no facilitator/class with specified ID + Attributes (Error) ## Unassign [DELETE] Unassign facilitator from class + Response 200 + Response 404 (application/json) If there is no facilitator/class with specified ID + Attributes (Error) # Group Class Manage class ## Register [POST /class] Add new class + Request add class (application/json) + Attributes (Class) + Response 201 (application/json) + Attributes (Class) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /class{?num, cursor, year, batch}] Fetch classs + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of class to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Class]) ## Class [/class/{class_id}] + Parameters + class_id: `someclassid` (string) - class ID ### GET [GET] Get class + Response 200 (application/json) + Attributes (Class) + Response 404 (application/json) If there is no class with specified ID + Attributes (Error) ### Update [PUT] Update class + Request (application/json) + Attributes (Class) + Response 200 (application/json) + Attributes (Class) + Response 404 (application/json) If there is no class with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Remove [DELETE] Remove class + Response 204 (application/json) + Response 404 (application/json) If there is no class with specified ID + Attributes (Error) # Data Structures ## Participant + id: 12345 (number) - ID of participant + name: `John Doe` (string) - Participant's name + email: `[email protected]` (string) - Participant's email + phone_number: `+62819123123` (string) - Participant's phone number + dob: `30-12-1980` (string) - Participant date of birth + date: `Rasuna 1` (string) - Participant's DATE ## Presenter + id: 12345 (number) - ID of Presenter + name: `John Doe` (string) - Presenter's name + email: `[email protected]` (string) - Presenter's email + phone_number: `+62819123123` (string) - Presenter's phone number + dob: `30-12-1980` (string) - Presenter date of birth + date: `Rasuna 1` (string) - Presenter's DATE ## Facilitator + id: 12345 (number) - ID of Facilitator + name: `John Doe` (string) - Facilitator's name + email: `[email protected]` (string) - Facilitator's email + phone_number: `+62819123123` (string) - Facilitator's phone number + dob: `30-12-1980` (string) - Facilitator date of birth + date: `Rasuna 1` (string) - Facilitator's DATE ## Class + id: `jpcc-col-1-2017` (string) - ID of class + type: `jpcc-col` (string) - Type of class, e.g jpcc-cob, jpcc-col + batch: 1 (number) - Class Batch + year: 2017 (number) - Class Year + description: `here is class description` (string) - description of class ## Form + id: 12345 (number) + name: `Feedback Form PRESENTER CoL Sesi 8 - SMAART Planning (Responses)` (string) + external_url: `https://docs.google.com/spreadsheets/d/1pNHG0uPsMyaLjinREP4UYXXeVrUw0-3UCHZ7uxltIEQ/edit#gid=1523709804` ## FormQuestion + form_id: 1 (number) + question_id: 123 (number) ## Question + id: 123 (number) - ID of feedback question + name: `Penguasaan Materi` (string) - Name will be shown in field + description: `Penjelasan mengenai penguasaan materi` (string) - Description + answer_type : `number` (string) - Answer Type e.g (number, string) ## Answer + id: 2 (number) - ID of feedback answer + recipient_type: `presenter` (string) - Type of recipient e.g (presenter, facilitator) + recipient_id: 12345 (number) - Type of recipient + reviewer_type: `participant` (string) - Type of reviewer + reviewer_id : 12345 (number) - ID of reviewer + class_id: `jpcc-col-1-2017` (string) - ID of class + session: 1 (number) - Session number + question_id: 123 + answer: `Great!` (string) - Answer for feedback, could be in the form of number/ string e.g 4 or `Awesome!` + created_at: `2017-01-01 00:00:00` (string) - Answer created at time ## Error (object) + message: This is an error (string)
FORMAT: 1a # Ezra Ezra is a project intended to manage JPCC Community Classes. The name Ezra inspired from Nehemiah Book. # Group Participant Manage Participant ## Register [POST /participant] Register new participant + Request Register Participant (application/json) + Attributes (Participant) + Response 201 (application/json) + Attributes (Participant) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /participant{?num, cursor, year, batch}] Fetch participants + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of participant to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Participant]) ## Participant [/participant/{participant_id}] + Parameters + participant_id: `someparticipantid` (string) - Participant ID ### GET [GET] Get Participant + Response 200 (application/json) + Attributes (Participant) + Response 404 (application/json) If there is no participant with specified ID + Attributes (Error) ### Update [PUT] Update participant + Request (application/json) + Attributes (Participant) + Response 200 (application/json) + Attributes (Participant) + Response 404 (application/json) If there is no participant with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Unregister [DELETE] Unregister/remove participant + Response 204 (application/json) + Response 404 (application/json) If there is no participant with specified ID + Attributes (Error) # Group Presenter Manage Presenter ## Register [POST /presenter] Register new presenter + Request register presenter (application/json) + Attributes (Presenter) + Response 201 (application/json) + Attributes (Presenter) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /presenter{?num, cursor, year, batch}] Fetch Presenters + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of Presenter to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Presenter]) ## Presenter [/presenter/{presenter_id}] + Parameters + presenter_id: 12345 (number) - Presenter ID ### GET [GET] Get Presenter + Response 200 (application/json) + Attributes (Presenter) + Response 404 (application/json) If there is no Presenter with specified ID + Attributes (Error) ### Update [PUT] Update Presenter + Request (application/json) + Attributes (Presenter) + Response 200 (application/json) + Attributes (Presenter) + Response 404 (application/json) If there is no presenter with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Unregister [DELETE] Unregister/remove presenter + Response 204 (application/json) + Response 404 (application/json) If there is no presenter with specified ID + Attributes (Error) ## Presenter Report [/presenter/{presenter_id}/report] + Parameters + presenter_id: 12345 (number) - Presenter ID ## Get Report [GET] + Response 200 (application/json) + Attributes (PresenterReport) + Response 404 (application/json) If there is no presenter with specified ID + Attributes (Error) # Group Facilitator Manage Facilitator ## Register [POST /facilitator] Register new facilitator + Request Register Placement (application/json) + Attributes (Facilitator) + Response 201 (application/json) + Attributes (Facilitator) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /facilitator{?num, cursor, year, batch}] Fetch Facilitators + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of Facilitator to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Facilitator]) ## Facilitator [/facilitator/{facilitator_id}] + Parameters + facilitator_id: 12345 (number) - Facilitator ID ### GET [GET] Get Facilitator + Response 200 (application/json) + Attributes (Facilitator) + Response 404 (application/json) If there is no facilitator with specified ID + Attributes (Error) ### Update [PUT] Update Facilitator + Request (application/json) + Attributes (Facilitator) + Response 200 (application/json) + Attributes (Facilitator) + Response 404 (application/json) If there is no facilitator with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Unregister [DELETE] Unregister/remove Facilitator + Response 204 (application/json) + Response 404 (application/json) If there is no Facilitator with specified ID + Attributes (Error) ## Facilitator Report [/facilitator/{facilitator_id}/report] + Parameters + facilitator_id: 12345 (number) - Facilitator ID ## Get Report [GET] + Response 200 (application/json) + Attributes (FacilitatorReport) + Response 404 (application/json) If there is no facilitator with specified ID + Attributes (Error) ## Assign Facilitator to Class [/facilitator/{facilitator_id}/class/{class_id}] + Parameters + facilitator_id: 12345 (number) - Facilitator ID + class_id: `someclassid` (string) - Class ID ## Assign [POST] Assign facilitator to class + Response 200 + Response 404 (application/json) If there is no facilitator/class with specified ID + Attributes (Error) ## Unassign [DELETE] Unassign facilitator from class + Response 200 + Response 404 (application/json) If there is no facilitator/class with specified ID + Attributes (Error) # Group Class Manage class ## Register [POST /class] Add new class + Request add class (application/json) + Attributes (Class) + Response 201 (application/json) + Attributes (Class) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ## Fetch [GET /class{?num, cursor, year, batch}] Fetch classs + Parameters + cursor (string, optional) - Cursor for pagination. + Default: 0 + num (number, optional) - Number of class to be returned + Default: 10 + year (number, optional) - Year + batch (number, optional) - Batch + Response 200 (application/json) + Attributes (array[Class]) ## Class [/class/{class_id}] + Parameters + class_id: `someclassid` (string) - class ID ### GET [GET] Get class + Response 200 (application/json) + Attributes (Class) + Response 404 (application/json) If there is no class with specified ID + Attributes (Error) ### Update [PUT] Update class + Request (application/json) + Attributes (Class) + Response 200 (application/json) + Attributes (Class) + Response 404 (application/json) If there is no class with specified ID + Attributes (Error) + Response 422 (application/json) If the request body invalid or does not contain required fields + Attributes (Error) ### Remove [DELETE] Remove class + Response 204 (application/json) + Response 404 (application/json) If there is no class with specified ID + Attributes (Error) # Data Structures ## Participant + id: 12345 (number) - ID of participant + name: `John Doe` (string) - Participant's name + email: `[email protected]` (string) - Participant's email + phone_number: `+62819123123` (string) - Participant's phone number + dob: `30-12-1980` (string) - Participant date of birth + date: `Rasuna 1` (string) - Participant's DATE ## Presenter + id: 12345 (number) - ID of Presenter + name: `John Doe` (string) - Presenter's name + email: `[email protected]` (string) - Presenter's email + phone_number: `+62819123123` (string) - Presenter's phone number + dob: `30-12-1980` (string) - Presenter date of birth + date: `Rasuna 1` (string) - Presenter's DATE ## Facilitator + id: 12345 (number) - ID of Facilitator + name: `John Doe` (string) - Facilitator's name + email: `[email protected]` (string) - Facilitator's email + phone_number: `+62819123123` (string) - Facilitator's phone number + dob: `30-12-1980` (string) - Facilitator date of birth + date: `Rasuna 1` (string) - Facilitator's DATE ## Class + id: `jpcc-col-1-2017` (string) - ID of class + type: `jpcc-col` (string) - Type of class, e.g jpcc-cob, jpcc-col + batch: 1 (number) - Class Batch + year: 2017 (number) - Class Year + description: `here is class description` (string) - description of class ## Session + id: 5 (number) - Session ID + name: `Finding Your Strength` (string) - Session Name ## Average + key: `Penguasaan materi` + score: 5.0 (number) ## Summary + positive_comment: `Great!` (string) - Summary of positive comment + improvement_comment: `Keep Improving!` (string) - Summary of improvement comment ## PresenterReport + class (Class) + session (Session) + presenter (Presenter) + average (array[Average]) + summary (Summary) ## FacilitatorReport + class (Class) + facilitator (Facilitator) + average (array[Average]) + comment: `Great job!` (string) ## Error (object) + message: This is an error (string)
Update docs add facil report and presenter report
Update docs add facil report and presenter report
API Blueprint
apache-2.0
arielizuardi/ezra
a6edf21bdd2f8c4236c1453d8eda34217207c6f9
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://tox-ticketprint.herokuapp.com/ # TicketPrint TicketPrint is a simple API allowing consumers to trigger print jobs of tickets. ## Tickets [/api/ticket/{id}] + Parameters + id (required, string, `ABC-123`) ... AlphaNumeric `id` of the Ticket to perform action with. Has example value. ### Get a Ticket [GET] + Response 200 (application/json) { "id": "ABC-123", "title": "Hello Title" } ## Print Jobs [/api/print] ### Create a new Print Job [POST] Just send a JSON object with ... to trigger a print job + Request (application/json) { "id": "ABC-123", "format": 2, "target": "it", } + Response 200 (application/json)
FORMAT: 1A HOST: https://tox-ticketprint.herokuapp.com/ # TicketPrint TicketPrint is a simple API allowing consumers to trigger print jobs of tickets. ## Tickets [/api/ticket/{id}] + Parameters + id (required, string, `ABC-123`) ... AlphaNumeric `id` of the Ticket to perform action with. Has example value. ### Get a Ticket [GET] + Response 200 (application/json) { "id": "ABC-123", "title": "Just fix the bug with highest priority", "description": "the description", "storypoints": 23, "projecttitle": "the project title", "reporter": "John Doe", } ## Print Jobs [/api/print] ### Create a new Print Job [POST] Just send a JSON object with ... to trigger a print job + Request (application/json) { "id": "ABC-123", "format": 2, "target": "it", } + Response 200 (application/json)
append response object for GET ticket
append response object for GET ticket
API Blueprint
mit
dasrick/tox-ticketprint-ui,dasrick/tox-ticketprint-ui
fe36caff58afa25db3f76df5b68ce5b4e2b1ba34
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://api.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service. # Articles Article related resources of the **Money Advice Service**. ## Article [/articles/{id}] A single Article object with all its details + Parameters + id (required, string, `foo-bar`) ... String `id` of the Article to perform action with. Has example value. ### Retrieve a Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "id": "where-to-go-to-get-free-debt-advice", "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt" }
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service. # Articles Article related resources of the **Money Advice Service**. ## Article [/articles/{id}] A single Article object with all its details + Parameters + id (required, string, `foo-bar`) ... String `id` of the Article to perform action with. Has example value. ### Retrieve a Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "url": "https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice", "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt" }
Add URLs to API Blueprint
Add URLs to API Blueprint
API Blueprint
mit
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
fce94643f274d90ce35d86e8e8e650a4c99e6470
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service, to be consumed by the responsive frontend. # Group Categories **Money Advice Service** catgeories and their contents. ## Category [/{locale}/category/{id}] A single category with its content + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Category. + Values + `en` + `cy` + id (required, string, `mortgages-and-buying-property`) ... ID of the Category. ### Retrieve a Category [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/categories/mortgages-and-buying-property>; rel="alternate"; hreflang="cy"; title="Morgeisi a phrynu eiddo" + Body { "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "id":"life-events", "content":[ { "id":"setting-up-home", "type":"category", "title":"Setting up home", "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" }, { "id":"how-much-rent-can-you-afford", "type":"guide", "title":"How much rent can you afford?", "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you’ve moved in" } ] } # Group Articles Article related resources of the **Money Advice Service**. ## Article [/{locale}/articles/{id}] A single Article object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Article. + Values + `en` + `cy` + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. ### Retrieve an Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt", "body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>" } # Group Action Plans Action Plan related resources of the **Money Advice Service**. ## Action Plan [/{locale}/action_plans/{id}] A single Action Plan object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. + Values + `en` + `cy` ### Retrieve an Action Plan [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol" + Body { "title": "Prepare for the cost of having a baby", "description": "A handy action plan which can help with planning of the costs involved in having a new baby", "body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>" }
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service, to be consumed by the responsive frontend. # Group Categories **Money Advice Service** catgeories and their contents. ## Category [/{locale}/categories/{id}] A single category with its content + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Category. + Values + `en` + `cy` + id (required, string, `mortgages-and-buying-property`) ... ID of the Category. ### Retrieve a Category [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/categories/mortgages-and-buying-property>; rel="alternate"; hreflang="cy"; title="Morgeisi a phrynu eiddo" + Body { "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "id":"life-events", "content":[ { "id":"setting-up-home", "type":"category", "title":"Setting up home", "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" }, { "id":"how-much-rent-can-you-afford", "type":"guide", "title":"How much rent can you afford?", "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in" } ] } # Group Articles Article related resources of the **Money Advice Service**. ## Article [/{locale}/articles/{id}] A single Article object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Article. + Values + `en` + `cy` + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. ### Retrieve an Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt", "body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>" } # Group Action Plans Action Plan related resources of the **Money Advice Service**. ## Action Plan [/{locale}/action_plans/{id}] A single Action Plan object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. + Values + `en` + `cy` ### Retrieve an Action Plan [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol" + Body { "title": "Prepare for the cost of having a baby", "description": "A handy action plan which can help with planning of the costs involved in having a new baby", "body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>" }
Rename categories path to follow REST approach
Rename categories path to follow REST approach
API Blueprint
mit
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
e8af6ce8a89dd5fb5398adcd4fa6474d8a6200b1
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://iot-camera-object-recognizer.herokuapp.com/ # IOT Object Camera Recognizer. IOT object camera recognizer. Orginize camera objects list and check current state of stage. # Ping [/ping] ## Ping service [GET] Returns `200` if service is alive. + Response 200 (application/json) # Get List or Add new Object api [/webapi/houses/{house_id}/objects] + Parameters + house_id (required, string, `"76c6-456d-8971"`) ... Unique house identifier ## List All Objects [GET] Returns code 200 and list of jsons if correct house_id, 404 otherwise. + Response 200 (application/json) + Body [ { "id": "randomid1", "type": "chair" }, { "id": "kokanto", "type": "toxic" }, { "id": "randomid3", "type": "table" } ] + Response 404 (application/json) ## Add Object [POST] You may put new object in camera known list(placed on the stage). If house_id is incorrect 404 is returned. + type (string) - object type + Request (application/json) { "type": "alien" } + Response 200 (application/json) + Body { "id": "newObjectId", "type": "alien" } + Response 404 (application/json) # Manage Known objects api [/webapi/houses/{house_id}/objects/{object_id}] + Parameters + object_id (required, string, `"76c6-456d-8971"`) ... ID of an object, returned by api when called put object ### Get Object by id [GET] Get an object type by id, if house_id or object_id is not valid 404 is returned. + Response 200 (application/json) + Body { "id": "requestedid", "type": "objecttype" } + Response 404 (application/json) ### Put Object by id [PUT] You may update object type by id. 404 if invalid ids + type (string): new object type + Request (application/json) { "type": "newType" } + Response 200 (application/json) + Response 404 (application/json) ### Delete Object by id [DELETE] You may delete object type by id. 404 if invalid ids + type (string): new object type + Response 200 (application/json) + Response 404 (application/json) # Check for unknown objects api [GET/houses/{house_id}/check] You may ask recognizer for uknown objects on the stage. if result is false then list of objects is returned as value of "objects" key. If everything is Ok then only result true is returned. 404 is returned if house_id is invalid. + Parameters + house_id - string, same house identifier as in manage objects api. + Response 200 (application/json) + Body { "result": false "objects": [ "unknownchair", "unknownkoka", "unknownakunamatata" ] } + Response 404 (application/json)
FORMAT: 1A HOST: http://iot-camera-object-recognizer.herokuapp.com/webapi # IOT Object Camera Recognizer. IOT object camera recognizer. Orginize camera objects list and check current state of stage. # Ping [/ping] ## Ping service [GET] Returns `200` if service is alive. + Response 200 (application/json) # Get List or Add new Object api [/houses/{house_id}/objects] + Parameters + house_id (required, string, `76c6-456d-8971`) ... Unique house identifier ## List All Objects [GET] Returns code 200 and list of jsons if correct house_id, 404 otherwise. + Response 200 (application/json) + Body [ { "id": "randomid1", "type": "chair" }, { "id": "kokanto", "type": "toxic" }, { "id": "randomid3", "type": "table" } ] + Response 404 (application/json) ## Add Object [POST] You may put new object in camera known list(placed on the stage). If house_id is incorrect 404 is returned. + type (string) - object type + Request (application/json) { "type": "alien" } + Response 200 (application/json) + Body { "id": "newObjectId", "type": "alien" } + Response 404 (application/json) # Manage Known objects api [/houses/{house_id}/objects/{object_id}] + Parameters + object_id (required, string, `76c6-456d-8971`) ... ID of an object, returned by api when called put object ### Get Object by id [GET] Get an object type by id, if house_id or object_id is not valid 404 is returned. + Response 200 (application/json) + Body { "id": "requestedid", "type": "objecttype" } + Response 404 (application/json) ### Put Object by id [PUT] You may update object type by id. 404 if invalid ids + type (string): new object type + Request (application/json) { "type": "newType" } + Response 200 (application/json) + Response 404 (application/json) ### Delete Object by id [DELETE] You may delete object type by id. 404 if invalid ids + type (string): new object type + Response 200 (application/json) + Response 404 (application/json) # Check for unknown objects api [GET/houses/{house_id}/check] You may ask recognizer for uknown objects on the stage. if result is false then list of objects is returned as value of "objects" key. If everything is Ok then only result true is returned. 404 is returned if house_id is invalid. + Parameters + house_id - string, same house identifier as in manage objects api. + Response 200 (application/json) + Body { "result": false "objects": [ "unknownchair", "unknownkoka", "unknownakunamatata" ] } + Response 404 (application/json)
Update API Blueprints
Update API Blueprints
API Blueprint
mit
freeuni-sdp/iot-camera-object-recognizer
04b7057bec2159f81e6ffcff61188eb7123b1826
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://localhost:8001 # demo-faye This is API blueprint document for my demo on Faye for **Android** and **Node.js** ## Structures ### Client side This app has two component, Android and Web app. You can use web app by hit the main page. 1. Android app 2. Web app (http://localhost:8001) ### Server side The main duty of **Server** side is register new user and receiver user message for responding to the others. # Web App [/] You can enter the web chat interface with this API. ## Open Web App [GET] + Response 200 (text/html) ## Group Chat API ### Functions * Register a new user * Receive message from Server * Send message to Server * Notify others user whether a user is joined or left. ### Mechanism When a **User** connects to **Server**. He will input his `username` and pushes his `sessionId` and `username` to the **Server**. After that, the **Server** save the **User** information and response `userId` to **User**. When he pushes a message. The **Server** will receive it and broadcasts to the others. When a user *joins* or *leave* the room. Other people will be *notified* by **Server**. ### Register a new user [/chat/register] **User** connects to the **Server** and acquire a `userId` #### Send user information [POST] + Attributes + sessionId: 1441428112793 (required, string) - The current sessionId of the user + username: user (required, string) - Username of the user + Request (application/json) + Response 200 ### Get userId from Server [/chat/register/{sessionId}] **Server** will send the `userId` to **User** through this API. After **User** send `username` to **Server** + Parameters + sessionId: 1441428112793 (required, string) - The current sessionId of the user #### Get userId [GET] + Attributes + userId: 1441428112793 (required, string) - The unique id of the user + Response 201 (application/json) ### Send message to users [/chat/public] The **Server** will send message to the users through this api. ### Receive message from server [GET] + Attributes + text: user: message (required, string) - Message from user + Response 201 (application/json) ### Send message to server [/chat/public/server] Due to the structure of **Faye**, we have to use **another** channel to transfer message from Client to Server. > **Note:** a channel must have a **single responsibility** to maintain the **stability** of the application. > > A channel will be a **publisher** or **subscriber**. #### Send message [POST] + Attributes + userId: 1441428112793 (required, string) - The unique id of the user + text: message (required, string) - Message from user + request (application/json) + response 200 ### Notify user status to the others [/chat/join] When a user join or log out, their status will be notified to the others. #### Notify user status [GET] + Attributes + text: user has joined. (required, string) - User status + response 200 (application/json)
FORMAT: 1A HOST: http://localhost:8001 # demo-faye This is API blueprint document for my demo on Faye for **Android** and **Node.js** ## Structures ### Client side This app has two component, Android and Web app. You can use web app by hit the main page. 1. Android app 2. Web app (http://localhost:8001) ### Server side The main duty of **Server** side is register new user and receiver user message for responding to the others. # Web App [/] You can enter the web chat interface with this API. ## Open Web App [GET] + Response 200 (text/html) ## Group Chat API ### Functions * Register a new user * Receive message from Server * Send message to Server * Notify others user whether a user is joined or left. ### Mechanism `. When a **User** connects to **Server**. He will input his `username` and pushes his `sessionId` and `username` to the **Server**. 2. After that, the **Server** save the **User** information and response `userId` to **User**. 3. When he pushes a message. The **Server** will receive it and broadcasts to the others. 4. When a user *joins* or *leave* the room. Other people will be *notified* by **Server**. ### Register a new user [/chat/register] **User** connects to the **Server** and acquire a `userId` #### Send user information [POST] + Attributes + sessionId: 1441428112793 (required, string) - The current sessionId of the user + username: user (required, string) - Username of the user + Request (application/json) + Response 200 ### Get userId from Server [/chat/register/{sessionId}] + Parameters + sessionId: 1441428112793 (required, string) - The current sessionId of the user #### Get userId [GET] + Attributes + userId: 1441428112793 (required, string) - The unique id of the user + Response 201 (application/json) ### Send message to users [/chat/public] ### Receive message from server [GET] + Attributes + text: user: message (required, string) - Message from user + Response 201 (application/json) ### Send message to server [/chat/public/server] Due to the structure of **Faye**, we have to use **another** channel to transfer message from Client to Server. > **Note:** a channel must have a **single responsibility** to maintain the **stability** of the application. > > A channel will be a **publisher** or **subscriber**. #### Send message [POST] + Attributes + userId: 1441428112793 (required, string) - The unique id of the user + text: message (required, string) - Message from user + request (application/json) + response 200 ### Notify user status to the others [/chat/join] When a user join or log out, their status will be notified to the others. #### Notify user status [GET] + Attributes + text: user has joined. (required, string) - User status + response 200 (application/json)
Update API blueprint
Update API blueprint
API Blueprint
mit
hckhanh/demo-faye,hckhanh/demo-faye,hckhanh/demo-faye,hckhanh/demo-faye
0cc8eb8c02c19470b461ee975b4e3788233025e1
doc/apiary/iotagent.apib
doc/apiary/iotagent.apib
FORMAT: 1A HOST: http://idas.lab.fiware.org TITLE: FIWARE IoT Agents API DATE: December 2016 VERSION: stable APIARY_PROJECT: telefonicaiotiotagents SPEC_URL: https://telefonicaid.github.io/iotagent-node-lib/api/ GITHUB_SOURCE: https://github.com/telefonicaid/iotagent-node-lib ## Copyright Copyright (c) 2014-2016 Telefonica Investigacion y Desarrollo ## License This specification is licensed under the [FIWARE Open Specification License (implicit patent license)](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Implicit_Patents_License). # IoT Agent Provision API Documentacion An [IoT Agent](https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus) is a component that mediates between a set of Devices using their own native protocols and a NGSI compliant Context Provider (i.e. Fiware Context Broker). This documentation covers the IoT Agent Provision API and the resources you can manipulate on an IoT Agent in order to publish custom information in IoT Platform. The IoT Agent Provision API is based on REST principles. |Allowed HTTPs requests | | |:---------------------------|:----------------------------------------| |POST: |Creates a resource or list of resources | |PUT: |Updates a resource | |GET: |Retrieves a resource or list of resources| |DELETE: |Delete a resource | |Server Responses | | |:---------------------------|:--------------------------------------------------------------------------------------------------| |200 OK |The request was succesful (some API calls may return 201 instead) | |201 Created |The request was succesful and a resource or list of resources was created | |204 No Content |The request was succesful but there is no representation to return (that is, the response is empty)| |400 Bad Request |The request could not be understood or was missing required parameters | |401 Unauthorized |Authentication failed | |403 Forbidden |Access denied | |404 Not Found |Resource was not found | |409 Conflict |A resource cannot be created because it already exists | |500 Internal Server Error |Generic error when server has a malfunction. This error will be removed | Responses related with authentication and authorization depends on this feature is configured and a Keystone OpenStack sytem is present. When an error is returned, a representation is returned as: ``` { "reason": "contains why an error is returned", "details": "contains specific information about the error, if possible" } ``` ## Authentication and Authorization If the IoT Agent is in authenticated environment, this API requires a token, which you obtain from authentication system. This system and its API is out of scope of present documentation. In this environment, a mandatory header is needed: `X-Auth-Token`. ## Mandatory HTTP Headers The API needs two headers in order to manage requests: |Http Header |Level |If not present |Observations | |:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------| |<b>Fiware-Service</b> |Represents a tenant. Higher level in resources hierachy in IoT Platform |An error is returned |Must only contain less than 50 Underscores and Alphanumeric lowercase characters | |<b>Fiware-ServicePath</b> |Represents the second level |We assume '/'. Allowed operation '/*'|Must only contain less than 50 Underscores and Alphanumeric characters. Must start with character '/'. Max. length is 51 characters (with /)| ## API Access All API base URLs are relative and depend on where the IoT Agent is listening (depends on each service). For example, `http://127.0.0.1:8080/iot/`. # Configuration Group API ## Services [/services{?limit,offset,resource,apikey,device}] Configuration group for iotagents. Fields in JSON object representing a configuration group are: |Fields in JSON Object | | |:-----------------------|:------------------------------------------------------------| |`apikey` |It is a key used for devices belonging to this service. If "", service does not use apikey, but it must be specified.| |`token` |If authentication/authorization system is configured, IoT Agent works as user when it publishes information. That token allows that other components to verify the identity of IoT Agent. Depends on authentication and authorization system.| |`cbroker` |Context Broker endpoint assigned to this service, it must be a real uri.| |`outgoing_route` |It is an identifier for VPN/GRE tunnel. It is used when device is into a VPN and a command is sent.| |`resource` |Path in IoTAgent. When protocol is HTTP a device could send information to this uri. In general, it is a uri in a HTTP server needed to load and execute a module.| |`entity_type` |Entity type used in entity publication (overload default).| |`attributes` |Mapping for protocol parameters to entity attributes.<br> `object_id` (string, mandatory): protocol parameter to be mapped.<br> `name` (string, mandatory): attribute name to publish.<br> `type`: (string, mandatory): attribute type to publish.| |`static_attributes` |Attributes published as defined.<br> `name` (string, mandatory): attribute name to publish.<br> `type` (string, mandatory): attribute type to publish.<br> `value` (string, mandatory): attribute value to publish.| | `timestamp`. |(optional, boolean): This field indicates if an attribute 'TimeInstant' will be added (true) or not (false). If this field is omitted, the global IotAgent configuration timestamp will be used.| | `autoprovision`. |(optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false.| Mandatory fields are identified in every operation. `static_attributes` and `attributes` are used if device has not this information. ### Retrieve a configuration group [GET] Retrieve a configuration group. + Parameters [limit, offset, resource] + `limit` (optional, number). In order to specify the maximum number of services (default is 20, maximun allowed is 1000). + `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) . + `resource` (optional, string). URI for the iotagent, return only services for this iotagent. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /* + Response 200 + Body { "count": 1, "services": [ { "apikey": "apikey3", "service": "service2", "service_path": "/srvpath2", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 200 + Body { "count": 1, "services": [ { "apikey": "apikey3", "service": "service2", "service_path": "/srvpath2", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } ### Create a configuration group [POST] Create a new configuration group. From service model, mandatory fields are: apikey, resource (cbroker field is temporary mandatory). + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "services": [ { "apikey": "apikey3", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } + Response 201 ### Update a configuration group [PUT] If you want modify only a field, you can do it. You cannot modify an element into an array field, but whole array. ("/*" is not allowed). + Parameters [apikey, resource] + `apikey` (optional, string). If you don't specify, apikey=" " is applied. + `resource` (mandatory, string). URI for service into iotagent. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "entity_type": "entity_type" } + Response 204 ### Remove a configuration group [DELETE] Remove a configuration group. + Parameters [apikey, resource, device] + `apikey` (optional, string). If you don't specify, apikey="" is applied. + `resource` (mandatory, string). URI for service into iotagent. + `device` (optional, boolean). Default value is false. Remove devices in service/subservice. This parameter is not valid when Fiware-ServicePath is '/*' or '/#'. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 204 ## Devices [/devices{?limit,offset,detailed,protocol,entity}] A device is a resource that publish information to IoT Platform and it uses the IoT Agent. ### Device Model - `device_id`. Unique identifier into a service. - `protocol`. Protocol assigned to device. This field is easily provided by IoTA Manager if it is used. Every module implmenting a protocol has an identifier. - `entity_name`. Entity name used for entity publication (overload default) - `entity_type`. Entity type used for entity publication (overload entity_type defined in service). - `timezone`. Used to automatically generate timestamps attributes for the entity publication. - `attributes`. Mapping for protocol parameters to entity attributes. `object_id` (string, mandatory): protocol parameter to be mapped. `name` (string, mandatory): attribute name to publish. `type`: (string, mandatory): attribute type to publish. - `static_attributes` (optional, array). Attributes published as defined. `name` (string, mandatory): attribute name to publish. `type` (string, mandatory): attribute type to publish. `value` (string, mandatory): attribute value to publish. - `endpoint` (optional, string): when a device uses push commands. - `commands` (optional, array). Attributes working as commands. `name` (string, mandatory): command identifier. `type` (string, mandatory). It must be 'command'. `value` (string, mandatory): command representation depends on protocol. - `timestamp`. (optional, boolean): This field indicates if an attribute 'TimeInstant' will be added (true) or not (false). If this field is omitted, the global IotAgent configuration timestamp will be used. - `autoprovision`. (optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false. Mandatory fields are identified in every operation. ### Retrieve all devices [GET] + Parameters [limit, offset, detailed, entity, protocol] + `limit` (optional, number). In order to specify the maximum number of devices (default is 20, maximun allowed is 1000). + `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) . + `detailed` (optional, string). `on` return all device information, `off` (default) return only name. + `entity` (optional, string). It allows get a device from entity name. + `protocol` (optional, string). It allows get devices with this protocol. + Request (application/json) + Headers Fiware-Service: testService Fiware-ServicePath: /TestSubservice + Response 200 + Body { "count": 1, "devices": [ { "device_id": "device_id", "protocol": "12345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ] } ### Create a device [POST] From device model, mandatory fields are: device_id and protocol. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "devices": [ { "device_id": "device_id", "protocol": "12345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ] } + Response 201 + Headers (only if ONE device is in request) Location: /iot/devices/device_id + Response 400 { "reason": "parameter limit must be an integer" } + Response 404 ## Device [/devices/{device_id}] ### Retrieve a device [GET] + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 200 + Body { "device_id": "device_id", "protocol": "121345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ### Update a device [PUT] If you want modify only a field, you can do it, except field `protocol` (this field, if provided it is removed from request). + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "entity_name": "entity_name" } + Response 204 ### Remove a device [DELETE] If specific device is not found, we work as deleted. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 204
FORMAT: 1A HOST: http://idas.lab.fiware.org TITLE: FIWARE IoT Agents API DATE: December 2016 VERSION: stable APIARY_PROJECT: telefonicaiotiotagents SPEC_URL: https://telefonicaid.github.io/iotagent-node-lib/api/ GITHUB_SOURCE: https://github.com/telefonicaid/iotagent-node-lib ## Copyright Copyright (c) 2014-2016 Telefonica Investigacion y Desarrollo ## License This specification is licensed under the [FIWARE Open Specification License (implicit patent license)](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Implicit_Patents_License). # IoT Agent Provision API Documentacion An [IoT Agent](https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus) is a component that mediates between a set of Devices using their own native protocols and a NGSI compliant Context Provider (i.e. Fiware Context Broker). This documentation covers the IoT Agent Provision API and the resources you can manipulate on an IoT Agent in order to publish custom information in IoT Platform. The IoT Agent Provision API is based on REST principles. |Allowed HTTPs requests | | |:---------------------------|:----------------------------------------| |POST: |Creates a resource or list of resources | |PUT: |Updates a resource | |GET: |Retrieves a resource or list of resources| |DELETE: |Delete a resource | |Server Responses | | |:---------------------------|:--------------------------------------------------------------------------------------------------| |200 OK |The request was succesful (some API calls may return 201 instead) | |201 Created |The request was succesful and a resource or list of resources was created | |204 No Content |The request was succesful but there is no representation to return (that is, the response is empty)| |400 Bad Request |The request could not be understood or was missing required parameters | |401 Unauthorized |Authentication failed | |403 Forbidden |Access denied | |404 Not Found |Resource was not found | |409 Conflict |A resource cannot be created because it already exists | |500 Internal Server Error |Generic error when server has a malfunction. This error will be removed | Responses related with authentication and authorization depends on this feature is configured and a Keystone OpenStack sytem is present. When an error is returned, a representation is returned as: ``` { "reason": "contains why an error is returned", "details": "contains specific information about the error, if possible" } ``` ## Authentication and Authorization If the IoT Agent is in authenticated environment, this API requires a token, which you obtain from authentication system. This system and its API is out of scope of present documentation. In this environment, a mandatory header is needed: `X-Auth-Token`. ## Mandatory HTTP Headers The API needs two headers in order to manage requests: |Http Header |Level |If not present |Observations | |:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------| |<b>Fiware-Service</b> |Represents a tenant. Higher level in resources hierachy in IoT Platform |An error is returned |Must only contain less than 50 Underscores and Alphanumeric lowercase characters | |<b>Fiware-ServicePath</b> |Represents the second level |We assume '/'. Allowed operation '/*'|Must only contain less than 50 Underscores and Alphanumeric characters. Must start with character '/'. Max. length is 51 characters (with /)| ## API Access All API base URLs are relative and depend on where the IoT Agent is listening (depends on each service). For example, `http://127.0.0.1:8080/iot/`. # Configuration Group API ## Services [/services{?limit,offset,resource,apikey,device}] Configuration group for iotagents. Fields in JSON object representing a configuration group are: |Fields in JSON Object | | |:-----------------------|:------------------------------------------------------------| |`apikey` |It is a key used for devices belonging to this service. If "", service does not use apikey, but it must be specified.| |`token` |If authentication/authorization system is configured, IoT Agent works as user when it publishes information. That token allows that other components to verify the identity of IoT Agent. Depends on authentication and authorization system.| |`cbroker` |Context Broker endpoint assigned to this service, it must be a real uri.| |`outgoing_route` |It is an identifier for VPN/GRE tunnel. It is used when device is into a VPN and a command is sent.| |`resource` |Path in IoTAgent. When protocol is HTTP a device could send information to this uri. In general, it is a uri in a HTTP server needed to load and execute a module.| |`entity_type` |Entity type used in entity publication (overload default).| |`attributes` |Mapping for protocol parameters to entity attributes.<br> `object_id` (string, mandatory): protocol parameter to be mapped.<br> `name` (string, mandatory): attribute name to publish.<br> `type`: (string, mandatory): attribute type to publish.| |`static_attributes` |Attributes published as defined.<br> `name` (string, mandatory): attribute name to publish.<br> `type` (string, mandatory): attribute type to publish.<br> `value` (string, mandatory): attribute value to publish.| | `timestamp`. |(optional, boolean): This field indicates if an attribute 'TimeInstant' will be added (true) or not (false). If this field is omitted, the global IotAgent configuration timestamp will be used.| | `autoprovision`. |(optional, boolean): This field idicates if appendMode will be APPEND if true (as default in iotAgent configuration appendMode) of UPDATE if false.| Mandatory fields are identified in every operation. `static_attributes` and `attributes` are used if device has not this information. ### Retrieve a configuration group [GET] Retrieve a configuration group. + Parameters [limit, offset, resource] + `limit` (optional, number). In order to specify the maximum number of services (default is 20, maximun allowed is 1000). + `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) . + `resource` (optional, string). URI for the iotagent, return only services for this iotagent. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /* + Response 200 + Body { "count": 1, "services": [ { "apikey": "apikey3", "service": "service2", "service_path": "/srvpath2", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 200 + Body { "count": 1, "services": [ { "apikey": "apikey3", "service": "service2", "service_path": "/srvpath2", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } ### Create a configuration group [POST] Create a new configuration group. From service model, mandatory fields are: apikey, resource (cbroker field is temporary mandatory). + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "services": [ { "apikey": "apikey3", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } + Response 201 ### Update a configuration group [PUT] If you want modify only a field, you can do it. You cannot modify an element into an array field, but whole array. ("/*" is not allowed). + Parameters [apikey, resource] + `apikey` (optional, string). If you don't specify, apikey=" " is applied. + `resource` (mandatory, string). URI for service into iotagent. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "entity_type": "entity_type" } + Response 204 ### Remove a configuration group [DELETE] Remove a configuration group. + Parameters [apikey, resource, device] + `apikey` (optional, string). If you don't specify, apikey="" is applied. + `resource` (mandatory, string). URI for service into iotagent. + `device` (optional, boolean). Default value is false. Remove devices in service/subservice. This parameter is not valid when Fiware-ServicePath is '/*' or '/#'. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 204 ## Devices [/devices{?limit,offset,detailed,protocol,entity}] A device is a resource that publish information to IoT Platform and it uses the IoT Agent. ### Device Model - `device_id`. Unique identifier into a service. - `protocol`. Protocol assigned to device. This field is easily provided by IoTA Manager if it is used. Every module implmenting a protocol has an identifier. - `entity_name`. Entity name used for entity publication (overload default) - `entity_type`. Entity type used for entity publication (overload entity_type defined in service). - `timezone`. Used to automatically generate timestamps attributes for the entity publication. - `attributes`. Mapping for protocol parameters to entity attributes. `object_id` (string, mandatory): protocol parameter to be mapped. `name` (string, mandatory): attribute name to publish. `type`: (string, mandatory): attribute type to publish. - `static_attributes` (optional, array). Attributes published as defined. `name` (string, mandatory): attribute name to publish. `type` (string, mandatory): attribute type to publish. `value` (string, mandatory): attribute value to publish. - `endpoint` (optional, string): when a device uses push commands. - `commands` (optional, array). Attributes working as commands. `name` (string, mandatory): command identifier. `type` (string, mandatory). It must be 'command'. `value` (string, mandatory): command representation depends on protocol. - `timestamp`. (optional, boolean): This field indicates if an attribute 'TimeInstant' will be added (true) or not (false). If this field is omitted, the global IotAgent configuration timestamp will be used. - `autoprovision`. (optional, boolean): If true, APPEND is used upon measure arrival (thus effectively allowing autoprovisioned devices). If false, UPDATE is used open measure arrival (thus effectively avoiding autoprovisioned devices). This field is optional, so if it omitted then the global IoTAgent appendModel configuration is used. Mandatory fields are identified in every operation. ### Retrieve all devices [GET] + Parameters [limit, offset, detailed, entity, protocol] + `limit` (optional, number). In order to specify the maximum number of devices (default is 20, maximun allowed is 1000). + `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) . + `detailed` (optional, string). `on` return all device information, `off` (default) return only name. + `entity` (optional, string). It allows get a device from entity name. + `protocol` (optional, string). It allows get devices with this protocol. + Request (application/json) + Headers Fiware-Service: testService Fiware-ServicePath: /TestSubservice + Response 200 + Body { "count": 1, "devices": [ { "device_id": "device_id", "protocol": "12345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ] } ### Create a device [POST] From device model, mandatory fields are: device_id and protocol. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "devices": [ { "device_id": "device_id", "protocol": "12345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ] } + Response 201 + Headers (only if ONE device is in request) Location: /iot/devices/device_id + Response 400 { "reason": "parameter limit must be an integer" } + Response 404 ## Device [/devices/{device_id}] ### Retrieve a device [GET] + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 200 + Body { "device_id": "device_id", "protocol": "121345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ### Update a device [PUT] If you want modify only a field, you can do it, except field `protocol` (this field, if provided it is removed from request). + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "entity_name": "entity_name" } + Response 204 ### Remove a device [DELETE] If specific device is not found, we work as deleted. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 204
Update doc/apiary/iotagent.apib
Update doc/apiary/iotagent.apib Co-Authored-By: Fermín Galán Márquez <a42853be7dd7164f3322943925c40e0cb15f30bb@users.noreply.github.com>
API Blueprint
agpl-3.0
telefonicaid/iotagent-node-lib,telefonicaid/iotagent-node-lib,telefonicaid/iotagent-node-lib
16dd09c016c51e8075b3cc18d30f46e45a7f78a6
test/fixtures/multiple-examples.apib
test/fixtures/multiple-examples.apib
FORMAT: 1A # Machines API # Group Machines # Machines collection [/machines/{id}] + Parameters - id (number, `1`) ## Get Machines [GET] - Request (application/json) + Parameters - id (number, `2`) - Response 200 (application/json; charset=utf-8) [ { "type": "bulldozer", "name": "willy" } ] - Request (application/json) + Parameters - id (number, `3`) - Response 200 (application/json; charset=utf-8) [ { "type": "bulldozer", "name": "willy" } ]
FORMAT: 1A # Machines API # Group Machines # Machines collection [/machines/{id}] + Parameters + id (number, `1`) ## Get Machines [GET] + Request (application/json) + Parameters + id (number, `2`) + Response 200 (application/json; charset=utf-8) [ { "type": "bulldozer", "name": "willy" } ] + Request (application/json) + Parameters + id (number, `3`) + Response 200 (application/json; charset=utf-8) [ { "type": "bulldozer", "name": "willy" } ]
Use 4 spaces as indentation
style: Use 4 spaces as indentation
API Blueprint
mit
vladosaurus/dredd,apiaryio/dredd,vladosaurus/dredd,apiaryio/dredd,apiaryio/dredd
8d7891309eea11cd94a8f6c477b094531c44dd7a
source/composer.apib
source/composer.apib
## API Description Composer [/composer] Reverse the parsing process--compose an API description format. ### Compose [POST] The composition of API Blueprint is performed as it is provided by the [Matter Compiler](https://github.com/apiaryio/matter_compiler) tool. #### Input Media Types ##### API Elements API Elements is supported, you can send an [API Elements API Category](http://api-elements.readthedocs.io/en/latest/element-definitions/#category-base-api-element) to the composer using the `application/vnd.refract+json` content type. ##### API Blueprint AST (Deprecated) API Blueprint AST support is deprecated and support will be completely removed from the service by February 28th 2016. ``` application/vnd.apiblueprint.ast+json application/vnd.apiblueprint.ast+yaml ``` Serialized API Blueprint AST represented either in its JSON or YAML format as defined in [API Blueprint AST Serialization Media Types](https://github.com/apiaryio/api-blueprint-ast). Please keep in mind that the API Blueprint AST is soon to be deprecated in favor of the API Description Parse Result Namespace. #### Output Media Types ##### API Blueprint ``` text/vnd.apiblueprint ``` API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). + Relation: compose + Request Compose API Blueprint from API Elements API (application/vnd.refract+json) :[](fixtures/apib/normal.refract.json) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib) + Request Compose API Blueprint from AST 2.0 sent as YAML (application/vnd.apiblueprint.ast+yaml; version=2.0) :[](fixtures/apib/normal.apiblueprint.ast.yaml) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib) + Request Compose API Blueprint from AST 2.0 sent as JSON (application/vnd.apiblueprint.ast+json; version=2.0) :[](fixtures/apib/normal.apiblueprint.ast.json) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib)
## API Description Composer [/composer] Reverse the parsing process--compose an API description format. ### Compose [POST] The composition of API Blueprint is performed as it is provided by the [Matter Compiler](https://github.com/apiaryio/matter_compiler) tool. #### Input Media Types ##### API Elements API Elements is supported, you can send an [API Elements API Category](http://api-elements.readthedocs.io/en/latest/element-definitions/#category-base-api-element) to the composer using the `application/vnd.refract+json` content type. You may also send an [API Elements Parse Result](http://api-elements.readthedocs.io/en/latest/element-definitions/#parse-result-elements) as `application/vnd.refract.parse-result+json`. ``` application/vnd.refract+json application/vnd.refract.parse-result+json ``` ##### API Blueprint AST (Deprecated) API Blueprint AST support is deprecated and support will be completely removed from the service by February 28th 2016. ``` application/vnd.apiblueprint.ast+json application/vnd.apiblueprint.ast+yaml ``` Serialized API Blueprint AST represented either in its JSON or YAML format as defined in [API Blueprint AST Serialization Media Types](https://github.com/apiaryio/api-blueprint-ast). Please keep in mind that the API Blueprint AST is soon to be deprecated in favor of the API Description Parse Result Namespace. #### Output Media Types ##### API Blueprint ``` text/vnd.apiblueprint ``` API Blueprint as defined in its [specification](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). + Relation: compose + Request Compose API Blueprint from API Elements API (application/vnd.refract+json) :[](fixtures/apib/normal.refract.json) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib) + Request Compose API Blueprint from API Elements Parse Result (application/vnd.refract.parse-result+json) :[](fixtures/apib/normal.refract.parse-result.json) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib) + Request Compose API Blueprint from AST 2.0 sent as YAML (application/vnd.apiblueprint.ast+yaml; version=2.0) :[](fixtures/apib/normal.apiblueprint.ast.yaml) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib) + Request Compose API Blueprint from AST 2.0 sent as JSON (application/vnd.apiblueprint.ast+json; version=2.0) :[](fixtures/apib/normal.apiblueprint.ast.json) + Response 200 (text/vnd.apiblueprint) :[](fixtures/apib/normal.apib)
Support API Elements Parse Result
feat(composer): Support API Elements Parse Result
API Blueprint
mit
apiaryio/api.apiblueprint.org,apiaryio/api.apiblueprint.org
4f1706a5adbf11becda02837fb9e07ced9279f4b
apiary.apib
apiary.apib
HOST: http://portal.vn.teslamotors.com --- Tesla Model S REST API --- --- This is unofficial documentation of the Tesla Model S REST API used by the iOS and Android apps. It features functionality to monitor and control the Model S remotely. --- -- Authentication Flow These endpoints handle login and session management -- Returns the login form. Sets a *_s_portal_session* cookie for the session GET /login < 200 < Set-Cookie: _s_portal_session={cookie}; path=/; secure; HttpOnly { } Performs the login. Takes in an plain text email and password, matching the owner's login from http://teslamotors.com/mytesla. Note that the JSON data here is just to fit in Apiary's format, but those should be POST variables. Sets a *user_credentials* cookie that expires in 3 months, which is passed along with all future requests to authenticate the user. 302 redirects back to a dummy welcome page. This page is ignored by the smartphone app and can be ignored by your API client. POST /login { "user_session[email]": "string", "user_session[password]": "string" } < 302 < Set-Cookie: _s_portal_session={cookie}; path=/; secure; HttpOnly < Set-Cookie: user_credentials=x; path=/; expires=Fri, 03-May-2013 03:01:54 GMT; secure; HttpOnly < Location: https://portal.vn.teslamotors.com/ { } -- Vehicle Resource A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them. Must have a *_s_portal_session* and *user_credentials* cookie set for all requests. -- Retrieve a list of your owned vehicles (includes vehicles not yet shipped!) GET /vehicles < 200 < Content-Type: application/json { } -- Vehicle Status Resources These resources are read-only and determine the state of the vehicle's various sub-systems. Must have a *_s_portal_session* and *user_credentials* cookie set for all requests. -- Determines if mobile access to the vehicle is enabled. GET /vehicles/{id}/mobile_enabled < 200 < Content-Type: application/json { } Returns the state of charge in the battery. GET /vehicles/{id}/command/charge_state < 200 < Content-Type: application/json { } Returns the current temperature and climate control state. GET /vehicles/{id}/command/climate_state < 200 < Content-Type: application/json { } Returns the vehicle's physical state, such as which doors doors open. GET /vehicles/{id}/command/vehicle_state < 200 < Content-Type: application/json { } Returns the driving state of the vehicle. GET /vehicles/{id}/command/drive_state < 200 < Content-Type: application/json { } Returns various information about the car for the GUI of the smartphone application, such as vehicle color or wheel trim. GET /vehicles/{id}/command/gui_settings < 200 < Content-Type: application/json { }
HOST: http://portal.vn.teslamotors.com --- Tesla Model S REST API --- --- This is unofficial documentation of the Tesla Model S REST API used by the iOS and Android apps. It features functionality to monitor and control the Model S remotely. --- -- Authentication Flow These endpoints handle login and session management -- Returns the login form. Sets a *_s_portal_session* cookie for the session GET /login < 200 < Set-Cookie: _s_portal_session={cookie}; path=/; secure; HttpOnly { } Performs the login. Takes in an plain text email and password, matching the owner's login from http://teslamotors.com/mytesla. Note that the JSON data here is just to fit in Apiary's format, but those should be POST variables. Sets a *user_credentials* cookie that expires in 3 months, which is passed along with all future requests to authenticate the user. 302 redirects back to a dummy welcome page. This page is ignored by the smartphone app and can be ignored by your API client. POST /login { "user_session[email]": "string", "user_session[password]": "string" } < 302 < Set-Cookie: _s_portal_session={cookie}; path=/; secure; HttpOnly < Set-Cookie: user_credentials=x; path=/; expires=Fri, 03-May-2013 03:01:54 GMT; secure; HttpOnly < Location: https://portal.vn.teslamotors.com/ { } -- Vehicle Resource A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them. Must have a *_s_portal_session* and *user_credentials* cookie set for all requests. -- Retrieve a list of your owned vehicles (includes vehicles not yet shipped!) GET /vehicles < 200 < Content-Type: application/json { } -- Vehicle Status Resources These resources are read-only and determine the state of the vehicle's various sub-systems. Must have a *_s_portal_session* and *user_credentials* cookie set for all requests. -- Determines if mobile access to the vehicle is enabled. GET /vehicles/{id}/mobile_enabled < 200 < Content-Type: application/json { "reason":"", "result":true } Returns the state of charge in the battery. GET /vehicles/{id}/command/charge_state < 200 < Content-Type: application/json { "charging_state": "Complete", "charge_to_max_range": false, "max_range_charge_counter": 0, "fast_charger_present": false, "battery_range": 239.02, "est_battery_range": 155.79, "ideal_battery_range": 275.09, "battery_level": 91, "battery_current": 0.0, "charge_starting_range": null, "charge_starting_soc": null, "charger_voltage": 0, "charger_pilot_current": 40, "charger_actual_current": 0, "charger_power": 0, "time_to_full_charge": 0.0, "charge_rate": -1.0, "charge_port_door_open": true } Returns the current temperature and climate control state. GET /vehicles/{id}/command/climate_state < 200 < Content-Type: application/json { "inside_temp": null, "outside_temp": null, "driver_temp_setting": 22.6, "passenger_temp_setting": 22.6, "is_auto_conditioning_on": null, "is_front_defroster_on": null, "is_rear_defroster_on": false, "fan_status": null } Returns the driving and position state of the vehicle. GET /vehicles/{id}/command/drive_state < 200 < Content-Type: application/json { "shift_state": null, "speed": null, "latitude": 33.794839, "longitude": -84.401593, "heading": 4, "gps_as_of": 1359863204 } Returns various information about the GUI settings of the car, such as unit format and range display. GET /vehicles/{id}/command/gui_settings < 200 < Content-Type: application/json { "gui_distance_units": "mi/hr", "gui_temperature_units": "F", "gui_charge_rate_units": "mi/hr", "gui_24_hour_time": false, "gui_range_display": "Rated" } Returns the vehicle's physical state, such as which doors are open. GET /vehicles/{id}/command/vehicle_state < 200 < Content-Type: application/json { "df": false, "dr": false, "pf": false, "pr": false, "ft": false, "rt": false, "car_version": "1.19.42", "locked": true, "sun_roof_installed": true, "sun_roof_state": "unknown", "sun_roof_percent_open": 0, "dark_rims": false, "wheel_type": "Base19", "has_spoiler": false, "roof_color": "None", "perf_config": "Base" }
Add response information for various state endpoints.
Add response information for various state endpoints.
API Blueprint
mit
myappleguy/model-s-api,Taurm/model-s-api,timdorr/model-s-api,jakubsuchybio/model-s-api
e099321243a78205f552b61470446f0a44b54c55
apiary.apib
apiary.apib
HOST: http://dcp.jboss.org/v1 --- Distributed Contribution Platform API v1 --- --- # Overview **Distributed Contribution Platform** provides **Rest API** for data manipulation and search. # DCP Content object This is main content object which can be pushed/retrieved or searched. DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure. However this document is during push to DCP and reindex normalized and internal DCP data are added. Those data are prefixed by dcp_. DCP Content described by example: { Free JSON Structure repsesenting content. Can be one key value pair or something more structured. It's defined only by source provider. "tags": ["Content tag1", "tag2", "tag2"], "dcp_content_id": "Any value from content provider", "dcp_content_typev: "Source provider type like 'issue'" "dcp_content_provider": "Name of content provider like JIRA River" "dcp_id": "internal_id" "dcp_title": "Content Title" "dcp_url_view": "URL representing content view" "dcp_description": "Short description used by search GUI" "dcp_type": "Normalized internal type of content" "dcp_updated": "Timestamp of last update" "dcp_project": "Normalized internal project" "dcp_contributors": ["Firstname Lastname <e-mail>", "Firstname Lastname <e-mail>"] "dcp_activity_dates": [Timestamp1, Timestamp2] "dcp_tags": ["Tags constructed from 'tags' tag and user tags from persistance storage"] } All DCP Internal data are set during push and reindex except these which can be defined during data push: * `dcp_title` * `dcp_url_view` * `dcp_description` --- -- Authentication Distinct operations needs to be authenticated. Content provider provides credintials by URL parameters provider and password or via standard HTTP Basic authentication. If authentication is not successfull then standard forbidden http code is returned. -- -- Content -- Return Document JSON data GET /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } All content for specified type. GET /rest/content/{type} < 200 < Content-Type: application/json { "total": "count of returned values", "hits": [ { "id": "internal dcp id of document" "data": "document content" } ] } JSON document in http body which is pushed to DCP. Http body empty POST /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } Document deleted DELETE /rest/content/{type}/{id} < 200 -- Search -- Search contributions. GET /rest/search?TODO < 200 { "foo": "bar" } -- Search Suggestions -- Get suggestions for user query. Returned JSON contains two parts: - `view` - `model` #### view tbd #### model tbd GET /rest/suggestions/query_string?q={user_query_string} < 200 { "view": { "search": { "caption": "Search", "options": ["${query_string}"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ {}, {}, {} ] } } Example for user query 'Hiberna'. GET /rest/suggestions/query_string?q=Hiberna < 200 { "view": { "search": { "caption": "Search", "options": ["Hiberna"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "Hiberna" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ {}, {}, {} ] } }
HOST: http://dcp.jboss.org/v1 --- Distributed Contribution Platform API v1 --- --- # Overview **Distributed Contribution Platform** provides **Rest API** for data manipulation and search. # DCP Content object This is main content object which can be pushed/retrieved or searched. DCP Content object is JSON document with free structure. There is no restriction how many key value pairs must be defined or in which structure. However this document is during push to DCP and reindex normalized and internal DCP data are added. Those data are prefixed by dcp_. DCP Content described by example: { Free JSON Structure repsesenting content. Can be one key value pair or something more structured. It's defined only by source provider. "tags": ["Content tag1", "tag2", "tag2"], "dcp_content_id": "Any value from content provider", "dcp_content_typev: "Source provider type like 'issue'" "dcp_content_provider": "Name of content provider like JIRA River" "dcp_id": "internal_id" "dcp_title": "Content Title" "dcp_url_view": "URL representing content view" "dcp_description": "Short description used by search GUI" "dcp_type": "Normalized internal type of content" "dcp_updated": "Timestamp of last update" "dcp_project": "Normalized internal project" "dcp_contributors": ["Firstname Lastname <e-mail>", "Firstname Lastname <e-mail>"] "dcp_activity_dates": [Timestamp1, Timestamp2] "dcp_tags": ["Tags constructed from 'tags' tag and user tags from persistance storage"] } All DCP Internal data are set during push and reindex except these which can be defined during data push: * `dcp_title` * `dcp_url_view` * `dcp_description` --- -- Authentication Distinct operations needs to be authenticated. Content provider provides credintials by URL parameters provider and password or via standard HTTP Basic authentication. If authentication is not successfull then standard forbidden http code is returned. -- -- Content -- Return Document JSON data GET /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } All content for specified type. GET /rest/content/{type} < 200 < Content-Type: application/json { "total": "count of returned values", "hits": [ { "id": "internal dcp id of document" "data": "document content" } ] } JSON document in http body which is pushed to DCP. Http body empty POST /rest/content/{type}/{id} < 200 < Content-Type: application/json { "foo": "bar" } Document deleted DELETE /rest/content/{type}/{id} < 200 -- Search -- Search contributions. GET /rest/search?TODO < 200 { "foo": "bar" } -- Suggestions -- Get suggestions for user query. Returned JSON contains two parts: - `view` - `model` #### view The `view` represents the visual part of query suggestions. It *always* contains section `search` which will *always* have only one option matching incoming user query. It can then contain one or more additional sections (like `suggestions`, `filters`, `mails`, ... etc.). #### model The `model` represents possible "actions" that are relevant to individual `option`s in the `view` part. This means both `view` and `model` parts have the same highlevel structure and each `option` in the `view` part have corresponding "action" in the `model` part. Individual actions are described using symbolic commands. Interpretation of these commands is up to the client the following is just a recommendation about how client can interpret the commands: ##### Commands: `search` - execute search for `query` value. `suggestion` - replace text in the search field with the `value`'s value. `filter` - replace current filters with provided filters. `filter_add` - enable provided filters (on top of currently active filters). ... more TDB. GET /rest/suggestions/query_string?q={user_query_string} < 200 { "view": { "search": { "caption": "Search", "options": ["${query_string}"] }, "suggestions": { "caption": "Query Completions", "options": [ "option #1", "option #2", "..." ] }, "filters": { "caption": "Filters", "options": [ "option #1", "option #2", "..." ] }, "mails": { "caption": "Mails", "options": [ "option #1", "option #2", "..." ] } }, "model" : { "search": { "search": { "query": "${query_string}" } }, "suggestions" : [ { "action #1" }, { "action #2" }, { "..." } ], "filters": [ { "action #1" }, { "action #2" }, { "..." } ], "mails": [ { "action #1" }, { "action #2" }, { "..." } ] } } Example for user query 'Hiberna'. GET /rest/suggestions/query_string?q=Hiberna < 200 { "view": { "search": { "caption": "Search", "options": ["Hiberna"] }, "suggestions": { "caption": "Query Completions", "options": [ "<strong>Hiberna</strong>te", "<strong>Hiberna</strong>te query", "<strong>Hiberna</strong>te session" ] }, "filters": { "caption": "Filters", "options": [ "<strong>Add</strong> project filter for <strong>Hibernate</strong>", "<strong>Add</strong> project filter for <strong>Infinispan</strong>", "<strong>Search</strong> project <strong>Hibernate</strong> only" ] }, "mails": { "caption": "Mails", "options": [ "<strong>Add</strong> some Mails filter", "Do some other fancy thing here", "Or do something else" ] } }, "model" : { "search": { "search": { "query": "Hiberna" } }, "suggestions" : [ { "suggestion": { "value": "Hibernate" }, "search": { "query": "Hibernate" } }, { "suggestion": { "value": "Hibernate query" }, "search": { "query": "Hibernate query" } }, { "suggestion": { "value": "Hibernate session" }, "search": { "query": "Hibernate session" } } ], "filters": [ { "filter_add": [ "Hibernate" ] }, { "filter_add": [ "Infinispan" ] }, { "filter": [ "Hibernate" ] } ], "mails": [ { "filter_add": [ "foo" ] }, {}, {} ] } }
Add more docs for Suggestions
Add more docs for Suggestions
API Blueprint
apache-2.0
ollyjshaw/searchisko,searchisko/searchisko,ollyjshaw/searchisko,searchisko/searchisko,ollyjshaw/searchisko,searchisko/searchisko
ff6fb99a52c49be19a59255b706a6ec57b37f530
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://www.goggles.org # Goggles API Goggles API involves miscellaneous server-side actions for score and statistics computation of [http://steveoro.github.io/goggles]. Some of the actions may require authentication. # Goggles Front-End ## Exercise list or single row [/exercises/json_list{/exercise_id}{?training_step_type_id}{&limit}{&query}] ### Retrieve exercise details or list exercises based on "training step type" [GET] Retrieves Exercise data. Currently this resource works only via AJAX request, behind user authentication. Future versions will introduce OAuth/Facebook/Google+ user authorization. + Parameters - exercise_id(optional) Filter bypass to retrieve a single Exercise instance. Whem present, all other parameters are ignored. - training_step_type_id(optional) When present, it is used as a filtering parameter for the result data set. - limit(optional) Used to limit the array of results; the default top limit is set to 1000 for performance reasons (but it can be overridden by this parameter). - query(optional) A string match for the verbose description; when equal to '%', the parameter is ignored. + Response 200 (application/json) [{ "label": "localized short description of the exercise", "value": row.id, "tot_distance": row.compute_total_distance(), "tot_secs": row.compute_total_seconds(), "is_arm_aux_allowed": row.is_arm_aux_allowed(), "is_kick_aux_allowed": row.is_kick_aux_allowed(), "is_body_aux_allowed": row.is_body_aux_allowed(), "is_breath_aux_allowed": row.is_breath_aux_allowed() }, { ... }] ## Team attended Meetings [/teams/count_meetings{id}] ### Get a Team's total number of attended meetings [GET] Computes and returns the total number of meetings in which a Team has at least an individual result. Returns 0 in case of error or when no results are found. + Parameters - id The team_id + Response 200 (application/json) {10} ## Team total Results [/teams/count_results{id}] ### Get a Team's total number of results [GET] Computes and returns the total number of individual and relay results found for a specified Team. Returns 0 in case of error or when no results are found. + Parameters - id The team_id + Response 200 (application/json) {10} ## Team computed details [/teams/count_details{id}] ### Get both Team's total number of attended meetings and its total number of results [GET] Combines both methods above to return a localized & composed string rendered as JSON text. Returns an empty text in case of error. + Parameters - id The team_id + Response 200 (application/json) {"Total attended meetings: 256, Total results: 2478"}
FORMAT: 1A HOST: http://www.goggles.org # Goggles API Goggles API involves miscellaneous server-side actions for score and statistics computation of [http://steveoro.github.io/goggles]. Some of the actions may require authentication. # Goggles Front-End ## Exercise list or single row [/exercises/json_list{/exercise_id}{?training_step_type_id}{&limit}{&query}] ### Retrieve exercise details or list exercises based on "training step type" [GET] Retrieves Exercise data. Currently this resource works only via AJAX request, behind user authentication. Future versions will introduce OAuth/Facebook/Google+ user authorization. + Parameters - exercise_id(optional) Filter bypass to retrieve a single Exercise instance. Whem present, all other parameters are ignored. - training_step_type_id(optional) When present, it is used as a filtering parameter for the result data set. - limit(optional) Used to limit the array of results; the default top limit is set to 1000 for performance reasons (but it can be overridden by this parameter). - query(optional) A string match for the verbose description; when equal to '%', the parameter is ignored. + Response 200 (application/json) [{ "label": "localized short description of the exercise", "value": row.id, "tot_distance": row.compute_total_distance(), "tot_secs": row.compute_total_seconds(), "is_arm_aux_allowed": row.is_arm_aux_allowed(), "is_kick_aux_allowed": row.is_kick_aux_allowed(), "is_body_aux_allowed": row.is_body_aux_allowed(), "is_breath_aux_allowed": row.is_breath_aux_allowed() }, { ... }] ## Team attended Meetings [/teams/count_meetings{id}] ### Get a Team's total number of attended meetings [GET] Computes and returns the total number of meetings in which a Team has at least an individual result. Returns 0 in case of error or when no results are found. + Parameters - id The team_id + Response 200 (application/json) {10} ## Team total Results [/teams/count_results{id}] ### Get a Team's total number of attended meetings [GET] Computes and returns the total number of individual and relay results found for a specified Team. Returns 0 in case of error or when no results are found. + Parameters - id The team_id + Response 200 (application/json) {10} ## Team computed details [/teams/count_details{id}] ### Get both Team's total number of attended meetings and its total number of results [GET] Combines both methods above to return a localized & composed string rendered as JSON text. Returns an empty text in case of error. + Parameters - id The team_id + Response 200 (application/json) {"Total attended meetings: 256, Total results: 2478"}
Revert "updated team/count_results description; transferring blueprint from apiary.io"
Revert "updated team/count_results description; transferring blueprint from apiary.io" This reverts commit 68b23ab87bf70032b52b209537cb95c6e026de66.
API Blueprint
mit
steveoro/goggles,steveoro/goggles,steveoro/goggles,steveoro/goggles
e3bf046ed114424fa49e736e38b52be97afca244
apiary.apib
apiary.apib
FORMAT: 1A # Organising, Swiftly _Organising_ is an outliner/todo list with strong search functionality. ## Node Collection [/nodes] ### Root node and all children [GET] Returns the root node, with all of its children. + Response 200 (application/json) { "ID": 0, "text": "Update repo", "completed": false, "children": [ { "ID": 1, "text": "Commit changes", "completed": true }, { "ID": 2, "text": "Push to origin", "completed": false } ] }
FORMAT: 1A # Organising, Swiftly _Organising_ is an outliner/todo list with strong search functionality. ## Node Collection [/nodes] ### Root node and all children [GET] Returns the root node, with all of its children. + Response 200 (application/json) { "ID": 0, "text": "Update repo", "completed": false, "children": [ { "ID": 1, "text": "Commit changes", "completed": true }, { "ID": 2, "text": "Push to origin", "completed": false } ] }
Correct API definition semantic issues.
Correct API definition semantic issues.
API Blueprint
mit
CheshireSwift/organising-swiftly,CheshireSwift/organising-swiftly
4766f642fb1d6ecdd0a664c08e4545a37714f43a
blueprint/api.apib
blueprint/api.apib
FORMAT: 1A HOST: https://api.thegrid.io/ # The Grid API # Group Long-running jobs Several actions in the API takes a significant time. Current examples include POST /share, /publish and /unpublish. Performing such an action returns a Location header with a Job URL. ## Job details [/job/{id}] ### Retriving job details [GET] + Parameters + id (required, string) - Job UUID + Response 200 (application/json) + Body ``` <!-- include(examples/job-share-completed.json) --> ``` ## Jobs [/job] ### Listing current jobs [GET] + Response 200 (application/json) + Body ``` [ <!-- include(examples/job-share-completed.json) --> ] ``` # Group Site Management ## Site information [/site] ### List user websites [GET] + Response 200 (application/json) + Body ``` [ <!-- include(examples/site-minimal.json) --> ] ``` ### Create a website [POST] + Request (application/json) **Note:** the repository must be in `the-domains` organization. The repository name can later be used for sharing content to the newly-created site. + Body ``` <!-- include(examples/site-without-owner.json) --> ``` + Schema ``` <!-- include(full-schema/site.json) --> ``` + Response 201 Site was successfully created + Headers Location: /site/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 422 Missing site information + Body ## User website [/site/{id}] + Parameters + id (required, string) - Site UUID ### Get website details [GET] + Response 200 (application/json) + Schema ``` <!-- include(full-schema/site.json) --> ``` ### Update website details [PUT] + Request (application/json) + Body ``` <!-- include(examples/site-with-config.json) --> ``` + Schema ``` <!-- include(full-schema/site.json) --> ``` + Response 200 (application/json) + Schema ``` <!-- include(full-schema/site.json) --> ``` ### Delete website [DELETE] + Response 200 ## Site logos [/site/{id}/logo] ### Set website logo [POST] + Request (multipart/form-data) A logo can be provided for a website by uploading it as multipart/form-data. Only SVG logos are supported. + Response 202 Logo was successfully updated ## Website discovery [/site/discover{?url}] ### Match URL to a website [GET] + Parameters + url (required, string) - URL of the website + Response 302 + Headers Location: /site/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 404 No Grid site was found for the URL + Body # Group Content Management ## Share [/share] ### Sharing content [POST] Users can share content to The Grid. The shared items will be normalized, analyzed and made available via the item API. Sharing creates a Job, whos progress can be monitored using the /job API. There are typically three different things you can be sharing: * Full article pages: share with URL * HTML fragments: selection or img tag. Share with content, type text/html and with the URL of the originating page * Uploaded files: image, word document, HTML file, Markdown file, etc. Share with multi-part upload, URL and MIME type needed Note that publishing an item to a website is a separate step. See /publish + Request with JSON payload (application/json) + Body ``` <!-- include(examples/share-url-only.json) --> ``` + Schema ``` <!-- include(full-schema/share.json) --> ``` + Request with file upload (multipart/form-data) For images and other files the content is a file sent via multipart/form-data. If there is no relevant URL for the content, it is a good idea to generate a UUID URI. ``` formData = new FormData() formData.append 'url', 'content://' formData.append 'type', file.type formData.append 'content', file ``` + Body + Response 202 Sharing was successful and will be processed. + Headers Location: /job/b8838e11-1d97-4799-85d8-1aafec52e927 + Body + Response 422 Missing required parameters + Body + Response 403 Not allowed to share to the specified website + Body ## Random content [/share/random{?category,number}] ### Retrieve some pre-populated random content [GET] + Parameters + category (string) - Content category, for example `technology` + number (number) - How many items to retrieve + Response 200 (application/json) ## Items list [/item{?published,minimal,offset,limit,site,measurements}] ### Retrieve user's content items [GET] + Parameters + published (boolean) - Whether to get published or unpublished items only + minimal (boolean) - Whether to receive items without measurements applied (deprecated) + offset (number) - Offset to use for pagination + limit (number) - Limit to use for pagination + site (string) - Receive only items associated with a site + measurements (string) - Selectively get only certain measurements When an item is being worked on by a user it is available via the API. Queries without selective measurements must be paginated. When using pagination, the `limit` must be smaller than 50. + Response 200 (application/json) ### Create an item [POST] + Response 201 + Headers Location: /item/b8838e11-1d97-4799-85d8-1aafec52e927 + Response 422 Missing item information + Body ## Item [/item/{id,?measurements}] + Parameters + id (required, string) - Item UUID + measurements (string) - Selectively get only certain measurements ### Retrieve an item [GET] + Response 200 (application/json) + Schema ``` <!-- include(full-schema/item.json) --> ``` + Response 404 ### Update item [PUT] + Response 200 (application/json) + Schema ``` <!-- include(full-schema/item.json) --> ``` + Response 422 Missing item information + Body ### Update item metadata [PATCH] + Response 204 + Response 422 Missing item information + Body ### Remove item [DELETE] + Response 200 ## Publishing [/publish] ### Publish a items to a site [POST] TODO: make return a Job id in Location header + Request (application/json) + Body ``` <!-- include(examples/publish-with-sites.json) --> ``` + Schema ``` <!-- include(full-schema/publish.json) --> ``` + Response 202 ## Unpublishing [/unpublish] ### Unpublish items from a site [POST] TODO: make return a Job id in Location header + Request (application/json) + Body ``` <!-- include(examples/publish-with-sites.json) --> ``` + Schema ``` <!-- include(full-schema/publish.json) --> ``` + Response 202 ## Copying [/copy/{id}] + Parameters + id (required, string) - Item UUID ### Copy an item [POST] + Request + Schema ``` <!-- include(full-schema/copymove.json) --> ``` + Response 200 Item was successfully copied. New item location can be found from the location header. + Headers Location: /item/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 422 Missing item information + Body ## Moving [/move/{id}] + Parameters + id (required, string) - Item UUID ### Move an item to another site [POST] + Request + Schema ``` <!-- include(full-schema/copymove.json) --> ``` + Response 200 Item was successfully moved. + Headers Location: /item/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 422 Missing item information + Body
FORMAT: 1A HOST: https://api.thegrid.io/ # The Grid API # Group Long-running jobs Several actions in the API takes a significant time. Current examples include POST /share, /publish and /unpublish. Performing such an action returns a Location header with a Job URL. ## Job details [/job/{id}] ### Retriving job details [GET] + Parameters + id (required, string) - Job UUID + Response 200 (application/json) + Body ``` <!-- include(examples/job-share-completed.json) --> ``` ## Jobs [/job] ### Listing current jobs [GET] + Response 200 (application/json) + Body ``` [ <!-- include(examples/job-share-completed.json) --> ] ``` # Group Site Management ## Site information [/site] ### List user websites [GET] + Response 200 (application/json) + Body ``` [ <!-- include(examples/site-minimal.json) --> ] ``` ### Create a website [POST] + Request (application/json) **Note:** the repository must be in `the-domains` organization. The repository name can later be used for sharing content to the newly-created site. + Body ``` <!-- include(examples/site-without-owner.json) --> ``` + Schema ``` <!-- include(full-schema/site.json) --> ``` + Response 201 Site was successfully created + Headers Location: /site/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 422 Missing site information + Body ## User website [/site/{id}] + Parameters + id (required, string) - Site UUID ### Get website details [GET] + Response 200 (application/json) + Schema ``` <!-- include(full-schema/site.json) --> ``` ### Update website details [PUT] + Request (application/json) + Body ``` <!-- include(examples/site-with-config.json) --> ``` + Schema ``` <!-- include(full-schema/site.json) --> ``` + Response 200 (application/json) + Schema ``` <!-- include(full-schema/site.json) --> ``` ### Delete website [DELETE] + Response 200 ## Site DNS status [/site/{id}/dns] + Parameters + id (required, string) - Site UUID ### Check website DNS status [POST] + Response 200 (application/json) + Body { "valid": true } ## Website discovery [/site/discover{?url}] ### Match URL to a website [GET] + Parameters + url (required, string) - URL of the website + Response 302 + Headers Location: /site/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 404 No Grid site was found for the URL + Body # Group Content Management ## Share [/share] ### Sharing content [POST] Users can share content to The Grid. The shared items will be normalized, analyzed and made available via the item API. Sharing creates a Job, whos progress can be monitored using the /job API. There are typically three different things you can be sharing: * Full article pages: share with URL * HTML fragments: selection or img tag. Share with content, type text/html and with the URL of the originating page * Uploaded files: image, word document, HTML file, Markdown file, etc. Share with multi-part upload, URL and MIME type needed Note that publishing an item to a website is a separate step. See /publish + Request with JSON payload (application/json) + Body ``` <!-- include(examples/share-url-only.json) --> ``` + Schema ``` <!-- include(full-schema/share.json) --> ``` + Request with file upload (multipart/form-data) For images and other files the content is a file sent via multipart/form-data. If there is no relevant URL for the content, it is a good idea to generate a UUID URI. ``` formData = new FormData() formData.append 'url', 'content://' formData.append 'type', file.type formData.append 'content', file ``` + Body + Response 202 Sharing was successful and will be processed. + Headers Location: /job/b8838e11-1d97-4799-85d8-1aafec52e927 + Body + Response 422 Missing required parameters + Body + Response 403 Not allowed to share to the specified website + Body ## Random content [/share/random{?category,number}] ### Retrieve some pre-populated random content [GET] + Parameters + category (string) - Content category, for example `technology` + number (number) - How many items to retrieve + Response 200 (application/json) ## Items list [/item{?published,minimal,offset,limit,site,measurements}] ### Retrieve user's content items [GET] + Parameters + published (boolean) - Whether to get published or unpublished items only + minimal (boolean) - Whether to receive items without measurements applied (deprecated) + offset (number) - Offset to use for pagination + limit (number) - Limit to use for pagination + site (string) - Receive only items associated with a site + measurements (string) - Selectively get only certain measurements When an item is being worked on by a user it is available via the API. Queries without selective measurements must be paginated. When using pagination, the `limit` must be smaller than 50. + Response 200 (application/json) ### Create an item [POST] + Response 201 + Headers Location: /item/b8838e11-1d97-4799-85d8-1aafec52e927 + Response 422 Missing item information + Body ## Item [/item/{id,?measurements}] + Parameters + id (required, string) - Item UUID + measurements (string) - Selectively get only certain measurements ### Retrieve an item [GET] + Response 200 (application/json) + Schema ``` <!-- include(full-schema/item.json) --> ``` + Response 404 ### Update item [PUT] + Response 200 (application/json) + Schema ``` <!-- include(full-schema/item.json) --> ``` + Response 422 Missing item information + Body ### Update item metadata [PATCH] + Response 204 + Response 422 Missing item information + Body ### Remove item [DELETE] + Response 200 ## Publishing [/publish] ### Publish a items to a site [POST] TODO: make return a Job id in Location header + Request (application/json) + Body ``` <!-- include(examples/publish-with-sites.json) --> ``` + Schema ``` <!-- include(full-schema/publish.json) --> ``` + Response 202 ## Unpublishing [/unpublish] ### Unpublish items from a site [POST] TODO: make return a Job id in Location header + Request (application/json) + Body ``` <!-- include(examples/publish-with-sites.json) --> ``` + Schema ``` <!-- include(full-schema/publish.json) --> ``` + Response 202 ## Copying [/copy/{id}] + Parameters + id (required, string) - Item UUID ### Copy an item [POST] + Request + Schema ``` <!-- include(full-schema/copymove.json) --> ``` + Response 200 Item was successfully copied. New item location can be found from the location header. + Headers Location: /item/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 422 Missing item information + Body ## Moving [/move/{id}] + Parameters + id (required, string) - Item UUID ### Move an item to another site [POST] + Request + Schema ``` <!-- include(full-schema/copymove.json) --> ``` + Response 200 Item was successfully moved. + Headers Location: /item/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177 + Response 422 Missing item information + Body
Document DNS checking API
Document DNS checking API
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
c3f5ef8a9bb08b143948f1c406c4f22e3573678c
blueprint/index.apib
blueprint/index.apib
FORMAT: 1A HOST: https://thegrid.io/ # The Grid API See the following sections: * [Content Management](api.html) * [User Management](passport.html) ## Authentication The Grid operates an OAuth2 provider that is utilized for all authentication purposes. ### Identity Providers The Grid's authentication system supports multiple identity providers including: * GitHub (github) * Twitter (twitter) More identity providers are likely to be added later when they are needed. Check back to this document to see the current list. ### Registering an application The Grid authentication is always granted to the combination of a user and an application. To register an application, log into your The Grid account at https://passport.thegrid.io/account Go to the Developer Section of your profile page, and you'll be able to add new OAuth2 client applications. You need the following information: * Application name: name of the application shown to users in the confirmation page * Callback URL: the URL in your application users should be redirected to once they complete their login Once you have registered an application you will get two values from the system: * Application ID: Unique identifier for your application * Application secret: Passphrase your application can use to convert authentication grants to tokens **Note:** never let others see your client secret. Otherwise they will be able to impersonate your The Grid application! ### The OAuth dance When you want to authenticate a user with your The Grid application, you need to first send them to The Grid's login system. For this you need to construct a login URL with the following parts: * Protocol: https * Host: passport.thegrid.io * Path: `/login/authorize/<identity provider (optional, otherwise will show UI to choose provider)>` * Query: * `client_id`: the unique identifier of your application * `response_type`: code * `redirect_url`: your callback URL Example: <https://passport.thegrid.io/login/authorize/github?client_id=XXXX&response_type=code&redirect_uri=http://my.app.url> #### Authentication scopes The default authentication scope will grant you permissions to perform simple operations on behalf of the user. If needed, you can also request additional access to The Grid APIs via OAuth2 scopes. The scopes are added to the authentication request URL with the scope query key. The currently supported scopes include: * `github`: get access to the user's GitHub access token, if any. This will allow you to use the GitHub API on behalf of the user * `github_private`: get access to the user's GitHub access token authorized to access private repositories, if any. This will allow you to use the GitHub API on behalf of the user * `payment`: make a payment on behalf of the user * `reserve`: manage user's information on the reserve, including creating CtAs, listing balance etc. #### Getting a token Once the user completes the authentication process and grants your application access to their account, they will be redirected to the redirect_url. The redirection will contain an additional query parameter code which contains a one-time access grant. To convert this access grant to an access token you have to make a HTTP POST request with the following URL: * Protocol: https * Host: passport.thegrid.io * Path: /login/authorize/token The payload should be a URL-encoded string containing the following key-value pairs: * `client_id`: the unique identifier of your application * `client_secret`: your application's passphrase * `code`: the access grant you received in the query parameter of your callback URL * `grant_type`: `authorization_code` On a successful code conversion you will receive a JSON-encoded response with an object that will contain the user's access token in the `access_token` key. ### Making authenticated API requests The Grid API calls require authentication unless stated otherwise. This is done using the user's access token via HTTP Bearer Authentication. Bearer authentication works by adding the Authorization header to your HTTP requests with the value `Bearer <access token>`. For example: ``` req.setRequestHeader('Authorization', 'Bearer ' + token); ```
FORMAT: 1A HOST: https://thegrid.io/ # The Grid API See the following sections: * [Content Management](api.html) * [User Management](passport.html) ## Authentication The Grid operates an OAuth2 provider that is utilized for all authentication purposes. ### Identity Providers The Grid's authentication system supports multiple identity providers including: * GitHub (github) * Twitter (twitter) More identity providers are likely to be added later when they are needed. Check back to this document to see the current list. ### Registering an application The Grid authentication is always granted to the combination of a user and an application. To register an application, log into your The Grid account at https://passport.thegrid.io/account Go to the Developer Section of your profile page, and you'll be able to add new OAuth2 client applications. You need the following information: * Application name: name of the application shown to users in the confirmation page * Callback URL: the URL in your application users should be redirected to once they complete their login Once you have registered an application you will get two values from the system: * Application ID: Unique identifier for your application * Application secret: Passphrase your application can use to convert authentication grants to tokens **Note:** never let others see your client secret. Otherwise they will be able to impersonate your The Grid application! ### The OAuth dance When you want to authenticate a user with your The Grid application, you need to first send them to The Grid's login system. For this you need to construct a login URL with the following parts: * Protocol: https * Host: passport.thegrid.io * Path: `/login/authorize/<identity provider (optional, otherwise will show UI to choose provider)>` * Query: * `client_id`: the unique identifier of your application * `response_type`: code * `redirect_url`: your callback URL Example: <https://passport.thegrid.io/login/authorize/github?client_id=XXXX&response_type=code&redirect_uri=http://my.app.url> #### Authentication scopes The default authentication scope will grant you permissions to perform simple operations on behalf of the user. If needed, you can also request additional access to The Grid APIs via OAuth2 scopes. The scopes are added to the authentication request URL with the scope query key. The currently supported scopes include: * `content_management`: manage user's content items on The Grid * `website_management`: manage user's The Grid sites and publish to them * `share`: share new content to The Grid * `update_profile`: update the user's profile information * `github`: get access to the user's GitHub access token, if any. This will allow you to use the GitHub API on behalf of the user * `github_private`: get access to the user's GitHub access token authorized to access private repositories, if any. This will allow you to use the GitHub API on behalf of the user * `payment`: make a payment on behalf of the user * `balance`: see user's account balance and transaction history * `cta_management`: manage user's Calls to Action #### Getting a token Once the user completes the authentication process and grants your application access to their account, they will be redirected to the redirect_url. The redirection will contain an additional query parameter code which contains a one-time access grant. To convert this access grant to an access token you have to make a HTTP POST request with the following URL: * Protocol: https * Host: passport.thegrid.io * Path: /login/authorize/token The payload should be a URL-encoded string containing the following key-value pairs: * `client_id`: the unique identifier of your application * `client_secret`: your application's passphrase * `code`: the access grant you received in the query parameter of your callback URL * `grant_type`: `authorization_code` On a successful code conversion you will receive a JSON-encoded response with an object that will contain the user's access token in the `access_token` key. ### Making authenticated API requests The Grid API calls require authentication unless stated otherwise. This is done using the user's access token via HTTP Bearer Authentication. Bearer authentication works by adding the Authorization header to your HTTP requests with the value `Bearer <access token>`. For example: ``` req.setRequestHeader('Authorization', 'Bearer ' + token); ```
Document more scopes
Document more scopes
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
a50fecf342beed51585b81271b28289ebc7090f1
STATION-METADATA-API-BLUEPRINT.apib
STATION-METADATA-API-BLUEPRINT.apib
FORMAT: 1A Station Metadata API ============================= # General information This Service exists to provide the canonical API for querying and returning MeteoGroup stations and their capabilities. The output response with requested stations is always in GEOJson format. The API supports various combinations for querying stations meta data by area/region (bounding box, polygon, multi-polygon), by provider or type, by stations where MeteoGroup produces forecast or has observation data available. ## Authentication To access active-warning-service the request has to be authorised with a valid JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server `https://auth.weather.mg/oauth/token` with according client credentials. The required scope is `station-metadata`. The documentation about how to authenticate against MeteoGroup Weather API with OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md) ### Querying MeteoGroup stations data Here is the information about all supported HTTP request parameters and HTTP Headers: + Headers + Authorization: Bearer {ENCRYPTED TOKEN HERE} + If-Modified-Since: {DATE} + Parameters + locatedWithin: - {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box - {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]} - polygon coordinates; same as in [GeoJSON Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) - {"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]} - a multi-polygon, as in [GeoJSON MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) + accessVisibility: `public` (string, optional) - station access visibility, valid values is `public` and `private` + provider: `WMO,MG` (string, optional) - currently filter by provider or providers. All possible providers are described in section: **Get all providers** + type: `SKI_RESORT` (string, optional) - currently filter by type. All possible types are described in section: **Get all station types** + hasForecastData: `false` (boolean, optional) - station has forecast data. + hasObservationData: `true` (boolean, optional) - station has observation data. + countryIsoCode: `GB` (string, optional) - station located in this country. ISO Code refers to the [ISO 3166 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166) + meteoGroupStationId: `1004,1005` (string, optional) - filter stations by MeteoGroup station id/(comma separated ids). + fields: accessVisibility,icaoCode,countryIsoCode,provider,type,hasForecastData,wmoCountryId,hasObservationData,countryIsoCode, meteoGroupStationId,name,stationTimeZoneName - metadata fields in response, geometry is present in every success response. If fields is absent all fields are returned. Here are a couple of examples how to query by provider and type, bounding box and polygon. #### Querying by provider or type Query example: ``` GET /stations?accessVisibility=public&provider=WMO&hasForecastData=true&hasObservationData=false&countryIsoCode=UA&meteoGroupStationId=1004,1005 ``` + Response 200 (application/json) + Headers Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + Body ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "ENAS", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1004, "name": "Ny-Alesund II", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 11.9222, 78.9233, 16 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1005, "name": "Isfjord Radio", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 13.6333, 78.0667, 5 ] } } ] } ``` ### Queries by area or region (bounding box, polygone or multipolygone) When querying stations within a region queries have to formated, like geometries in [GeoJSON](https://tools.ietf.org/html/rfc7946). See the following examples. #### Querying by bounding box Query example for getting stations by bounding box: ```locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22bbox%22%2C%22coordinates%22%3A%5B%5B-10%2C80%5D%2C%5B10%2C5%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ The response body is the same as for querying stations by provider and type. #### Querying by polygon Example GeoJSON polygon: ```{"type":"polygon","coordinates":[[[-0.16,51.70],[-0.43,51.29],[0.18,51.30],[-0.16,51.70]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22polygon%22%2C%22coordinates%22%3A%5B%5B%5B-0.16%2C51.70%5D%2C%5B-0.43%2C51.29%5D%2C%5B0.18%2C51.30%5D%2C%5B-0.16%2C51.70%5D%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Querying by multi-polygon Example GeoJSON multi-polygon: ```{"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22multipolygon%22%2C%22coordinates%22%3A%5B%5B%5B%5B102.0%2C2.0%5D%2C%5B103.0%2C2.0%5D%2C%5B103.0%2C3.0%5D%2C%5B102.0%2C3.0%5D%2C%5B102.0%2C2.0%5D%5D%5D%2C%5B%5B%5B100.0%2C0.0%5D%2C%5B101.0%2C0.0%5D%2C%5B101.0%2C1.0%5D%2C%5B100.0%2C1.0%5D%2C%5B100.0%2C0.0%5D%5D%2C%5B%5B100.2%2C0.2%5D%2C%5B100.8%2C0.2%5D%2C%5B100.8%2C0.8%5D%2C%5B100.2%2C0.8%5D%2C%5B100.2%2C0.2%5D%5D%5D%5D%7D ``` **NOTE**: The `locatedWithin` parameter has to be encoded before putting it to the request. There are free online URL encoder available, for rapid manual testing: e.g. http://www.url-encode-decode.com/ If the query value is not proper encoded, you will receive an empty response with status code ```400 Bad Request```. #### Get all station types Query example: ``` GET /stations/types ``` Returns a list containing all current known station types. This list can be extended in the future. + Response 200 (application/json) ``` { "types": [ "AIRQUALITY", "AVIATION", "MARINE", "MG_NETWORK", "NMI_SECONDARY", "OTHER_OBS_HQ", "OTHER_OBS_LQ", "RAIL", "ROAD", "SKI_RESORT", "SPECIAL_OBS", "VIRTUAL", "WMO" ], "_links": { "AIRQUALITY": { "href": "http://station-metadata.weather.mg/stations?type=AIRQUALITY" }, "AVIATION": { "href": "http://station-metadata.weather.mg/stations?type=AVIATION" }, "MARINE": { "href": "http://station-metadata.weather.mg/stations?type=MARINE" }, "MG_NETWORK": { "href": "http://station-metadata.weather.mg/stations?type=MG_NETWORK" }, "NMI_SECONDARY": { "href": "http://station-metadata.weather.mg/stations?type=NMI_SECONDARY" }, "OTHER_OBS_HQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_HQ" }, "OTHER_OBS_LQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_LQ" }, "RAIL": { "href": "http://station-metadata.weather.mg/stations?type=RAIL" }, "ROAD": { "href": "http://station-metadata.weather.mg/stations?type=ROAD" }, "SKI_RESORT": { "href": "http://station-metadata.weather.mg/stations?type=SKI_RESORT" }, "SPECIAL_OBS": { "href": "http://station-metadata.weather.mg/stations?type=SPECIAL_OBS" }, "VIRTUAL": { "href": "http://station-metadata.weather.mg/stations?type=VIRTUAL" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?type=WMO" } } } ``` #### Get all providers Query example: ``` GET /stations/providers ``` Returns a list containing all current known data providers. This list can be extended in the future. + Response 200 (application/json) ``` { "providers": [ "ICAO", "KNMI", "MG", "WMO", ... ], "_links": { "ICAO": { "href": "http://station-metadata.weather.mg/stations?provider=ICAO" }, "KNMI": { "href": "http://station-metadata.weather.mg/stations?provider=KNMI" }, "MG": { "href": "http://station-metadata.weather.mg/stations?provider=MG" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?provider=WMO" }, ... } } ``` ### Cache control headers: The service offer regular HTTP caching hints in the reponse header. All clients are requested to follow good API citizen guidelines and respect these cache information. Example: f data unchanged since this date using the If-Modified-Since request header the server will return with an empty body with the 304 response code. Ex: + Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + If-Modified-Since: Thu, 13 Jul 2017 10:55:53 GMT
FORMAT: 1A Station Metadata API ============================= # General information This Service exists to provide the canonical API for querying and returning MeteoGroup stations and their capabilities. The output response with requested stations is always in GEOJson format. The API supports various combinations for querying stations meta data by area/region (bounding box, polygon, multi-polygon), by provider or type, by stations where MeteoGroup produces forecast or has observation data available. ## Authentication To access active-warning-service the request has to be authorised with a valid JWT OAuth 2.0 access token, obtained from the MeteoGroup Authorisation server `https://auth.weather.mg/oauth/token` with according client credentials. The required scope is `station-metadata`. The documentation about how to authenticate against MeteoGroup Weather API with OAuth 2.0 can be found here: [Weather API documentation](https://github.com/MeteoGroup/weather-api/blob/master/authorization/Authentication.md) ### Querying MeteoGroup stations data Here is the information about all supported HTTP request parameters and HTTP Headers: + Headers + Authorization: Bearer {ENCRYPTED TOKEN HERE} + If-Modified-Since: {DATE} + Parameters + locatedWithin: - {"type":"bbox","coordinates":[[lon,lat],[lon,lat]]} (string, optional) - top left and bottom right coordinates that construct bounding box - {"type":"polygon","coordinates":[[[-10,10],[10,5],[-5,-5],[-10,10]],[[-5,5],[0,5],[0,0],[-5,5]]]} - polygon coordinates; same as in [GeoJSON Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) - {"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]} - a multi-polygon, as in [GeoJSON MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) + accessVisibility: `public` (string, optional) - station access visibility, valid values is `public` and `private` + provider: `WMO,MG` (string, optional) - currently filter by provider or providers. All possible providers are described in section: **Get all providers** + type: `SKI_RESORT` (string, optional) - currently filter by type. All possible types are described in section: **Get all station types** + hasForecastData: `false` (boolean, optional) - station has forecast data. + hasObservationData: `true` (boolean, optional) - station has observation data. + countryIsoCode: `GB` (string, optional) - station located in this country. ISO Code refers to the [ISO 3166 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166) + meteoGroupStationId: `1004,1005` (string, optional) - filter stations by MeteoGroup station id/(comma separated ids). + fields: accessVisibility,icaoCode,countryIsoCode,provider,type,hasForecastData,wmoCountryId,hasObservationData,countryIsoCode, meteoGroupStationId,name,stationTimeZoneName - metadata fields in response, geometry is present in every success response. If fields is absent all fields are returned. Here are a couple of examples how to query by provider and type, bounding box and polygon. #### Querying by provider or type Query example: ``` GET /stations?accessVisibility=public&provider=WMO&hasForecastData=true&hasObservationData=false&countryIsoCode=UA&meteoGroupStationId=1004,1005 ``` + Response 200 (application/json) + Headers Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + Body ``` { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "ENAS", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1004, "name": "Ny-Alesund II", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 11.9222, 78.9233, 16 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "NO", "provider": "WMO", "hasForecastData": true, "wmoCountryId": 165, "meteoGroupStationId": 1005, "name": "Isfjord Radio", "hasObservationData": false, "stationTimeZoneName": "Arctic/Longyearbyen", "type": "WMO" }, "geometry": { "type": "Point", "coordinates": [ 13.6333, 78.0667, 5 ] } } ] } ``` ### Queries by area or region (bounding box, polygone or multipolygone) When querying stations within a region queries have to formated, like geometries in [GeoJSON](https://tools.ietf.org/html/rfc7946). See the following examples. #### Querying by bounding box Query example for getting stations by bounding box: ```locatedWithin={"type":"bbox","coordinates":[[-10,80],[10,5]]}``` The HTTP request with encoded **locatedWithin** param is: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22bbox%22%2C%22coordinates%22%3A%5B%5B-10%2C80%5D%2C%5B10%2C5%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ The response body is the same as for querying stations by provider and type. #### Querying by polygon Example GeoJSON polygon: ```{"type":"polygon","coordinates":[[[-0.16,51.70],[-0.43,51.29],[0.18,51.30],[-0.16,51.70]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22polygon%22%2C%22coordinates%22%3A%5B%5B%5B-0.16%2C51.70%5D%2C%5B-0.43%2C51.29%5D%2C%5B0.18%2C51.30%5D%2C%5B-0.16%2C51.70%5D%5D%5D%7D ``` **NOTE**: The **locatedWithin** parameter has to be encoded before putting it to the request. Online URL encoder: http://www.url-encode-decode.com/ #### Querying by multi-polygon Example GeoJSON multi-polygon: ```{"type":"multipolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]], [[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]], [[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}``` A corresponding HTTP request to get station within such a area needs to be URL encoded and looks like this: ``` GET /stations?locatedWithin=%7B%22type%22%3A%22multipolygon%22%2C%22coordinates%22%3A%5B%5B%5B%5B102.0%2C2.0%5D%2C%5B103.0%2C2.0%5D%2C%5B103.0%2C3.0%5D%2C%5B102.0%2C3.0%5D%2C%5B102.0%2C2.0%5D%5D%5D%2C%5B%5B%5B100.0%2C0.0%5D%2C%5B101.0%2C0.0%5D%2C%5B101.0%2C1.0%5D%2C%5B100.0%2C1.0%5D%2C%5B100.0%2C0.0%5D%5D%2C%5B%5B100.2%2C0.2%5D%2C%5B100.8%2C0.2%5D%2C%5B100.8%2C0.8%5D%2C%5B100.2%2C0.8%5D%2C%5B100.2%2C0.2%5D%5D%5D%5D%7D ``` **NOTE**: The `locatedWithin` parameter has to be encoded before putting it to the request. There are free online URL encoder available, for rapid manual testing: e.g. http://www.url-encode-decode.com/ If the query value is not proper encoded, you will receive an empty response with status code ```400 Bad Request```. #### Get all station types Query example: ``` GET /stations/types ``` Returns a list containing all current known station types. This list can be extended in the future. + Response 200 (application/json) ``` { "types": [ "AIRQUALITY", "AVIATION", "MARINE", "MG_NETWORK", "NMI_SECONDARY", "OTHER_OBS_HQ", "OTHER_OBS_LQ", "RAIL", "ROAD", "SKI_RESORT", "SPECIAL_OBS", "VIRTUAL", "WMO" ], "_links": { "AIRQUALITY": { "href": "http://station-metadata.weather.mg/stations?type=AIRQUALITY" }, "AVIATION": { "href": "http://station-metadata.weather.mg/stations?type=AVIATION" }, "MARINE": { "href": "http://station-metadata.weather.mg/stations?type=MARINE" }, "MG_NETWORK": { "href": "http://station-metadata.weather.mg/stations?type=MG_NETWORK" }, "NMI_SECONDARY": { "href": "http://station-metadata.weather.mg/stations?type=NMI_SECONDARY" }, "OTHER_OBS_HQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_HQ" }, "OTHER_OBS_LQ": { "href": "http://station-metadata.weather.mg/stations?type=OTHER_OBS_LQ" }, "RAIL": { "href": "http://station-metadata.weather.mg/stations?type=RAIL" }, "ROAD": { "href": "http://station-metadata.weather.mg/stations?type=ROAD" }, "SKI_RESORT": { "href": "http://station-metadata.weather.mg/stations?type=SKI_RESORT" }, "SPECIAL_OBS": { "href": "http://station-metadata.weather.mg/stations?type=SPECIAL_OBS" }, "VIRTUAL": { "href": "http://station-metadata.weather.mg/stations?type=VIRTUAL" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?type=WMO" } } } ``` #### Get all providers Query example: ``` GET /stations/providers ``` Returns a list containing all current known data providers. This list can be extended in the future. + Response 200 (application/json) ``` { "providers": [ "ICAO", "KNMI", "MG", "WMO", ... ], "_links": { "ICAO": { "href": "http://station-metadata.weather.mg/stations?provider=ICAO" }, "KNMI": { "href": "http://station-metadata.weather.mg/stations?provider=KNMI" }, "MG": { "href": "http://station-metadata.weather.mg/stations?provider=MG" }, "WMO": { "href": "http://station-metadata.weather.mg/stations?provider=WMO" }, ... } } ``` #### Generate ID for moving stations Query example: ``` GET /generateID?locator=anyLocator&stationType=anyStationType ``` Returns generated ID by specified locator and stationType parameters. Both of parameters are mandatory. + Response 200 (text/plain) ``` { "meteoGroupStationId": "qnCfdt", "_links": { "getStationById": { "href": "http://localhost:8080/stations?meteoGroupStationId=qnCfdt" } } } ``` ### Cache control headers: The service offer regular HTTP caching hints in the reponse header. All clients are requested to follow good API citizen guidelines and respect these cache information. Example: f data unchanged since this date using the If-Modified-Since request header the server will return with an empty body with the 304 response code. Ex: + Last-Modified: Mon, 10 Jul 2017 08:37:16 GMT + If-Modified-Since: Thu, 13 Jul 2017 10:55:53 GMT
Add documentation about new /generateID endpoint.
[BBCDD-988] Add documentation about new /generateID endpoint.
API Blueprint
apache-2.0
MeteoGroup/weather-api,MeteoGroup/weather-api
3b279f66fb992ffd94d98ccfbe3a7f25fbf106ac
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service, to be consumed by the responsive frontend. # Group Categories Category related resources of the **Money Advice Service**. ## Categories Collection [/{locale}/categories.json] A collection of categories including their subcategories + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Categories. + Values + `en` + `cy` ### Retrieve all Categories [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/categories; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/categories>; rel="alternate"; hreflang="cy" + Body [ { "id": "life-events", "type": "category", "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "contents": [ { "id": "setting-up-home", "type": "category", "title": "Setting up home", "description": "Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n", "contents": [ ] }, { "id": "young-people-and-money", "type": "category", "title": "Leaving school or college", "description": "", "contents": [ ] }, { "id": "having-a-baby", "type": "category", "title": "Having a baby", "description": "", "contents": [ ] } ] }, { "id": "managing-your-money", "type": "category", "title": "Managing your money", "description": "", "contents": [ { "id": "managing-your-money-better", "type": "category", "title": "Managing your money", "description": "How to take control of your money, make ends meet and make better financial decisions\n", "contents": [ ] }, { "id": "how-to-review-or-reduce-borrowing", "type": "category", "title": "How to review or reduce borrowing", "description": "Tips on cutting the cost of card debt, personal loans, car finance, catalogue or HP agreements and mortgage payments", "contents": [ ] } ] }, { "id": "money-topics", "type": "category", "title": "Money topics", "description": "", "contents": [ ] }, { "id": "tools--resources", "type": "category", "title": "Tools & resources", "description": "", "contents": [ ] }, { "id": "news", "type": "category", "title": "News", "description": "", "contents": [ ] } ] ## Category [/{locale}/categories/{id}] A single category object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Category. + Values + `en` + `cy` + id (required, string, `life-events`) ... ID of the Category. ### Retrieve a Category [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/categories/life-events>; rel="canonical"; title="Life events", <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd" + Body { "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "id":"life-events", "contents":[ { "id":"setting-up-home", "type":"category", "title":"Setting up home", "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" }, { "id":"how-much-rent-can-you-afford", "type":"guide", "title":"How much rent can you afford?", "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in" } ] } # Group Articles Article related resources of the **Money Advice Service**. ## Article [/{locale}/articles/{id}] A single Article object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Article. + Values + `en` + `cy` + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. ### Retrieve an Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="canonical"; title="Where to go to get free debt advice", <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled" + Body { "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt", "body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>" } # Group Action Plans Action Plan related resources of the **Money Advice Service**. ## Action Plan [/{locale}/action_plans/{id}] A single Action Plan object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. + Values + `en` + `cy` ### Retrieve an Action Plan [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol" + Body { "title": "Prepare for the cost of having a baby", "description": "A handy action plan which can help with planning of the costs involved in having a new baby", "body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>" } #Group Search Search related resources of the **Money Advice Service**. ## Search [/{locale}/search?query={query_chain}] A collection of search results + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Search. + Values + `en` + `cy` + query_chain (string, `health+check+house`) ... query of the search. ### Retrieve search results [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/search?query=budget+plan+house; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/search>; rel="alternate"; hreflang="cy" + Body [ { "id": "manage-your-budget-after-redundancy", "type": "action_plan", "title": "Manage your budget after redundancy", "description":"Use this step-by-step action plan to help you keep the household budget on track after redundancy." }, { "id": "new-baby-why-budget", "type": "article", "title": "New baby – why budget?", "description":"If you find yourself saying that more and more, especially if there's a new baby on the scene, it's probably time to draw up a household budget and start planning your spending." }, { "id": "funeral-plans", "title": "Funeral plans", "type": "article", "description":"A funeral plan is a way of paying for a future funeral today. Here are some things to bear in mind if you're thinking of taking one out." }, { "id": "how-to-make-your-money-go-further", "type": "action_plan", "title": "How to make your money go further", "description":"Follow this action plan to help you save money around the home and when you're out and about, making your hard-earned cash go that bit further." } ]
FORMAT: 1A HOST: https://www.moneyadviceservice.org.uk # Money Advice Service API for the Money Advice Service, to be consumed by the responsive frontend. # Group Categories Category related resources of the **Money Advice Service**. ## Categories Collection [/{locale}/categories.json] A collection of categories including their subcategories + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Categories. + Values + `en` + `cy` ### Retrieve all Categories [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/categories; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/categories>; rel="alternate"; hreflang="cy" + Body [ { "id": "life-events", "type": "category", "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "contents": [ { "id": "setting-up-home", "type": "category", "title": "Setting up home", "description": "Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n", "contents": [ ] }, { "id": "young-people-and-money", "type": "category", "title": "Leaving school or college", "description": "", "contents": [ ] }, { "id": "having-a-baby", "type": "category", "title": "Having a baby", "description": "", "contents": [ ] } ] }, { "id": "managing-your-money", "type": "category", "title": "Managing your money", "description": "", "contents": [ { "id": "managing-your-money-better", "type": "category", "title": "Managing your money", "description": "How to take control of your money, make ends meet and make better financial decisions\n", "contents": [ ] }, { "id": "how-to-review-or-reduce-borrowing", "type": "category", "title": "How to review or reduce borrowing", "description": "Tips on cutting the cost of card debt, personal loans, car finance, catalogue or HP agreements and mortgage payments", "contents": [ ] } ] }, { "id": "money-topics", "type": "category", "title": "Money topics", "description": "", "contents": [ ] }, { "id": "tools--resources", "type": "category", "title": "Tools & resources", "description": "", "contents": [ ] }, { "id": "news", "type": "category", "title": "News", "description": "", "contents": [ ] } ] ## Category [/{locale}/categories/{id}] A single category object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Category. + Values + `en` + `cy` + id (required, string, `life-events`) ... ID of the Category. ### Retrieve a Category [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/categories/life-events>; rel="canonical"; title="Life events", <https://www.moneyadviceservice.org.uk/cy/categories/life-events>; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd" + Body { "title": "Life events", "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", "id":"life-events", "contents":[ { "id":"setting-up-home", "type":"category", "title":"Setting up home", "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" }, { "id":"how-much-rent-can-you-afford", "type":"guide", "title":"How much rent can you afford?", "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in" } ] } # Group Articles Article related resources of the **Money Advice Service**. ## Article [/{locale}/articles/{id}] A single Article object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Article. + Values + `en` + `cy` + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. ### Retrieve an Article [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="canonical"; title="Where to go to get free debt advice", <https://www.moneyadviceservice.org.uk/cy/articles/ble-i-gael-cyngor-am-ddim-ynghylch-dyled>; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled", <https://www.moneyadviceservice.org.uk/en/articles/where-to-go-to-get-free-debt-advice>; rel="alternate"; title="Where to go to get free debt advice" + Body { "title": "Where to go to get free debt advice", "description": "Find out where you can get free, confidential help if you are struggling with debt", "body": "<h2>Watch out for companies that aren't charities</h2><p>Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.</p><p>Never ever pay for services from this type of company.</p>" } # Group Action Plans Action Plan related resources of the **Money Advice Service**. ## Action Plan [/{locale}/action_plans/{id}] A single Action Plan object with all its details + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. + Values + `en` + `cy` ### Retrieve an Action Plan [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", <https://www.moneyadviceservice.org.uk/cy/action_plans/paratowch-am-y-gost-o-gael-babi>; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol", <https://www.moneyadviceservice.org.uk/en/action_plans/prepare-for-the-cost-of-having-a-baby>; rel="alterante"; title="Action plan – Prepare for the cost of having a baby" + Body { "title": "Prepare for the cost of having a baby", "description": "A handy action plan which can help with planning of the costs involved in having a new baby", "body": "<h4>Why?</h4><p>Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.</p>" } #Group Search Search related resources of the **Money Advice Service**. ## Search [/{locale}/search?query={query_chain}] A collection of search results + Parameters + locale = `en` (optional, string, `en`) ... Locale of the Search. + Values + `en` + `cy` + query_chain (string, `health+check+house`) ... query of the search. ### Retrieve search results [GET] + Response 200 (application/json) + Header Link: <https://www.moneyadviceservice.org.uk/en/search?query=budget+plan+house; rel="canonical", <https://www.moneyadviceservice.org.uk/cy/search>; rel="alternate"; hreflang="cy" + Body [ { "id": "manage-your-budget-after-redundancy", "type": "action_plan", "title": "Manage your budget after redundancy", "description":"Use this step-by-step action plan to help you keep the household budget on track after redundancy." }, { "id": "new-baby-why-budget", "type": "article", "title": "New baby – why budget?", "description":"If you find yourself saying that more and more, especially if there's a new baby on the scene, it's probably time to draw up a household budget and start planning your spending." }, { "id": "funeral-plans", "title": "Funeral plans", "type": "article", "description":"A funeral plan is a way of paying for a future funeral today. Here are some things to bear in mind if you're thinking of taking one out." }, { "id": "how-to-make-your-money-go-further", "type": "action_plan", "title": "How to make your money go further", "description":"Follow this action plan to help you save money around the home and when you're out and about, making your hard-earned cash go that bit further." } ]
Add article and action plan 'en' alternate links
Add article and action plan 'en' alternate links
API Blueprint
mit
moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend,moneyadviceservice/frontend
38eab9c02a1a301865c7801700c706d80f5468ca
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://www.google.com # Personal API v1 http://personal.apiary-mock.com # Group Skills ## /skills ### GET List all skills Sample Requests: [GET] http://personal.apiary-mock.com/skills + Response 200 (application/json) [ { "id": 1, "name": "HTML" }, { "id": 2, "name": "CSS"} ] ### POST Create a skill Sample Requests: [POST] http://personal.apiary-mock.com/skills + Request (application/json) { "name": "JavaScript" } + Response 201 (application/json) { "id": 3, "name": "JavaScript" } ## /skills/{id} + Parameters + id (required, number, `3`) ... numeric value ### GET Retrieve a skill Sample Requests: [POST] http://personal.apiary-mock.com/skills/3 + Response 200 (application/json) + Body { "id": 3, "name": "JavaScript" } ### PUT Update a skill Sample Requests: [PUT] http://personal.apiary-mock.com/skills/3 + Request (application/json) + Body { "name": "HTML5" } + Response 200 (application/json) + Body { "id": 3, "name": "HTML5" } ### DELETE Remove a skill Sample Requests: [DELETE] http://personal.apiary-mock.com/skills/3 + Request (application/json) + Response 204 # Group INFO ## Allowed HTTPs requests: [POST]: To create a resource [GET]: To read a resource or list of resources [PUT]: To update a resource [DELETE]: To delete a resource ## Description of usual server responses - 200 `OK` - the request was successful. - 201 `Created` - the request was successful and a resource was created. - 204 `No Content` - the request was successful but there is no representation to return (i.e. the response is empty). - 400 `Bad Request` - the request could not be understood or was missing required parameters. - 401 `Unauthorized` - authentication failed or user doesn't have permissions for requested operation. - 403 `Forbidden` - access denied. - 404 `Not Found` - resource was not found - 405 `Method Not Allowed` - requested method is not supported for resource. - 409 `Conflict` - the request could not be completed due to a conflict with the current state of the resource.
FORMAT: 1A HOST: http://www.google.com # Personal API v1 http://personal.apiary-mock.com # Group Skills ## /skills ### GET List all skills Sample Requests: [GET] http://personal.apiary-mock.com/skills + Response 200 (application/json) [ { "id": 1, "name": "HTML" }, { "id": 2, "name": "CSS"} ] ### POST Create a skill Sample Requests: [POST] http://personal.apiary-mock.com/skills + Request (application/json) { "name": "JavaScript" } + Response 201 (application/json) { "id": 3, "name": "JavaScript" } ## /skills/{id} + Parameters + id (required, number, `3`) ... numeric value ### GET Retrieve a skill Sample Requests: [POST] http://personal.apiary-mock.com/skills/3 + Response 200 (application/json) { "id": 3, "name": "JavaScript" } ### PUT Update a skill Sample Requests: [PUT] http://personal.apiary-mock.com/skills/3 + Request (application/json) { "name": "HTML5" } + Response 200 (application/json) { "id": 3, "name": "HTML5" } ### DELETE Remove a skill Sample Requests: [DELETE] http://personal.apiary-mock.com/skills/3 + Request (application/json) + Response 204 # Group INFO ## Allowed HTTPs requests: [POST]: To create a resource [GET]: To read a resource or list of resources [PUT]: To update a resource [DELETE]: To delete a resource ## Description of usual server responses - 200 `OK` - the request was successful. - 201 `Created` - the request was successful and a resource was created. - 204 `No Content` - the request was successful but there is no representation to return (i.e. the response is empty). - 400 `Bad Request` - the request could not be understood or was missing required parameters. - 401 `Unauthorized` - authentication failed or user doesn't have permissions for requested operation. - 403 `Forbidden` - access denied. - 404 `Not Found` - resource was not found - 405 `Method Not Allowed` - requested method is not supported for resource. - 409 `Conflict` - the request could not be completed due to a conflict with the current state of the resource.
Update apiary.apib
Update apiary.apib
API Blueprint
mit
gdumitrescu/personal-api,gdumitrescu/personal-api
e5e217433bcf62e1eb427454d28cb365ab209cf3
doc/example-httpbin.apib
doc/example-httpbin.apib
--- Examples against httpbin.org --- --- Examples of how some requests to _httpbin.org_ can be specified. Read more about the httpbin.org API at http://httpbin.org/. You can try testing this example from the project root in an erlang shell if you pass the parameter host with value "httpbin.org", and some variables used in the blueprint like so: ``` %% Assign values of "{{<my_name}}" and {{<your_name}}: TemplateVariables = [{"my_name", "Joe"}, {"your_name", "Mike"}], %% Tell KATT to send requests to httpbin.org instead of localhost. Params = [{host, "httpbin.org"}], katt:run("doc/example-httpbin.apib", Params, TemplateVariables). ``` --- # First request and response Get a teapot from some full URL. Note: it is better to only specify the path in your blueprint, if all your requests go to the same host and you specify the host as a parameter to katt:start/2: ``` katt:start("example-httbpin", [{host, "httpbin.org"}]). ``` Leading or trainling blank lines in the body are stripped, unless you delimit the body lines with the markers <<< (start) and >>> (end). The newlines after <<< as well as the newline before >>> is not included in the body. GET /status/418 > Accept: * > User-Agent: KATT < 418 < X-More-Info: http://tools.ietf.org/html/rfc2324 <<< -=[ teapot ]=- _...._ .' _ _ `. | ."` ^ `". _, \_;`"---"`|// | ;/ \_ _/ `"""` >>> # Second request and response Get unauthorized. Also note that we don't expect any body. The current date will be available to use in later requests as `{{<some_date}}.` GET /status/401 > Accept: * > User-Agent: KATT < 401 < Www-Authenticate: Basic realm="Fake Realm" < Date: {{>some_date}} # Third request Note that the title of this operation is "Third request", but that's just markdown for you. You don't need to include a title, or even a description of the operations unless you want to. In the fourth request will will skip the description altogether. Here we are getting a cached response. GET /cache > Accept: application/json > User-Agent: KATT < 200 < Content-Type: application/json { "url": "http://httpbin.org/cache", "headers": "{{_}}", "args": "{{_}}", "origin": "{{>origin}}" } GET /cache > Accept: application/json > User-Agent: KATT > If-Modified-Since: {{<some_date}} < 304 A fifth request to show that whitespace in JSON body is insignificant. POST /post > Accept: application/json > Content-Type: application/json > User-Agent: KATT {"origin":"{{<origin}}","whoarewe":"{{<your_name}}_and_{{<my_name}}","date":"{{<some_date}}"} < 200 < Content-Type: application/json { "args": "{{_}}", "data": "{{>raw_data}}", "files": [], "form": [], "headers": "{{_}}", "origin": "{{<origin}}", "url": "http://httpbin.org/post", "json": { "origin": "{{<origin}}", "date": "{{<some_date}}", "whoarewe": "{{>whoarewe}}" } } GET /get?origin={{<origin}}&whoarewe={{<whoarewe}} > Accept: application/json > User-Agent: KATT < 200 < Content-Type: application/json { "args": { "whoarewe": "{{<your_name}}_and_{{<my_name}}", "origin": "{{<origin}}" }, "headers": "{{_}}", "origin": "{{_}}", "url": "http://httpbin.org/get?origin={{<origin}}&whoarewe={{<whoarewe}}", }
Add a more advanced blueprint example
Add a more advanced blueprint example
API Blueprint
apache-2.0
for-GET/katt
c96639db3f849a41d122aa153b39a7f3b3c1dfd9
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://polls.apiblueprint.org/ # vnf-asterisk-controller Polls is a simple API allowing consumers to view polls and vote in them. ## Questions Collection [/questions] ### List All Questions [GET] + Response 200 (application/json) [ { "question": "Favourite programming language?", "published_at": "2015-08-05T08:40:51.620Z", "choices": [ { "choice": "Swift", "votes": 2048 }, { "choice": "Python", "votes": 1024 }, { "choice": "Objective-C", "votes": 512 }, { "choice": "Ruby", "votes": 256 } ] } ] ### Create a New Question [POST] You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices. + Request (application/json) { "question": "Favourite programming language?", "choices": [ "Swift", "Python", "Objective-C", "Ruby" ] } + Response 201 (application/json) + Headers Location: /questions/2 + Body { "question": "Favourite programming language?", "published_at": "2015-08-05T08:40:51.620Z", "choices": [ { "choice": "Swift", "votes": 0 }, { "choice": "Python", "votes": 0 }, { "choice": "Objective-C", "votes": 0 }, { "choice": "Ruby", "votes": 0 } ] }
add apiary.io blueprint
add apiary.io blueprint
API Blueprint
apache-2.0
dougbtv/vnf-asterisk-controller,dougbtv/vnf-asterisk-controller,dougbtv/vnf-asterisk-controller
8816760099ba8e9c5ec8f4dee01b4894e02900ed
spec.apib
spec.apib
FORMAT: 1A HOST: https://private-a144e-battleships1.apiary-mock.com # Battleships Battleships API is a simple API to play the game Battleships. A game is followed in the following sequence: 1. Two **player**s join a **match**. 2. Each player has its own **grid**. 3. Each player places all of its **ship**s on its own grid. 4. Players take turns * In a turn a player fires **shot**s at the opponents grid. * On **hit**ting the opposing players ship, the player may fire a consecutive shot. * On **miss**ing all of the opposing players ships, the turn ends. 5. When all grid spaces of a ship have been hit, the ship has been **sunk**. 6. First player to sink all the oponents ships, wins. ## TODO * Communicate between server and application using SSE * Communicate between server and application using WebSockets ## Playing the game ### Join a match [GET /match] To play in a game, one first has to join a match. You can be either the first (0) or the second (1) participant. The header contains the JWT to use on further POST requests. The response contains: + **player** *(number)* - whether you're the first or second player, useful to determine whether it is your turn. + **id** *(string)* - id of the match + Response 201 (application/json) + Body { "player": 1, "id": "-KcSKrUV5pqaYwUcwVZP" } + Headers Authentication: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCYXR0bGVzaGlwcyIsImlhdCI6MTQ4NjU1MTEzMCwiZXhwIjoxNTE4MDg3MTgwLCJhdWQiOiJiYXR0bGVzaGlwcy5hcGlibHVlcHJpbnQub3JnIiwic3ViIjoiMSIsIm1hdGNoIjoiLUtjU0tyVVY1cHFhWXdVY3dWWlAiLCJwbGF5ZXIiOiIxIn0.2ZOULT-tSoGBFr85XgX5xL51g0NvY8gW37Dx4N3TWk4 Location: /match/-KcSKrUV5pqaYwUcwVZP ### Current state of a match [GET /match/{id}] Retrieve the state of a running or finished match. We suggest you poll this resource to sync the match state. A match consists of: + **phase** *(number)* 1. One or both players have not placed (all) their ships yet. 2. Player indicated by *current_player* can take a shot. 3. Player indicated by *current_player* has won the game. + **current_player** *(number)* + **ships** *(array[number])* - Amount and length of ships + **grid** *(array[number])* - Width and length of the grid respectively + **shots** *(array)* + Attributes + id (required, string) - The unique id of a match (usually retrieved by joining a match) + Response 200 (application/json) + Body { "phase": 1, "current_player": 0, "ships": [5, 4, 3, 3, 2], "grid": [15, 15], "shots": [ { "x": 2, "y": 9, "hit": false, "sunk": false, "side": 0 }, { "x": 2, "y": 9, "hit": true, "sunk": false, "side": 1 } ] } + Response 404 ### Placing a ship [POST /ship] Places a ship on your own grid. Make sure the shot coordination (zero based) are within bounds of the grid. **Rules of placing a ship:** + Ships must be placed either horizontally or vertically, not diagonally. + A ship can only be placed once. + Ships cannot be moved. + A ship must be placed within the bounds of the grid. + A ship cannot touch another ship. (might change this later, but it makes things easier) + Attributes + start_x (required, number) + start_y (required, number) + end_x (required, number) + end_y (required, number) + Response 200 + Request + Headers Authentication: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCYXR0bGVzaGlwcyIsImlhdCI6MTQ4NjU1MTEzMCwiZXhwIjoxNTE4MDg3MTgwLCJhdWQiOiJiYXR0bGVzaGlwcy5hcGlibHVlcHJpbnQub3JnIiwic3ViIjoiMSIsIm1hdGNoIjoiLUtjU0tyVVY1cHFhWXdVY3dWWlAiLCJwbGF5ZXIiOiIxIn0.2ZOULT-tSoGBFr85XgX5xL51g0NvY8gW37Dx4N3TWk4 + Body + Response 400 (text/plain) + Body For once, please, stick to the rules! + Response 401 + Headers WWW-Authenticate: Bearer + Response 403 (text/plain) Returned when accessing this resource after phase 1. + Body There's a time to place ships and a time to blow up ships. You just blew your change to place ships. ### Making a shot [POST /shot] Makes a shot at the opposing players grid. Make sure the shot coordination (zero based) are within bounds of the grid. On a 200 response and **hit**, make another POST request with new coordinates to fire the next shot. Response contains: + **x** *(number)* + **y** *(number)* + **hit** *(boolean)* + **sunk** *(boolean)* - When hit, indicates if it sunk a ship + Attributes + x (required, number) + y (required, number) + Response 200 (application/json) + Request + Headers Authentication: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCYXR0bGVzaGlwcyIsImlhdCI6MTQ4NjU1MTEzMCwiZXhwIjoxNTE4MDg3MTgwLCJhdWQiOiJiYXR0bGVzaGlwcy5hcGlibHVlcHJpbnQub3JnIiwic3ViIjoiMSIsIm1hdGNoIjoiLUtjU0tyVVY1cHFhWXdVY3dWWlAiLCJwbGF5ZXIiOiIxIn0.2ZOULT-tSoGBFr85XgX5xL51g0NvY8gW37Dx4N3TWk4 + Body { "x": 2, "y": 9, "hit": true, "sunk": false } + Response 400 (text/plain) + Body Exception: shot out of bounds + Response 401 + Headers WWW-Authenticate: Bearer + Response 403 (text/plain) + Body It is not your turn to shoot, sailor!
Add the API Blueprint
Add the API Blueprint
API Blueprint
mit
devmobsters/php-battleships-api,devmobsters/php-battleships-api
ab52823aaabc8f1ce3e26d51cf633d738f0297d0
apiary.apib
apiary.apib
FORMAT: 1A # Defence Request App Internal API Defence Request Auth App Internal API's ## Authorization Access tokens are obtained by signing User in using OAuth. Access tokens must be passed for each request in an Authorization header. A missing Authorization Header or invalid Authorization Token value for a protected endpoint will result in a 401 response ## Paging Every collection response will include a links object. The Links Object should contain links to both the first and last pages, optionally with next and previous links # Group API Root [/] This resource does not have any attributes. Instead it offers the initial API affordances in the form of the links in the JSON body. It is recommended to follow the “url” link values, [Link](https://tools.ietf.org/html/rfc5988) or Location headers where applicable to retrieve resources. Instead of constructing your own URLs, to keep your client decoupled from implementation details. We will use link values for all collection responses. ## Retrieve the Entry Point [GET] + Response 200 (application/json) { "organisations_url": "/api/v1/organisations", "profiles_url": "/api/v1/profiles", "users_url": "/api/v1/users" } # Group Users Users contain login information ## Users Collection [/api/v1/users] ### List all Users [GET] + Payload + Headers Authorization: Token <TOKEN> + Response 200 (application/json) { "users": [ { "id": 1, "first_name": "Bob", "last_name": "Smith", "email": "[email protected]" } ], "links": { "first": "/api/v1/users", "previous": "/api/v1/users?page=1", "next": "/api/v1/users?page=2", "last": "/api/v1/users?page=3" } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } ## User [/api/v1/user/{id}] + Parameters + id (integer) ID of the User ### Single User [GET] + Payload + Headers Authorization: Token <TOKEN> + Response 200 (application/json) { "user": { "id": 1, "first_name": "Bob", "last_name": "Smith", "email": "[email protected]" } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } ## User [/api/v1/user/me] Returns User object for the user identified by the Authorization Header ### Single User [GET] + Payload + Headers Authorization: Token <TOKEN> + Response 200 (application/json) { "user": { "id": 1, "first_name": "Bob", "last_name": "Smith", "username": "bob.smith", "email": "[email protected]" }, "profile": { "name": "Bob Smith", "email": "[email protected]", "telephone": "0123456789", "mobile": "071234567", "address": { "line1": "", "line2": "", "city": "" "postcode": "" }, "PIN": "1234", "organisation_ids": [1,2] }, "roles": [ "admin", "foo", "bar" ] } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } # Group Organisations Organisations are logical groups of Users Organisations can be filtered by one or more type: * custody_suite * call_centre * law_firm * law_office ## Organisations Collection [/api/v1/organisations?types=xxx] ### List all Organisations [GET] + Payload + Headers Authorization: Token <TOKEN> + Parameters + types (string) Filter types of Organisation, multiple by comma seperation + Values + `'custody_suite'` + `'call_centre'` + `'law_firm'` + `'law_office'` + Response 200 (application/json) { "organisations:" [ { "id": 1, "name": "Tuckers", "type: "law_firm", "Profiles_ids": [1,2,3,5,6,7] }, { "id": 2, "name": "Brighton", "type: "custody_suite", "profiles_ids": [5,8,9] } ], "links": { "first": "/api/v1/organisations", "previous": "/api/v1/organisations?page=1", "next": "/api/v1/organisations?page=2", "last": "/api/v1/organisations?page=3" } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } ## Organisation [/api/v1/organisation/{id}] A single Organisation with all its details + Parameters + id (integer) ID of the organisation ### Single Organisation [GET] + Payload + Headers Authorization: Token <TOKEN> + Response 200 (application/json) { "organisation": { "id": 1, "name": "Tuckers", "type": "law_firm", "profiles_ids": [1,2,3,5,6,7] } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } # Group Profiles Profiles of people that may or may not have a login to Defence Request. Will eventually contain all Solicitors that have a Legal Aid Contract. Used to find contact details for Solicitors or Agents ## Profiles Collection [/api/v1/profiles?ids=1,2,3,4&types=xxx] ### List all Profiles [GET] + Payload + Headers Authorization: Token <TOKEN> + Parameters + ids (integer, optional) Comma seperated list of User ids to load + types (string, optional) Filter types of Profile, multiple by comma seperation + Values + `'solicitor'` + `'agent'` + Response 200 (application/json) { "profiles:" [ { "id": 1, "name": "Bob Smith", "type: "solicitor" }, { "id": 2, "name": "Andy Brown", "type: "agent" } ], "links": { "first": "/api/v1/profiles", "previous": "/api/v1/profiles?page=1", "next": "/api/v1/profiles?page=2", "last": "/api/v1/profiles?page=3" } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } ## Profile [/api/v1/profiles/{id}] A single Profile with all its details + Parameters + id (required, integer) ID of the Profile ### Single Profile [GET] + Payload + Headers Authorization: Token <TOKEN> + Response 200 (application/json) { "profile": { "id": 1, "name": "Bob Smith", "type": "solicitor" } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] } ## Profile Search [/api/v1/profiles/search?q=xxx] Search Profiles on Name, Firm (Organisation) Name, Firm Address No authorization is needed for this endpoint + Response 200 (application/json) { "profiles": [ { "id": 1, "name": "Bob Smith", "type": "solicitor" } ], "links": { "first": "/api/v1/profiles/search?q=xxx", "previous": "/api/v1/profiles/search?q=xxx&page=1", "next": "/api/v1/profiles/search?q=xxx&page=2", "last": "/api/v1/profiles/search?q=xxx&page=3" } } + Response 401 (application/json) { "errors": [ "You must provide a valid Authorization Token" ] }
Add api docs for internal api
Add api docs for internal api
API Blueprint
mit
ministryofjustice/ds-auth,ministryofjustice/ds-auth,ministryofjustice/defence-request-service-auth,ministryofjustice/ds-auth,ministryofjustice/defence-request-service-auth,ministryofjustice/defence-request-service-auth,ministryofjustice/defence-request-service-auth,ministryofjustice/ds-auth
c91355c8b090ef89f831b56001e4fa0be93a4314
apiary.apib
apiary.apib
FORMAT: 1A HOST: http://polls.apiblueprint.org/ # wheatandcat Polls is a simple API allowing consumers to view polls and vote in them. ## Questions Collection [/questions] ### List All Questions [GET] + Response 200 (application/json) [ { "question": "Favourite programming language?", "published_at": "2015-08-05T08:40:51.620Z", "choices": [ { "choice": "Swift", "votes": 2048 }, { "choice": "Python", "votes": 1024 }, { "choice": "Objective-C", "votes": 512 }, { "choice": "Ruby", "votes": 256 } ] } ] ### Create a New Question [POST] You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices. + Request (application/json) { "question": "Favourite programming language?", "choices": [ "Swift", "Python", "Objective-C", "Ruby" ] } + Response 201 (application/json) + Headers Location: /questions/2 + Body { "question": "Favourite programming language?", "published_at": "2015-08-05T08:40:51.620Z", "choices": [ { "choice": "Swift", "votes": 0 }, { "choice": "Python", "votes": 0 }, { "choice": "Objective-C", "votes": 0 }, { "choice": "Ruby", "votes": 0 } ] }
add apiary
add apiary
API Blueprint
mit
wheatandcat/dotstamp_server,wheatandcat/dotstamp_server,wheatandcat/dotstamp_server
e1ecf5674bc632b935b764779fdd1fa82954157b
doc/RealVirtualInteraction.apib
doc/RealVirtualInteraction.apib
FORMAT: 1A HOST: http://polls.apiblueprint.org/ TITLE: RealVirtualInteraction DATE: 07 Sep 2015 VERSION: v01 PREVIOUS_VERSION: NA APIARY_PROJECT: RealVirtualInteraction # RealVirtualInteraction Specification This specification defines the RealVirtualInteraction API. ## Editors + Sami Jylkkä, Cyberlightning Ltd ## Status This is completed API for virtual Interaction. This specification is licensed under the [FIWARE Open Specification License](http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_Open_Specification_Legal_Notice_%28essential_patents_license%29). ## Copyright All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the publisher, addressed “Attention: Permissions Coordinator,” at the address below. # RealVirtualInteraction Real Virtual Interaction generic enabler (GE) provides means for connecting real world devices consisting of sensors and actuators in to augmented or virtual reality applications. Since the real world sensors and actuators are not complex enough to contain necessary logic to publish themselves outside their immediate domain there needs to be a external service that is able to access these devices and to be able to share the access to other services and also directly to end-users. This service provides security, data base for storing history and offline data, scalability and other cloud-like features that make it easier for application and service developers to make use of the devices in various purposes. This GE also provides a practical prototype for publishing sensor and actuator information application developers derived from NGSI 9/10 format developed earlier in FIWARE. This GE will provide two APIs for accessing sensors or actuators: - API for service developers - API for application developers The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <a href="https://www.ietf.org/rfc/rfc2119.txt">[RFC2119]</a>. The key word REMOTEHOST can be replaced by either IP address or DNS host name. Also port number for middleware service can differ from IANA standard which is 80 for the WebSocket and 8080 for HTTP. The key words GET,POST,PUT and DELETE are http methods and appear capitalized each time they occur in the specifications. Security implementations are not included in this specifications as they are highly dependable on type of middleware service and chosen security level. For controlled public access api-keys or session-ids could be used. Alternatively for private access login information could be included in queries. # API examples for device application developers The Realvirtualinteraction backend will listen to incoming UDP packets and will drop packets that do not conform to the RESTful data format specification (version 1.0). The payload string MAY be Gzip compressed. Below JSON string is an example how the device developers should public sensor/actuator information to the server. The "dataformat_version" field will be removed after the packet is being received by the server and will not be passed on to possible clients subscribed listening for incoming events. For instance the existing logic could be extended to include other fields such as API-KEY to ensure that only registered devices may publish to server. This could be the first step to add a layer of security. ``` { "dataformat_version":"1.0", "d23c058698435eff":{ "d23c058698435eff":{ "sensors":[ { "value":{ "unit":"uT", "primitive":"3DPoint", "time":"2014-02-19 09:40:06", "values":[ 17.819183349609375, 0.07265311479568481, -0.4838427007198334 ] }, "configuration":[ { "interval":"ms", "toggleable":"boolean" } ], "attributes":{ "type":"orientation", "power":0.5, "vendor":"Invensense", "name":"MPL magnetic field" } }, { "value":{ "unit":"uT", "primitive":"3DPoint", "time":"2014-02-19 09:40:06", "values":[ 17.819183349609375, 0.07265311479568481, -0.4838427007198334 ] }, "configuration":[ { "interval":"ms", "toggleable":"boolean" } ], "attributes":{ "type":"gyroscope", "power":0.5, "vendor":"Invensense", "name":"MPL magnetic field" } }, { "value":{ "unit":"uT", "primitive":"3DPoint", "time":"2014-02-19 09:40:06", "values":[ 17.819183349609375, 0.07265311479568481, -0.4838427007198334 ] }, "configuration":[ { "interval":"ms", "toggleable":"boolean" } ], "attributes":{ "type":"magneticfield", "power":0.5, "vendor":"Invensense", "name":"MPL magnetic field" } }, { "value":{ "unit":"m/s2", "primitive":"3DPoint", "time":"2014-02-19 09:40:06", "values":[ 0.006436614785343409, 0.003891906701028347, -0.5983058214187622 ] }, "configuration":[ { "interval":"ms", "toggleable":"boolean" } ], "attributes":{ "type":"linearacceleration", "power":1.5, "vendor":"Google Inc.", "name":"Linear Acceleration Sensor" } } ], "actuators":[ { "configuration":[ { "value":"100", "unit":"percent", "name":"viewsize" } ], "actions":[ { "value":"[marker1,marker2,marker3]", "primitive":"array", "unit":"string", "parameter":"viewstate" } ], "callbacks":[ { "target":"viewstate", "return_type":"boolean" } ], "attributes":{ "dimensions":"[480,800]" } } ], "attributes":{ "name":"Android device" } } } } ``` # API examples for application developers Following code and header samples enable a real-time connection over TCP/IP to be formed with a server application. Once a connection is established, sensor events MAY be pushed to clients from server in real-time. The connection is full-duplex meaning that also a client MAY send messages directly to sensors in through a web server. This sort of full-duplex connection MAY be considered as publish/subscribe type of connection where client MAY choose which sensor to subscribe to receive event updates from. The web service SHALL provide the client a list of available sensors or OPTIONALLY a client MAY use third party service to find sensors. WebSocket SHOULD be then used to form direct connection to the sensors through a IoT Broker type of web server component. <b>JavaScript client sample:</b> ```js function CreateWebSocket() { if ("WebSocket" in window) { ws = new WebSocket("ws://REMOTEHOST"); ws.onopen = function() { alert("Connection established to web server"); }; ws.onmessage = function (evt) { alert("Message received from web server: " + evt.data); }; ws.onclose = function() { alert("Connection is closed..."); }; } else { alert("WebSocket NOT supported by your Browser!"); } } ``` # Group API for Service developers Following shows how backend services SHALL communicate between each other using HTTP GET/POST methods. ## loadBySpatial [/?action=loadBySpatial&lat={lat}&lon={lon}&radius={radius}&maxResults={maxResults}] <b>loadBySpatial</b> can be used for requestuesting all sensors within specific spatial bounding area. geo-coordinate center point and radius in meters. + Parameters + lat: 65.4 (Center latitude) + lon: 25.4 (Center longitude) + radius: 1500 (Search circle radius) + maxResults: 1 (Max number of search results) ### Load sensors by spatial search [GET] Example shows an example where POI middleware service requests all devices available within a specific circular area with a geo-coordinate center point and radius in meters. + Response 200 (application/json) [ { "8587cdb9a135fa2a": { "sensors": [ { "values": [ { "unit": "lx", "time": "2014-02-17 14:35:53", "values": 58.607452, "primitive": "double" } ], "attributes": { "vendor": "Sharp", "name": "GP2A Light sensor", "power": 0.75, "type": "light" }, "configuration": [ { "interval": "ms", "toggleable": "boolean" } ] }, { "values": [ { "unit": "uT", "time": "2014-02-17 14:35:53", "values": [ 10.400009155273438, -16.688583374023438, -37.505584716796875 ], "primitive": "3DPoint" } ], "attributes": { "vendor": "Invensense", "name": "MPL Magnetic Field", "power": 4, "type": "magneticfield" }, "configuration": [ { "interval": "ms", "toggleable": "boolean" } ] }, { "values": [ { "unit": "hPa", "time": "2014-02-17 14:35:53", "values": 989.56, "primitive": "double" } ], "attributes": { "vendor": "Bosch", "name": "BMP180 Pressure sensor", "power": 0.6700000166893005, "type": "pressure" }, "configuration": [ { "interval": "ms", "toggleable": "boolean" } ] } ], "attributes": { "name": "Android device" }, "actuators": [ { "callbacks": [ { "target": "viewstate", "return_type": "boolean" } ], "attributes": { "dimensions": "[720,1184]" }, "configuration": [ { "unit": "percent", "name": "viewsize", "value": "100" } ], "actions": [ { "unit": "string", "parameter": "viewstate", "value": "[marker1,marker2,marker3,]", "primitive": "array" } ] } ] } } ] ## loadById [/?action=loadById&device_id=440cd2d8c18d7d3a&maxResults=1] <b>loadById</b> is used for requesting sensor data based on the device uuid. A device MAY contain any number of sensors and actuators, and in any combination. If the requested sensor or actuator does not have uuid the request MUST target the device containing the desired sensor or actuator. ### Load sensor by Id [GET] Example shows how a middleware service retrieves all available information regarding a specific device by using an uuid string identifier. + Response 200 (application/json) [ { "440cd2d8c18d7d3a": { "actuators": [ { "configuration": [ { "unit": "percent", "name": "viewsize", "value": "100" } ], "callbacks": [ { "return_type": "boolean", "target": "viewstate" } ], "attributes": { "dimensions": "[480,800]" }, "actions": [ { "unit": "string", "primitive": "array", "parameter": "viewstate", "value": "[marker1,marker2,marker13]" } ] } ], "sensors": [ { "configuration": [ { "toggleable": "boolean", "interval": "ms" } ], "values": { { "unit": "rads", "primitive": "3DPoint", "values": [ 21.117462158203125, -0.9801873564720154, -0.6045787930488586 ], "time": "2013-12-10 10:07:30" } }, "attributes": { "vendor": "Invensense", "name": "MPL Gyro", "power": 0.5, "type": "gyroscope" } }, { "configuration": [ { "toggleable": "boolean", "interval": "ms" } ], "values": { { "unit": "ms2", "primitive": "3DPoint", "values": [ 149.10000610351562, 420.20001220703125, -1463.9000244140625 ], "time": "2013-12-10 10:07:30" } }, "attributes": { "vendor": "Invensense", "name": "MPL accel", "power": 0.5, "type": "accelerometer" } }, { "configuration": [ { "toggleable": "boolean", "interval": "ms" } ], "values": { { "unit": "uT", "primitive": "3DPoint", "values": [ -0.08577163517475128, 0.16211289167404175, 9.922416687011719 ], "time": "2013-12-10 10:07:30" } }, "attributes": { "vendor": "Invensense", "name": "MPL magnetic field", "power": 0.5, "type": "magneticfield" } }, { "configuration": [ { "toggleable": "boolean", "interval": "ms" } ], "values": { { "unit": "orientation", "primitive": "3DPoint", "values": [ -0.004261057823896408, -0.017044231295585632, 0.019174760207533836 ], "time": "2013-12-10 10:07:30" } }, "attributes": { "vendor": "Invensense", "name": "MPL Orientation (android deprecated format)", "power": 9.699999809265137, "type": "orientation" } } ], "attributes": { "name": "Android device" } } } ] ## update [/?action=update&device_id={device_id}&sensor_id=display&parameter={parameter}&value={value}] <b>update</b> HTTP POST method can be used for changing updatable sensor values. Real virtual interaction backend uses the <i>device_id parameter</i> and looks up the IP address from reference table and passes only the content of the query forward to the particular sensor. If an IP address is found from the reference table, the server will respond with <code>200 OK</code> without actually knowing whether the message reached its destination as the transport mechanism is UDP. Otherwise server will respond with <code>404 NOT FOUND</code>. + Parameters + device_id: 440cd2d8c18d7d3a () (required, string) - Id of the device to be updated + parameter: viewstate (required, string) - Parameter to be updat + value: marker52 (required, string) - new value ### Update device by Id [POST] Example shows how to use HTTP POST request to turn change augmented reality marker on an Android application remotely. + Response 200
Add apiary file
Add apiary file
API Blueprint
apache-2.0
Cyberlightning/RealVirtualInteraction,Cyberlightning/RealVirtualInteraction,Cyberlightning/RealVirtualInteraction
3087e749e818d0fc503a45867de9c49d576a9999
src/api.apib
src/api.apib
FORMAT: 1A # YOUR AWESOME API NAME *This API blueprint is subject to change due to technology restrictions, performance optimizations or changing requirements.*
Add API Blueprint template file
Add API Blueprint template file
API Blueprint
mit
jsynowiec/api-blueprint-boilerplate,jsynowiec/api-blueprint-boilerplate
19aa16fc3056e9bc7f80338c5116a9d49fcdf530
doc/apiary/apiary.apib
doc/apiary/apiary.apib
FORMAT: 1A HOST: http://cosmos.lab.fiware.org/ # FIWARE-COSMOS API (v1) FIWARE-COSMOS API (v1). This is a cookbook with commands that show how to use FIWARE cosmos API. It's a work in progress and is changing on a daily basis. Please check the following [FIWARE Open Specification Legal Notice (implicit patents license)] (http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_Open_Specification_Legal_Notice_(implicit_patents_license)) to understand the rights to use this document. # Description This resource allows you to obtain a list of subresources published by the API: * version of the current running tidoop * information about jobs running on the current tidoop ## GET tidoop version [GET /tidoop/v1/version] Gets the running version of cosmos-tidoop. + Request GET http://<tidoop_host>:<tidoop_port>/tidoop/v1/version HTTP/1.1 + Headers X-Auth-Token: xXXxxxxxxXXxxxXXXxXXXxxXxxXXxx + Response 200 (application/json) [ { "success": "true", "version": "0.2.0-next" } ] ## GET all jobs [GET /tidoop/v1/user/{userId}/jobs] Gets the details for all the MapReduce jobs run by the given user ID. + Request GET http://<tidoop_host>:<tidoop_port>/tidoop/v1/user/{userId}}/jobs HTTP/1.1 + Headers X-Auth-Token: xXXxxxxxxXXxxxXXXxXXXxxXxxXXxx + Response 200 (application/json) { "success": "true", "jobs": [{ "job_id": "job_1460639183882_0005", "state": "SUCCEEDED", "start_time": "1460963556383", "user_id": "<userId>" }, { "job_id": "job_1460639183882_0004", "state": "SUCCEEDED", "start_time": "1460959583838", "user_id": "<userId>" }] } ## GET a specific job [GET /tidoop/v1/user/{userId}/jobs/{jobId}] Gets the details for a specific MapReduce job run by the given user ID. + Request GET http://<tidoop_host>:<tidoop_port>/tidoop/v1/user/{userId}/jobs/{jobId} HTTP/1.1 + Headers X-Auth-Token: xXXxxxxxxXXxxxXXXxXXXxxXxxXXxx + Response 200 (application/json) { "success": "true", "job": { "job_id": "job_1460639183882_0005", "state": "SUCCEEDED", "start_time": "1460963556383", "user_id": "frb" } } ## POST a specific job in cosmos-tidoop [POST /tidoop/v1/user/{userId}/jobs] Runs a MapReduce job given the following parameters: * Java jar containing the desired MapReduce application. * The name of the MapReduce application. * Any additional library jars required by the application. * The input HDFS directory in the storage cluster. * The output HDFS directory in the storeage cluster. + Request POST http://<tidoop_host>:<tidoop_port>/tidoop/v1/user/{userId}/jobs HTTP/1.1 { "jar": "/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar", "class_name": "wordcount", "lib_jars": "/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar", "input": "mrtest", "output": "output4" } + Headers X-Auth-Token: xXXxxxxxxXXxxxXXXxXXXxxXxxXXxx + Response 200 (application/json) { "success": "true", "job_id": "job_1460639183882_0005" } ## DELETE a job on cosmos-tidoop [DELETE /tidoop/v1/user/{userId}/jobs/{jobId}] Deletes the given MapReduce job run by the given user ID. + Request DELETE http://<tidoop_host>:<tidoop_port>/tidoop/v1/user/{userId}/jobs/{jobId} HTTP/1.1 + Headers X-Auth-Token: xXXxxxxxxXXxxxXXXxXXXxxXxxXXxx + Response 200 (application/json) { "success": "true", }
Add file for apiary documentation
[177][cosmos] Add file for apiary documentation
API Blueprint
agpl-3.0
telefonicaid/fiware-cosmos,telefonicaid/fiware-cosmos,telefonicaid/fiware-cosmos,telefonicaid/fiware-cosmos,telefonicaid/fiware-cosmos
f1cf3a710c27b3f7105bf00d95a48f4863b913c5
apiary.apib
apiary.apib
FORMAT: X-1A # Superdesk API ```in progress``` ## Base Resource Model Resource model is returned when listing any resource, eg. ```GET /users```. + Model (application/json) ```js { "_items": [], "_links": { "self": {"href": "self_url"}, "next": {"href": "next_url"}, "previous": {"href": "prev_url"}, "last": {"href": "last_url"} } } ``` Where ```next```, ```previous``` and ```last``` links are only provided when appropriate. ## Base Item Model Item model is returned when fetching specific item, eg. ```GET /users/1```. + Model (application/json) ```js { "_id": "item_id", "etag": "5a92ccc2c1c5ee0cce0f66c14cc38d912423896f", "created": "2013-10-03T09:45:02", "updated": "2013-10-03T09:45:02", "_links": { "self": { "href": "item_url" } } } ``` # Group users ## GET /users{/_id} Returns a specific user by id. + Parameters + _id (required, string, `ab1`) + Response 200 (application/json) ```js { "is_active": true, "first_name": "karel", "last_name": "badlik", "display_name": "karel balik", "username": "kbadlik", "email": "[email protected]", "user_info": { "skype": "karel.badlik", "phone": "+4207777777", }, "created": "2013-09-23T12:20:21", "updated": "2013-09-23T12:20:21", ... } ``` ## GET /users Returns a list of users. + Parameters + page `1` (optional, number, `10`) + Response 200 (application/json) [Base Resource Model] # Group items ## GET /items{/_id} + Parameters + _id (required, string, `a1`) + Response 200 (application/json) ```js { "guid": "urn:example.com:xyz", "provider": "example.com", "version": 2, "urgency": 4, "firstCreated": "2013-09-23T12:20:21", "versionCreated": "2013-09-23T12:30:05", "slugline" :"ITEM-SLUG", "headline": "News Item", "description": "News item info", "creditline": "EXAMPLE Images", "itemClass": "icls:text", "copyrightHolder": "EXAMPLE", ... } ```
Add apiary blueprint.
Add apiary blueprint.
API Blueprint
agpl-3.0
amagdas/superdesk,darconny/superdesk,marwoodandrew/superdesk-aap,ancafarcas/superdesk,Aca-jov/superdesk,sjunaid/superdesk,superdesk/superdesk,thnkloud9/superdesk,Aca-jov/superdesk,pavlovicnemanja/superdesk,superdesk/superdesk-ntb,mdhaman/superdesk,vied12/superdesk,amagdas/superdesk,pavlovicnemanja/superdesk,gbbr/superdesk,sivakuna-aap/superdesk,ioanpocol/superdesk-ntb,hlmnrmr/superdesk,darconny/superdesk,superdesk/superdesk,darconny/superdesk,akintolga/superdesk-aap,plamut/superdesk,verifiedpixel/superdesk,liveblog/superdesk,verifiedpixel/superdesk,mugurrus/superdesk,pavlovicnemanja92/superdesk,marwoodandrew/superdesk,Aca-jov/superdesk,thnkloud9/superdesk,akintolga/superdesk-aap,sivakuna-aap/superdesk,superdesk/superdesk-aap,superdesk/superdesk-ntb,akintolga/superdesk,akintolga/superdesk,ioanpocol/superdesk,akintolga/superdesk-aap,pavlovicnemanja92/superdesk,thnkloud9/superdesk,vied12/superdesk,amagdas/superdesk,liveblog/superdesk,akintolga/superdesk,marwoodandrew/superdesk,petrjasek/superdesk,fritzSF/superdesk,ancafarcas/superdesk,pavlovicnemanja/superdesk,ioanpocol/superdesk-ntb,sjunaid/superdesk,verifiedpixel/superdesk,marwoodandrew/superdesk-aap,vied12/superdesk,fritzSF/superdesk,ioanpocol/superdesk-ntb,mdhaman/superdesk-aap,marwoodandrew/superdesk,sivakuna-aap/superdesk,ioanpocol/superdesk,hlmnrmr/superdesk,pavlovicnemanja92/superdesk,plamut/superdesk,fritzSF/superdesk,superdesk/superdesk-ntb,mdhaman/superdesk,superdesk/superdesk-aap,sjunaid/superdesk,petrjasek/superdesk,marwoodandrew/superdesk,akintolga/superdesk,gbbr/superdesk,mdhaman/superdesk-aap,marwoodandrew/superdesk-aap,mugurrus/superdesk,pavlovicnemanja92/superdesk,petrjasek/superdesk-ntb,verifiedpixel/superdesk,superdesk/superdesk,liveblog/superdesk,petrjasek/superdesk-ntb,superdesk/superdesk,superdesk/superdesk-aap,mdhaman/superdesk-aap,superdesk/superdesk-aap,akintolga/superdesk-aap,superdesk/superdesk-ntb,plamut/superdesk,mugurrus/superdesk,petrjasek/superdesk,pavlovicnemanja92/superdesk,vied12/superdesk,petrjasek/superdesk,marwoodandrew/superdesk,amagdas/superdesk,hlmnrmr/superdesk,sivakuna-aap/superdesk,mdhaman/superdesk-aap,petrjasek/superdesk-ntb,amagdas/superdesk,marwoodandrew/superdesk-aap,verifiedpixel/superdesk,vied12/superdesk,ioanpocol/superdesk,akintolga/superdesk,sivakuna-aap/superdesk,liveblog/superdesk,plamut/superdesk,mdhaman/superdesk,pavlovicnemanja/superdesk,plamut/superdesk,ancafarcas/superdesk,fritzSF/superdesk,gbbr/superdesk,liveblog/superdesk,fritzSF/superdesk,petrjasek/superdesk-ntb
5a4585a8721dc049df6b5c1dfd85b860d0e0e6ea
api.apib
api.apib
FORMAT: 1A HOST: http://elixre.uk # Elixre API API used by the Elixre regualar expression tester/editor. # Group Regex ## Regex [/regex] ### Perform Regex [POST] Takes a regex with a pattern, modifiers, and subjects, and returns the result of applying the pattern to the subject, if possible. `Regex.scan/3` is used, so all matches inside the subjects will be returned, rather then just the first. + Request (application/json) + Body { "regex": { "pattern": "foo", "modifiers": "iu", "subjects": [ "foobarfoo", "FOOBAR", "barfoo", ], } } + Response 200 A successfully run regex. + Body { "regex": { "pattern": "^foo", "modifiers": "iu", "results": [ { "subject": "foobar", "binaries": ["foo"], "indexes": [[0, 3]] }, { "subject": "FOOBAR", "binaries": ["FOO"], "indexes": [[0, 3]] }, { "subject": "barfoo", "binaries": [], "indexes": [] } ] } }
Document API happy path
Document API happy path
API Blueprint
agpl-3.0
lpil/elixre
54985bab04d62baf5a4765264bc415faaf9fe1ef
polly.apib
polly.apib
FORMAT: 1A HOST: http://pollyhost.org:7980/ # Polly Polly is an API allowing administrators and container schedulers to centrally optimize and govern consumption of storage. Polly implements a centralized storage scheduling service that integrates with popular container schedulers of different application platforms for containerized workloads. It is an open source framework that supports use of external storage, with scheduled containerized workloads, at scale. It can be used to centralize the control of creating, mapping, snapshotting and deleting persistent data volumes on a multitude of storage platforms. ## Questions Collection [/admin/volumes] ### List All Managed Volumes [GET] + Response 200 (application/json) [ { "id": "vol-000", "name": "mesos-casandra", "iops": 135, "networkName", "vlan15", "size": 10240, "status": "online", "type": "nas", "availabilityZone": "east", "fields": { "priority": 2, "owner": "[email protected]" } "volumeid": "pollyvol-005", "serviceName": "ec2-00", "schedulers": [ "kubernetes1", "mesos14" ], "labels": { "admin-applied-label1": "blue", "admin-applied-label2": "aisle-17" } } ] ### Create a New Volume [POST] You may create a volume using this action. It takes a JSON object containing a specification. + Body { "service": "ec2-00", "name": "mysql-vol", "volumeType": "nas", "size": 10240, "iops": 135, "availabilityZone": "east", "schedulers": [ "mesos-15" ], "labels": { "pollyadminappliedlabel1": "foo" }, "fields": { "storageadminappliedlabel1": "bar" } } + Response 201 (application/json) + Headers Location: /admin/volumes/pollyvol-005 + Body { "id": "vol-000", "name": "mysql-vol", "iops": 135, "availabilityZone": "east", "networkName", "", "size": 10240, "status": "online", "type": "nas", "fields": { "storageadminappliedlabel1": "bar" } "volumeid": "pollyvol-005", "serviceName": "ec2-00", "schedulers": [ "mesos-15" ], "labels": { "pollyadminappliedlabel1": "bar" } }
create inital apiary blueprint
create inital apiary blueprint
API Blueprint
apache-2.0
dvonthenen/polly,emccode/polly,dvonthenen/polly,emccode/polly,cantbewong/polly,emccode/polly,cantbewong/polly,cantbewong/polly,emccode/polly,dvonthenen/polly,cantbewong/polly,dvonthenen/polly
8ff351b4bc4dde136d1df59eb94bdfa803cca630
doc/apiary/iotagent.apib
doc/apiary/iotagent.apib
FORMAT: 1A HOST: http://idas.lab.fiware.org TITLE: FIWARE IoT Agents API DATE: December 2016 VERSION: stable APIARY_PROJECT: telefonicaiotiotagents SPEC_URL: https://telefonicaid.github.io/iotagent-node-lib/api/ GITHUB_SOURCE: https://github.com/telefonicaid/iotagent-node-lib ## Copyright Copyright (c) 2014-2016 Telefonica Investigacion y Desarrollo ## License This specification is licensed under the [FIWARE Open Specification License (implicit patent license)](https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Implicit_Patents_License). # IoT Agent Provision API Documentacion An [IoT Agent](https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus) is a component that mediates between a set of Devices using their own native protocols and a NGSI compliant Context Provider (i.e. Fiware Context Broker). This documentation covers the IoT Agent Provision API and the resources you can manipulate on an IoT Agent in order to publish custom information in IoT Platform. The IoT Agent Provision API is based on REST principles. |Allowed HTTPs requests | | |:---------------------------|:----------------------------------------| |POST: |Creates a resource or list of resources | |PUT: |Updates a resource | |GET: |Retrieves a resource or list of resources| |DELETE: |Delete a resource | |Server Responses | | |:---------------------------|:--------------------------------------------------------------------------------------------------| |200 OK |The request was succesful (some API calls may return 201 instead) | |201 Created |The request was succesful and a resource or list of resources was created | |204 No Content |The request was succesful but there is no representation to return (that is, the response is empty)| |400 Bad Request |The request could not be understood or was missing required parameters | |401 Unauthorized |Authentication failed | |403 Forbidden |Access denied | |404 Not Found |Resource was not found | |409 Conflict |A resource cannot be created because it already exists | |500 Internal Server Error |Generic error when server has a malfunction. This error will be removed | Responses related with authentication and authorization depends on this feature is configured and a Keystone OpenStack sytem is present. When an error is returned, a representation is returned as: ``` { "reason": "contains why an error is returned", "details": "contains specific information about the error, if possible" } ``` ## Authentication and Authorization If the IoT Agent is in authenticated environment, this API requires a token, which you obtain from authentication system. This system and its API is out of scope of present documentation. In this environment, a mandatory header is needed: `X-Auth-Token`. ## Mandatory HTTP Headers The API needs two headers in order to manage requests: |Http Header |Level |If not present |Observations | |:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------| |<b>Fiware-Service</b> |Represents a tenant. Higher level in resources hierachy in IoT Platform |An error is returned |Must only contain less than 50 Underscores and Alphanumeric lowercase characters | |<b>Fiware-ServicePath</b> |Represents the second level |We assume '/'. Allowed operation '/*'|Must only contain less than 50 Underscores and Alphanumeric characters. Must start with character '/'. Max. length is 51 characters (with /)| ## API Access All API base URLs are relative and depend on where the IoT Agent is listening (depends on each service). For example, `http://127.0.0.1:8080/iot/`. # Group Configuration API ## Services [/services{?limit,offset,resource,apikey,device}] Services are the higher level in IoT Platform. When you manipulate a service, you use a Fiware-Service header with its name. Parameters apply to different operations. Fields in JSON object representing a service are: |Fields in JSON Object | | |:-----------------------|:------------------------------------------------------------| |`apikey` |It is a key used for devices belonging to this service. If "", service does not use apikey, but it must be specified.| |`token` |If authentication/authorization system is configured, IoT Agent works as user when it publishes information. That token allows that other components to verify the identity of IoT Agent. Depends on authentication and authorization system.| |`cbroker` |Context Broker endpoint assigned to this service, it must be a real uri.| |`outgoing_route` |It is an identifier for VPN/GRE tunnel. It is used when device is into a VPN and a command is sent.| |`resource` |Path in IoTAgent. When protocol is HTTP a device could send information to this uri. In general, it is a uri in a HTTP server needed to load and execute a module.| |`entity_type` |Entity type used in entity publication (overload default).| |`attributes` |Mapping for protocol parameters to entity attributes.<br> `object_id` (string, mandatory): protocol parameter to be mapped.<br> `name` (string, mandatory): attribute name to publish.<br> `type`: (string, mandatory): attribute type to publish.| |`static_attributes` |Attributes published as defined.<br> `name` (string, mandatory): attribute name to publish.<br> `type` (string, mandatory): attribute type to publish.<br> `value` (string, mandatory): attribute value to publish.| Mandatory fields are identified in every operation. `static_attributes` and `attributes` are used if device has not this information. ### Retrieve a service [GET] With Fiware-ServicePath you can retrieve a subservice or all subservices. + Parameters [limit, offset, resource] + `limit` (optional, number). In order to specify the maximum number of services (default is 20, maximun allowed is 1000). + `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) . + `resource` (optional, string). URI for the iotagent, return only services for this iotagent. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /* + Response 200 + Body { "count": 1, "services": [ { "apikey": "apikey3", "service": "service2", "service_path": "/srvpath2", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 200 + Body { "count": 1, "services": [ { "apikey": "apikey3", "service": "service2", "service_path": "/srvpath2", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } ### Create a service [POST] With one subservice defined in Fiware-ServicePath header. From service model, mandatory fields are: apikey, resource (cbroker field is temporary mandatory). + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "services": [ { "apikey": "apikey3", "token": "token2", "cbroker": "http://127.0.0.1:1026", "entity_type": "thing", "resource": "/iot/d" } ] } + Response 201 ### Update a service/subservice [PUT] If you want modify only a field, you can do it. You cannot modify an element into an array field, but whole array. ("/*" is not allowed). + Parameters [apikey, resource] + `apikey` (optional, string). If you don't specify, apikey=" " is applied. + `resource` (mandatory, string). URI for service into iotagent. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "entity_type": "entity_type" } + Response 204 ### Remove a subservice/service [DELETE] You remove a subservice into a service. If Fiware-ServicePath is '/*' or '/#' remove service and all subservices. + Parameters [apikey, resource, device] + `apikey` (optional, string). If you don't specify, apikey="" is applied. + `resource` (mandatory, string). URI for service into iotagent. + `device` (optional, boolean). Default value is false. Remove devices in service/subservice. This parameter is not valid when Fiware-ServicePath is '/*' or '/#'. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 204 ## Devices [/devices{?limit,offset,detailed,protocol,entity}] A device is a resource that publish information to IoT Platform and it uses the IoT Agent. ### Device Model - `device_id`. Unique identifier into a service. - `protocol`. Protocol assigned to device. This field is easily provided by IoTA Manager if it is used. Every module implmenting a protocol has an identifier. - `entity_name`. Entity name used for entity publication (overload default) - `entity_type`. Entity type used for entity publication (overload entity_type defined in service). - `timezone`. Not used in this version. - `attributes`. Mapping for protocol parameters to entity attributes. `object_id` (string, mandatory): protocol parameter to be mapped. `name` (string, mandatory): attribute name to publish. `type`: (string, mandatory): attribute type to publish. - `static_attributes` (optional, array). Attributes published as defined. `name` (string, mandatory): attribute name to publish. `type` (string, mandatory): attribute type to publish. `value` (string, mandatory): attribute value to publish. - `endpoint` (optional, string): when a device uses push commands. - `commands` (optional, array). Attributes working as commands. `name` (string, mandatory): command identifier. `type` (string, mandatory). It must be 'command'. `value` (string, mandatory): command representation depends on protocol. Mandatory fields are identified in every operation. ### Retrieve all devices [GET] + Parameters [limit, offset, detailed, entity, protocol] + `limit` (optional, number). In order to specify the maximum number of devices (default is 20, maximun allowed is 1000). + `offset` (optional, number). In order to skip a given number of elements at the beginning (default is 0) . + `detailed` (optional, string). `on` return all device information, `off` (default) return only name. + `entity` (optional, string). It allows get a device from entity name. + `protocol` (optional, string). It allows get devices with this protocol. + Request (application/json) + Headers Fiware-Service: testService Fiware-ServicePath: /TestSubservice + Response 200 + Body { "count": 1, "devices": [ { "device_id": "device_id", "protocol": "12345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ] } ### Create a device [POST] From device model, mandatory fields are: device_id and protocol. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "devices": [ { "device_id": "device_id", "protocol": "12345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ] } + Response 201 + Headers (only if ONE device is in request) Location: /iot/devices/device_id + Response 400 { "reason": "parameter limit must be an integer" } + Response 404 ## Device [/devices/{device_id}] ### Retrieve a device [GET] + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 200 + Body { "device_id": "device_id", "protocol": "121345", "entity_name": "entity_name", "entity_type": "entity_type", "timezone": "America/Santiago", "attributes": [ { "object_id": "source_data", "name": "attr_name", "type": "int" } ], "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } ### Update a device [PUT] If you want modify only a field, you can do it, except field `protocol` (this field, if provided it is removed from request). + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Body { "entity_name": "entity_name" } + Response 204 ### Remove a device [DELETE] If specific device is not found, we work as deleted. + Request (application/json) + Headers Fiware-Service: testservice Fiware-ServicePath: /TestSubservice + Response 204
ADD apib file with the API specification
ADD apib file with the API specification
API Blueprint
agpl-3.0
telefonicaid/iotagent-node-lib,telefonicaid/iotagent-node-lib,caiothomas/iotagent-node-lib,telefonicaid/iotagent-node-lib,caiothomas/iotagent-node-lib,caiothomas/iotagent-node-lib
475fb2137da9290c03a1fd4b976ce7c4165ddf3d
api.apib
api.apib
FORMAT: 1A # Pantry Pantry is a simple API for hardware leasing. # Group Targets ## Target Collection [/targets] ### List all available targets [GET] List all available targets in the pool. + Response 200 (application/json) + Attributes (Targets) ### Create a new target [POST] Make a new target available for leasing. + Request (application/json) + Attributes (Target) + Response 201 (application/json) Location: /targets/1 + Attributes (Target) ## Target [/targets/{targetid}] Single target operations. + Parameters + targetid: 1 (number) - Integer id of the target ### Get single target [GET] Get information on a single target. + Response 200 (application/json) + Attributes (Target) ### Delete single target [DELETE] Delete the target indicated by the id parameter. + Response 204 ## Data Structures ### Target + hostname: Sune (string, required) + description: Sune's machine (string, required) ### Targets + targets (array[Target]) # Group Leases ## Lease Collection [/leases] ### List all leases [GET] List all known leases. + Response 200 (application/json) + Attributes + leases: Lease, Lease (array[Lease], required) ## Data Structures ### Lease + state (enum, required) + assigningtargets + ended + active ### Leases + leases (array[Lease], required)
Add api blueprint docs
Add api blueprint docs
API Blueprint
bsd-2-clause
abbec/pantry
e131f02e5617a4d2d0442ef489bdcecd3a6ec9ed
doc/apiary.apib
doc/apiary.apib
FORMAT: X-1A # Machines API # Group Machines # Machines collection [/machines] ## Create a Machine [POST] + Request (application/json) { "type": "bulldozer", "name": "willy" } + Response 202 (application/json) { "message": "Accepted" } ## Retreive all Machines [GET] + Response 200 (application/json) [{ "_id": "52341870ed55224b15ff07ef", "type": "bulldozer", "name": "willy" }] # Machine [/machines/{name}] + Parameters + name (required,`willy`) ## Retrieve a Machine [GET] + Response 200 (application/json) { "type": "bulldozer", "name": "willy", "_id": "5229c6e8e4b0bd7dbb07e29c" } ## Delete Message [DELETE] + Response 204
Create apiary.apib
Create apiary.apib
API Blueprint
mit
yannickcr/test
6c062900a9e2c8c02e36637f5318a0cc1faac352
git-comment-web/git-comment-web.apib
git-comment-web/git-comment-web.apib
FORMAT: 1A # Git Comment Git Comment API allowing consumers to view commit diffs and add comments ## Commits [/commits/{revisions}] + Parameters + revisions: `45e1ffa9` (string) - revision range + Attributes + files (array[DiffFile]) - files changed + metrics (array[Metric]) - changeset metadata + revisions: `45e1ffa9` (string) - revision range ### View the changed content of a set of commits [GET] + Request (application/json) + Attributes + revisions: `3bc37cb..9d7022f` (required, string) Commit revision range as specified by `gitrevisions(7)`. If the range resolves to a single revision, then it is compared against the HEAD commit + `context_lines`: `4` (optional, number) - Number of lines of context to show before and after changed lines. Defaults to the configured option for the repository + Response 200 (application/json) + Attributes ### Create a comment [POST] + Request (application/json) + Attributes + content: `need more space here` (required, string) - The body of the comment + fileref: `src/file.c:12` (optional, string) - The file and line to annotate, delimited by a colon + Response 201 (application/json) + Attributes ## DiffFile [/commits/{revisions}/file] + Parameters + revisions: `45e1ffa9` (string) - revision range + Attributes + path: `src/file.c` (string) - Path of the file relative to the repo root + lines (array[DiffLine]) - Lines added or removed ### View which lines were changed of a particular file [GET] + Request (application/json) + Attributes + path: `src/local/file.c` (required, string) - File path relative to the repo root + `context_lines`: `4` (optional, number) - Number of lines of context to show before and after changed lines + Response 200 (application/json) + Attributes ## DiffLine [/commits/{revisions}/line] + Parameters + revisions: `45e1ffa9` (string) - revision range + Attributes + type: `ADDED`, (required, enum) - Indicator for whether the line was added, removed, or displayed for context + Items + Members + `ADDED` + `REMOVED` + `CONTEXT` + content (required, string) - The text content of the line + oldlineno: 402 (optional, number) - The line number before the revisions, if any + newlineno: 401 (optional, number) - The line number after the revisions, if any + comments (required, array[Comment]) ## Comment [/comment/{id}] + Parameters + id: `3bc37cb42a9d7022f350d50447dd42aefb8ce158` (string) - comment identifier + Attributes + id: `3bc37cb42a9d7022f350d50447dd42aefb8ce158` (string) - comment identifier + content: `needs whitespace here` (string) + commit: `3bc37cb42a9d7022f350d50447dd42aefb8ce158` (string) + `author_name`: `Delisa` (string) + `author_email`: `[email protected]` (string) ## View a comment [GET] + Request (application/json) + Attributes + id (required, string) The ID of a comment + Response 200 (application/json) + Attributes ## Metric [/commits/{revisions}/metric] + Parameters + revisions: `45e1ffa9` (string) - revision range + Attributes + name: `ADDED` (enum) + Items + Members + `ADDED` + `REMOVED` + `FILES_CHANGED` + value: `24` (number) ### View a metric value [GET] + Response 200 (application/json) + Attributes
Add proposed API for git-comment-web
Add proposed API for git-comment-web
API Blueprint
bsd-2-clause
git-comment/git-comment,git-comment/git-comment,git-comment/git-comment,git-comment/git-comment,git-comment/git-comment,git-comment/git-comment
4428b3da71fcfdf76e5ce4f95af9ccf5cf921586
blueprint/designsystem.apib
blueprint/designsystem.apib
FORMAT: 1A HOST: https://thegrid.io/ # Design systems The Design System is the piece of The Grid that builds a webpage from page content. A set of design systems are provided by The Grid. These use techiques like finite-domain constraint solvers, decision trees, content analysis, and polyrythmic pagination in order to produce a page which: * Is *content driven*, reflects the particular items on the page * Is *visually pleasing*, respecting the users site preferences * Is *effective* at achieving the purpose set by the user In the future, we intent to support "plugins" which can hook into and extend existing design systems. Such plugins could build sections for particular types of data, extend content analysis or heruristics, add or modify rhythms (scoring functions). In the meantime the *daring and ambitious* may implement an full design system using the mechanism below. # API A design system is deployed as a `.js` file, and runs sandboxed in a browser. On the server-side this is PhantomJS (with function.bind polyfill), on client-side it runs in a WebWorker (no access to DOM). The design system must expose a `polySolvePage` function as an entry point. window.polySolvePage = function (page, options, callback) { var html = ""; var err = null; return callback(err, html, details); }; The function will be called with a [Page object](https://github.com/the-grid/apidocs/blob/master/schemata/page.yaml) containing the data to be put on the page. The `page` also includes the [Site config](https://github.com/the-grid/apidocs/blob/master/schemata/siteconfig.yaml) for the particular page. The `callback` should be called with the HTML page produced by the design system, or an `Error` object in case of failure. `details` may be an object with design-system specific information about the produced page or failure, for use in debugging and/or machine learning. Assets in the produced HTML page must either be inlined in the HTML (recommended for CSS, GSS), or refer to a *stable* URL on a HTTPS enabled CDN (recommended for fonts, images). <!-- TODO: - give example code of the simplest possible system - describe article versus feed pages - describe ordered versus non-ordered mode - describe/show how to run a page build locally --> # Use custom design system The settings for running a custom design system on The Grid are currently not publically exposed. Interested in running your own design system? [Get in touch](https://github.com/the-grid/apidocs/issues/new)! # Tools Designs systems are complex beasts. In order to create them we have built a set of libraries, services and tools. Several of these are already open source: - [Grid Style Sheets](gridstylesheets.org) (GSS), constraint-based layout system - [imgflo](http://imgflo.org), on-demand server-side image processing. Helpers: [RIG](https://github.com/the-grid/rig) and [imgflo-url](https://github.com/the-grid/imgflo-url) - [Grid Object Model](https://github.com/the-grid/gom) (GOM), HTML templating and transformations More to be released soon!
Add initial docs about design systems
Add initial docs about design systems
API Blueprint
mit
the-grid/apidocs,the-grid/apidocs,the-grid/apidocs,the-grid/apidocs
42049c38900028d4980187d94670da43a96dabfd
extremo.apib
extremo.apib
FORMAT: 1A HOST: http://polls.apiblueprint.org/ # Extremo Extremo is an API for fetching research related content (notes, commentaries, essays, etc) produced by a researcher probably in the humanities. # Extremo API Root [/] This resource does not have any attributes. Instead it offers the initial API affordances. ## Retrieve the Entry Point [GET] + Response 200 (application/hal+json) { "_links": { "questions": { "href": "/notes" } } } ## Notes collection [/notes{?page}] + Parameters + page (optional, number, `1`) ... The page of questions to return ### List All Notes [GET] + Response 200 (application/hal+json) { "_links": { "self": { "href": "/notes" }, "next": { "href": "/notes?page=2" } }, "_embedded": { "notes": [ { name: 'test.md', sha: '559430b6bc52ab25846c528fbff56032162e2216', rawsize: 95, blob: '### This is a note\n\nIt doesn\'t have much in it yet. \nNow it has a bit more.\nAnd now even more.\n', updated_at: 2016-12-05T16:04:25.000Z, created_at: 2016-12-03T14:21:27.000Z, history: [ { sha: '69c7df3ed6a50359d0c19df97b8c8ebe21dd2399', date: 2016-12-05T16:04:25.000Z }, { sha: '188c1161743983a0199760385a55c6a7450dc6ba', date: 2016-12-04T17:43:45.000Z }, { sha: 'd909ade91aae7970a34ba91e800493f9bac7d473', date: 2016-12-03T14:21:27.000Z } ] }, { name: 'test2.md', sha: '72fa01795e79e8c64bd1719cb2dcebd7f88a5082', rawsize: 53, blob: '### This is a note\n\nIt doesn\'t have much in it yet. \n', updated_at: 2016-12-03T19:02:46.000Z, created_at: 2016-12-03T19:02:46.000Z, history: [ { sha: '01113285f7f7f36394473f6820cd6ce6fd28dd13', date: 2016-12-03T19:02:46.000Z } ] } ] } }
Add API Blueprint draft
Add API Blueprint draft
API Blueprint
epl-1.0
ezmiller/extremo
05f8792ba7c4d0c3bc0573db5a9d1393f16658c0
blueprint.apib
blueprint.apib
HOST: https://bluepaste.herokuapp.com # Bluepaste Bluepaste is a pastebin service for API Blueprint allowing you to store API Blueprints and view the source of the blueprint, the AST or a rendered version. ## Group Blueprint ### Root Resource [/] #### Create Blueprint [POST] + Relation: create + Attributes + blueprint: `# Bluepaste` (string, required) + expires: 30 (number) - Amount of seconds until the blueprint should expire and be deleted + Default: 1209600 + Request (application/json) + Headers Accept: application/json + Attributes + Response 201 (application/json; charset=utf8) + Attributes (Blueprint) ### Blueprint [/{blueprint}] + Parameters + blueprint: 73cdaf7a + Attributes + revisions (array[Revision]) + expires: `2015-07-30T17:56:39.586642` ### Revision [/{blueprint}/{revision}] + Parameters + blueprint: 73cdaf7a + revision: 2b7326c8 + Attributes + message: Initial blueprint + content: `# Bluepaste` - API Blueprint in Markdown form + ast (object) - API Blueprint AST
Include a blueprint for bluepaste
Include a blueprint for bluepaste
API Blueprint
mit
kylef/bluepaste,kylef/bluepaste
c2dc3d8353f066c4be0325106506e422b1a4729e
apiary.apib
apiary.apib
FORMAT: 1A HOST: https://awesome-bucketlist-api.herokuapp.com/ # awesome-bucketlist Polls is a simple API allowing consumers to view polls and vote in them. ## Bucketlists [/bucketlists] ### Create New Bucketlist [POST] Creates a new bucketlist under your account. + Request (application/json) + Headers Authorization: "Your Token" + Response 201 (application/json) [ { "name": "Dare Devil", "description": "Stunts I want to try out." } ] ### Get All Bucketlists [GET] You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices. + Request (application/json) + Headers Authorization: "Your Token" + Response 200 (application/json) + Body [ { "name": "Dare Devil", "description": "Stunts I want to try out." } ]
Add Apiary Documentation for the API
Add Apiary Documentation for the API
API Blueprint
mit
brayoh/bucket-list-api
8e21ce80106238a622a145d9752bd0583b7ce834
apiary.apib
apiary.apib
FORMAT: 1A # Keypass Keypass is multi-tenant XACML server with PAP (Policy Administration Point) and PDP (Policy Detention Point) capabilities. Tenancy is defined by means of an HTTP header. Default configuration uses `Fiware-Service` as the tenant header name, but it can be easily changed modifying it in the config file. The PDP endpoint will evaluate the Policies for the subjects contained in a XACML request. This is a design decision took by Keypass in order to simplify how the application is used. You, as a developer, may wonder what a subject is, and why policies are grouped around them. To simplify, a subject is the same you put in a `subject-id` in an XACML request. You can then structure your user, groups and roles as usual in your preferred Identity Management system, just taking into account that those `ids` (subject, roles, groups) shall be used in your PEP when building the XACML request. Applying the policies per subject means that policies must be managed grouping them by subject. Keypass PAP API is designed to accomplish this. As XACML is an XML specification, Keypass API offers an XML Restful API. From the PAP REST point of view, the only resource is the Policy, with resides in a Subject of a Tenant. Both Tenant and Subject may be seen as namespaces, as they are not resources _per se_ . # Group PAP Policy Administration Point ## Policies [/pap/v1/subject/:id] + Model (application/xml) + Headers ``` Fiware-Service: myTenant ``` + Body ```xml <PolicySet xmlns:ns0="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:ns1="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" ns0:PolicySetId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides" ns1:Version="1.0"> <Policy xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17 http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd" PolicyId="policy03" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit" Version="1.0" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Target> <AnyOf> <AllOf> <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string" >fiware:orion:.*</AttributeValue> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" /> </Match> </AllOf> </AnyOf> </Target> <Rule RuleId="policy03rule01" Effect="Permit"> <Condition> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" /> </Apply> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string" >read</AttributeValue> </Apply> </Condition> </Rule> </Policy> </PolicySet> ``` + Parameters + id (string) ... Subject identifier, used to group policies ### Create a Policy [POST] + Request [Policy][] + Response 201 + Headers Location: http://KEYPASS_HOST/pap/v1/subject/:id/policy/:policyId ### Get Subject Policies [GET] + Request + Headers ``` Fiware-Service: myTenant ``` + Response 200 [Policies][] ### Delete all Subject Policies [DELETE] + Request + Headers ``` Fiware-Service: myTenant ``` + Response 204 ## Tenant [/pap/v1] ### Delete all Tenant Policies [DELETE] + Request + Headers ``` Fiware-Service: myTenant ``` + Response 204 ## Policy [/pap/v1/subject/:id/policy/:policyId] + Parameters + id (string) ... Subject identifier, used to group policies + policyId (string) ... Policy Identifier + Model (application/xml) + Headers ``` Fiware-Service: myTenant ``` + Body ```xml <Policy xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17 http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd" PolicyId="policy03" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit" Version="1.0" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Target> <AnyOf> <AllOf> <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string" >fiware:orion:.*</AttributeValue> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" /> </Match> </AllOf> </AnyOf> </Target> <Rule RuleId="policy03rule01" Effect="Permit"> <Condition> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only"> <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" /> </Apply> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string" >read</AttributeValue> </Apply> </Condition> </Rule> </Policy> ``` ### Get a Policy [GET] + Request [Policy][] + Response 200 [Policy][] + Response 404 ### Update a Policy [PUT] + Request [Policy][] + Response 200 [Policy][] + Response 404 ### Delete a Policy [DELETE] + Request + Headers ``` Fiware-Service: myTenant ``` + Response 200 [Policy][] + Response 404 # Group PDP Policy Decision Point ## Validation [/pdp/v3] ### Validate requests [POST] + Request + Headers ``` Fiware-Service: myTenant ``` + Body ```xml <Request xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17 http://docs.oasis-open.org/xacml/3.0/xacml-core-v3-schema-wd-17.xsd" ReturnPolicyIdList="false" CombinedDecision="false" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"> <Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">role12345</AttributeValue> </Attribute> </Attributes> <Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"> <Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">fiware:orion:tenant1234:us-west-1:res9876</AttributeValue> </Attribute> </Attributes> <Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action"> <Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue> </Attribute> </Attributes> </Request> ``` + Response 200 ```xml <Response xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"> <Result> <Decision>NotApplicable</Decision> <Status> <StatusCode Value="urn:oasis:names:tc:xacml:1.0:status:ok"/> </Status> </Result> </Response> ```
ADD apiary documentation
ADD apiary documentation
API Blueprint
apache-2.0
telefonicaid/fiware-keypass,telefonicaid/fiware-keypass,telefonicaid/fiware-keypass
628fc01c54c2eb0c2960374800e2305438f49c49
dina-collections.apib
dina-collections.apib
FORMAT: 1A # DINA Restful Service API ## How to use dina-service API as a generic web service. This is an introduction to accessing the dina-service API using the curl command line utility. These examples illustrate use with a demo server on localhost. Substitute an appropriate hostname as necessary. ## Making API requests ### GET method Search by id Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/{entity}/{id} Example: Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/Collectionobject/415 | json_pp Response: { "id" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobject/425", "collectionID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collection/163840", "collectingEventID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectingevent/321", "projectNumber" : null, "restrictions" : null, "notifications" : null, "collectionObjectID" : 425, "name" : null, "countAmt" : null, "appraisalID" : null, "altCatalogNumber" : null, "preparation" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Preparation/425" ], "text1" : null, "timestampCreated" : 1248358254000, "remarks" : "Öl. Högsrum\r\nEkerum\r\n1/7-40\r\ncoll.E.Wieslander\r\n\r\nVIDE VKBS\r\n1998 EU-\r\nPRIO SPP.\r\n\r \nNHRS-COLE\r\n000000879", "version" : 1, "sgrstatus" : null, "catalogedDatePrecision" : 1, "collectionMemberID" : 163840, "modifiedByAgentID" : null, "catalogerID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/2" "determination" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Determination/425" ], "ocr" : null, "guid" : "b2457e4a-096f-11e3-b717-0050568c2f15", "catalogNumber" : "NHRS-COLE000001785", "fieldNumber" : null, "availability" : null, "fieldNotebookPageID" : null, "paleoContextID" : null, "visibility" : null, "containerID" : null, "catalogedDate" : "2008-04-18", "catalogedDateVerbatim" : null, "createdByAgentID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/1", "inventoryDate" : null, "description" : null, "containerOwnerID" : null, "deaccessioned" : null, "collectionObjectAttributeID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobjectattribute/425", "accessionID" : null, "timestampModified" : 1248358254000, "number2" : null, "reservedText" : null, "objectCondition" : null, "modifier" : null, "totalValue" : null } Search by entity name Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/{entity} or Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/{entity}?offset=200&minid=200&maxid=500&limit=3&orderby=orderby1,orderby2,… Example: Request: curl -H "Accept:application/json" http://localhost:8080Reque/dina-service/dina/v1/Collectionobject | json_pp Response: ** Lost of data ** By default twenty rows will be returned. The limit query parameter can be used to adjust the amount. The maximum of rows can be request is 10000. Request: curl -H "Accept:application/json" "http://localhost:8080/dina-service/dina/v1/Collectionobject?offset=2000&minid=2200&maxid=5000&limit=2&orderby=collectionMemberID,remarks" | json_pp ** Two rows returned ** [ { "id" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobject/2817", "collectionID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collection/163840", "collectingEventID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectingevent/1373", "createdByAgentID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/1", "paleoContextID" : null, "collectionObjectID" : 2817, "accessionID" : null, "remarks" : "'WM'\r\nHls.\r\n\r\nCOLL. JOHAN WISTRÖM 'WM'\r\n*1830 -+1896 (WSM)\r\nBOSATT HS. HUDIKSVALL\r\n\r\nNHRS-COLE\r\n000002839", "catalogNumber" : "NHRS-COLE000002839", "appraisalID" : null, "timestampModified" : null, "fieldNumber" : null, "containerOwnerID" : null, "projectNumber" : null, "name" : null, "catalogedDate" : "2008-07-18", "sgrstatus" : null, "fieldNotebookPageID" : null, "description" : null, "totalValue" : null, "objectCondition" : null, "catalogedDateVerbatim" : null, "visibility" : null, "collectionMemberID" : 163840, "deaccessioned" : null, "visibilitySetByID" : null, "ocr" : null, "restrictions" : null, "guid" : "b265fb70-096f-11e3-b717-0050568c2f15", "altCatalogNumber" : null, "timestampCreated" : 1248989609000, "catalogedDatePrecision" : 1, "preparation" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Preparation/2814" ], "availability" : null, "inventoryDate" : null, "containerID" : null, "notifications" : null, "modifier" : null, "determination" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Determination/2814" ], "modifiedByAgentID" : null, "version" : 1, "catalogerID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/2", "countAmt" : null, "collectionObjectAttributeID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobjectattribute/2817" }, { "id" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobject/4537", "collectionID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collection/163840", "collectingEventID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectingevent/649", "accessionID" : null, "remarks" : "056. 27/7\r\n\r\nAromia \r\nmoschata\r\n\r\nNHRS-COLE\r\n000005086", "paleoContextID" : null, "collectionObjectID" : 4537, "createdByAgentID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/1", "appraisalID" : null, "timestampModified" : null, "fieldNumber" : null, "catalogNumber" : "NHRS-COLE000005086", "fieldNotebookPageID" : null, "sgrstatus" : null, "catalogedDate" : "2008-09-18", "containerOwnerID" : null, "projectNumber" : null, "name" : null, "visibility" : null, "catalogedDateVerbatim" : null, "objectCondition" : null, "description" : null, "totalValue" : null, "guid" : "b2855fb0-096f-11e3-b717-0050568c2f15", "ocr" : null, "restrictions" : null, "collectionMemberID" : 163840, "deaccessioned" : null, "visibilitySetByID" : null, "preparation" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Preparation/4534" ], "altCatalogNumber" : null, "catalogedDatePrecision" : 1, "timestampCreated" : 1249022199000, "containerID" : null, "reservedText" : null, "inventoryDate" : null, "availability" : null, "yesNo5" : null, "integer1" : null, "collectionObjectAttributeID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobjectattribute/4537", "modifier" : null, "determination" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Determination/4534" ], "version" : 1, "modifiedByAgentID" : null, "countAmt" : null, "catalogerID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/2", "notifications" : null } ] Filtering Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/{entity}/search?offset=200&minid=200&maxid=500&limit=20&orderby=orderby1,orderby2,…&{key1=value1&key2=value2….} Example: Request: curl -H "Accept:application/json" "http://localhost:8080/dina-service/dina/v1/Collectionobject/search?offset=2000&minid=2200&maxid=5000&limit=3&collectingEventID=507&collectionMemberID=163840&orderby=collectionMemberID,remarks" | json_pp ** Three rows returned with collectionMemberID=163840, collectingEventID=507 ** Response: [ { "id" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobject/2377", "containerOwnerID" : null, "collectionMemberID" : 163840, "collectionID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collection/163840", "collectingEventID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectingevent/507", "paleoContextID" : null, "ocr" : null, "collectionObjectID" : 2377, "fieldNumber" : null, "restrictions" : null, "modifiedByAgentID" : null, "timestampCreated" : 1248989032000, "projectNumber" : null, "modifier" : null, "containerID" : null, "catalogerID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/2", "catalogedDateVerbatim" : null, "catalogedDatePrecision" : 1, "visibilitySetByID" : null, "version" : 1, "notifications" : null, "altCatalogNumber" : null, "timestampModified" : null, "objectCondition" : null, "remarks" : "ÖG\r\n\r\ncoll. Axel OLSSON\r\n*1888 +1963 (OLS)\r\n\r\nNHRS-COLE\r\n000002386", "countAmt" : null, "inventoryDate" : null, "createdByAgentID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/1", "sgrstatus" : null, "determination" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Determination/2374" ], "reservedText" : null, "deaccessioned" : null, "fieldNotebookPageID" : null, "preparation" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Preparation/2374" ], "catalogNumber" : "NHRS-COLE000002386", "totalValue" : null, "description" : null, "collectionObjectAttributeID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobjectattribute/2377", "accessionID" : null, "catalogedDate" : "2008-07-10", "name" : null, "availability" : null, "appraisalID" : null, "visibility" : null, "guid" : "b25d0448-096f-11e3-b717-0050568c2f15" }, { "id" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobject/3877", "collectionID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collection/163840", "collectingEventID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectingevent/507", "restrictions" : null, "fieldNumber" : null, "collectionObjectID" : 3877, "ocr" : null, "paleoContextID" : null, "collectionMemberID" : 163840, "containerOwnerID" : null, "timestampModified" : null, "altCatalogNumber" : null, "notifications" : null, "version" : 1, "visibilitySetByID" : null, "catalogedDatePrecision" : 1, "catalogedDateVerbatim" : null, "catalogerID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/2", "containerID" : null, "projectNumber" : null, "modifier" : null, "timestampCreated" : 1249010973000, "modifiedByAgentID" : null, "catalogNumber" : "NHRS-COLE000003892", "preparation" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Preparation/3874" ], "fieldNotebookPageID" : null, "deaccessioned" : null, "reservedText" : null, "determination" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Determination/3874" ], "sgrstatus" : null, "createdByAgentID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/1", "inventoryDate" : null, "countAmt" : null, "remarks" : "Ög\r\n\r\nCOLL. CARL HOFFSTEIN\r\n*1850 -+1916 (HFS)\r\n\r\nLEPTURINAE\r\nJ U D O L I A\r\ncerambyciformis (Schr.)\r\ndet.D.Borisch,-88\r\n\r\nNHRS-COLE\r\n000003892", "objectCondition" : null, "guid" : "b27b8346-096f-11e3-b717-0050568c2f15", "visibility" : null, "appraisalID" : null, "name" : null, "availability" : null, "catalogedDate" : "2008-08-25", "accessionID" : null, "collectionObjectAttributeID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobjectattribute/3877", "totalValue" : null, "description" : null, }, { "id" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobject/3656", "collectionID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collection/163840", "collectingEventID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectingevent/507", "fieldNotebookPageID" : null, "deaccessioned" : null, "preparation" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Preparation/3653" ], "catalogNumber" : "NHRS-COLE000003665", "objectCondition" : null, "countAmt" : null, "remarks" : "Ög\r\n\r\nCOLL. CARL HOFFSTEIN\r\n*1850 -+1916 (HFS)\r\n\r\nNHRS-COLE\r\n000003665", "createdByAgentID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/1", "inventoryDate" : null, "sgrstatus" : null, "determination" : [ "https://www.dina-web.nrm/dina-service/dina/v1/Determination/3653" ], "reservedText" : null, "appraisalID" : null, "visibility" : null, "guid" : "b2781378-096f-11e3-b717-0050568c2f15", "totalValue" : null, "description" : null, "collectionObjectAttributeID" : "https://www.dina-web.nrm/dina-service/dina/v1/Collectionobjectattribute/3656", "accessionID" : null, "catalogedDate" : "2008-08-21", "name" : null, "availability" : null, "collectionObjectID" : 3656, "fieldNumber" : null, "restrictions" : null, "containerOwnerID" : null, "collectionMemberID" : 163840, "paleoContextID" : null, "ocr" : null, "version" : 1, "notifications" : null, "altCatalogNumber" : null, "timestampModified" : null, "modifiedByAgentID" : null, "modifier" : null, "projectNumber" : null, "timestampCreated" : 1249010716000, "containerID" : null, "catalogedDateVerbatim" : null, "catalogerID" : "https://www.dina-web.nrm/dina-service/dina/v1/Agent/2", "catalogedDatePrecision" : 1, "visibilitySetByID" : null } ] Get total number of rows by entity name Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/{entity}/count Example: Request: curl -H "Accept:application/json" http://localhost:8080/dina-service/dina/v1/Collectionobject/count Response: 534752
add DINA rest api specification
add DINA rest api specification
API Blueprint
cc0-1.0
DINA-Web/information-model
a16237e96b87c8a1988fb59dff6b0a4bb280d01c
apiary.apib
apiary.apib
FORMAT: 1A # Admiral Admiral is a deployment management system for Fleet and CoreOS. Unlike other deployment systems, Admiral also allows for automatic deployment and scaling of Fleet units. # Admiral Root [/v1] This resource simply represents the root of the Admiral API. It provides a basic JSON response as validation that the API server is running. ## Retrieve the API Information [GET] + Response 200 (application/json) { "name": "Admiral API", "version": 1 } ## Group Authentication Resources related to authenticating users. ## Login [/v1/login] ### Login [POST] Authenticates a user and returns a token that the client should use for further interactions with the API server. Requests should be made with a JSON object containing the following items: + Request (application/json) { "username": "johndoe", "password": "password" } + Response 200 (application/json) { "token": "API token" } + Response 401 (application/json) { "error": 401, "message": "The specified user was invalid." } ## Registration [/v1/register] ### Register [POST] Registers a user with the specified information, and returns a new token if the registration was successful. Registration must be enabled on the server or this endpoint will return an error. + Request (application/json) { "username": "johndoe", "password": "password" } + Response 200 (application/json) { "token": "API token" } + Response 500 (application/json) { "error": 500, "message": "The server is not accepting registration." }
Add login and registration to blueprint
Add login and registration to blueprint
API Blueprint
mit
andrewmunsell/admiral
bd049dfc5ca9910dd0e039ef16d58215564729de
apiary.apib
apiary.apib
FORMAT: 1A # scuevals SCU Evals API powers the SCU Evals front-end by managing all the data and actions.
Add initial API docs
Add initial API docs
API Blueprint
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
229b9a9979f8702de586e159b68ca8ab8b3657ca
parrot-api/doc/blueprint.apib
parrot-api/doc/blueprint.apib
FORMAT: 1A # Parrot API All endpoints are only accessible via https and are located at `host:port/api`. For example: ``` https://host:port/api/users/register ``` For most routes you will require a valid access token, check out the Auth section for more info. ## Limits If you're sending too many requests too quickly, we'll send back a `503` error code (server unavailable). You are limited to `5` requests per second per IP. ## Structure ### The Envelope Every response is contained by an envelope. That is, each response has a predictable set of keys with which you can expect to interact: ```json { "meta": { "status": 200, "error": { "status": 200 "type": "...", "message": "..." } }, "payload": { ... } } ``` #### META The meta key is used to communicate extra information about the response to the developer. If all goes well, you'll only ever see a code key with value `200`. However, sometimes things go wrong, and in that case you might see a response like: ```json { "meta": { "status": 422, "error": { "status": 422 "type": "UnprocessableEntity", "message": "Unprocessable entity" } } } ``` #### Payload The response payload object contains the actual information requested if applicable. For example: ```json { "meta": { ... }, "payload": { "id": "0daeb184-bd74-4aa9-b4dd-8a9aa2145ace", "email": "...", "roles": [...] } } ``` ### /api/ping #### GET Ping the API server. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) OK + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "message": { "type": "string" } } } } } ### /api/auth/token #### POST Exchange credentials for a token. Must use `application/x-www-form-urlencoded` content type. `grant_type` must be of either `password` (username, password) or `client_credentials` (client_id, client_secret). `client_id` is required if using `client_credentials`. `client_secret` is required if using `client_credentials`. `username` is required if using `password`. Use user's email. `password` is required if using `password`. + Request (application/json) + Headers Accept: application/json + Body { "client_id": "eiusmod sint minim non", "password": "fugiat dolor do" } + Schema { "type": "object", "properties": { "grant_type": { "type": "string", "description": "Must be of either `password` (username, password) or `client_credentials` (client_id, client_secret)" }, "client_id": { "description": "Required if using `client_credentials`", "type": "string" }, "client_secret": { "description": "Required if using `client_credentials`", "type": "string" }, "username": { "description": "Required if using `password`. Use user's email.", "type": "string" }, "password": { "description": "Required if using `password`", "type": "string" } } } + Response 200 (application/json) Created + Body { "access_token": "mollit irure" } + Schema { "type": "object", "properties": { "access_token": { "type": "string" }, "expires_in": { "type": "string" }, "token_type": { "type": "string" } } } ### /api/users/register #### POST Register a new user. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } + Response 201 (application/json) Created + Body { "payload": { "password": "qui tempor esse" } } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } #### GET /api/users/self Get information on the user making the request. + Parameters + include + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) OK + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } ### /api/users/self/name #### PATCH Change the name of the user making the request. + Request (application/json) + Headers Accept: application/json + Body { "name": "do aliqua" } + Schema { "type": "object", "properties": { "userId": { "type": "string" }, "name": { "type": "string" } } } + Response 200 (application/json) OK + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } ### /api/users/self/email #### PATCH Change the email of the user making the request. + Request (application/json) + Headers Accept: application/json + Body { "userId": "tempor", "email": "proident pariatur tempor sed" } + Schema { "type": "object", "properties": { "userId": { "type": "string" }, "email": { "type": "string" } } } + Response 200 (application/json) OK + Body { "meta": {} } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } ### /api/users/self/password #### PATCH Change the password of the user making the request. + Request (application/json) + Headers Accept: application/json + Body { "oldPassword": "in dolore", "newPassword": "ex" } + Schema { "type": "object", "properties": { "userId": { "type": "string" }, "oldPassword": { "type": "string" }, "newPassword": { "type": "string" } } } + Response 200 (application/json) OK + Body { "meta": { "status": -84802881 } } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } ### /api/projects #### GET Get the users to which the requesting user has access to. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) OK + Body { "meta": { "status": 49672136 } } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "keys": { "type": "array", "items": { "type": "string" } } } } } } } #### POST Create a new project and assign the requesting user as project owner. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "name": { "type": "string" }, "keys": { "type": "array", "items": { "type": "string" } } } } + Response 201 (application/json) Created + Body { "payload": { "id": "nulla culpa" } } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "keys": { "type": "array", "items": { "type": "string" } } } } } } ### /api/projects/{projectId} + Parameters + projectId (required) #### GET Get a specific project. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) OK + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "keys": { "type": "array", "items": { "type": "string" } } } } } } #### DELETE Delete a project. Must have owner role. + Request (application/json) + Headers Accept: application/json + Body + Response 204 (application/json) No Content + Body {} + Schema { "type": "object" } ### /api/projects/{projectId}/keys + Parameters + projectId (required) #### POST Add a project key. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "key": { "type": "string" } } } + Response 201 (application/json) Created + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "keys": { "type": "array", "items": { "type": "string" } } } } } } #### PATCH Update a project key. All project locales will be updated to reflect changes. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "oldKey": { "type": "string" }, "newKey": { "type": "string" } } } + Response 200 (application/json) Ok + Body { "payload": { "name": "eu Ut voluptate aliquip fugia" } } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "keys": { "type": "array", "items": { "type": "string" } } } } } } #### DELETE Delete a project key. All project locales will be updated to reflect changes. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "key": { "type": "string" } } } + Response 204 (application/json) No Content + Body ### /api/projects/{projectId}/users + Parameters + projectId (required) #### GET Get the users with access to this project. User self is not included in the result. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } } } #### POST Grant access for this project to an already registered user. + Request (application/json) + Headers Accept: application/json + Body { "user_id": "reprehenderit fugiat", "project_id": "ea est of", "role": "ex ut adipisicing esse veniam" } + Schema { "type": "object", "properties": { "user_id": { "type": "string" }, "project_id": { "type": "string" }, "role": { "type": "string" } } } + Response 201 (application/json) Created + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "user_id": { "type": "string" }, "project_id": { "type": "string" }, "role": { "type": "string" } } } } } ### /api/projects/{projectId}/users/{userId}/role + Parameters + projectId (required) + userId (required) #### PATCH Update the user's role from a project. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "role": { "type": "string" } } } + Response 200 (application/json) Ok + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "user_id": { "type": "string" }, "project_id": { "type": "string" }, "role": { "type": "string" } } } } } ### /api/projects/{projectId}/users/{userId} + Parameters + projectId (required) + userId (required) #### DELETE Revoke access to a project from a user. + Request (application/json) + Headers Accept: application/json + Body + Response 204 (application/json) No Content + Body ### /api/projects/{projectId}/clients + Parameters + projectId (required) #### GET Get the API clients with access to this project. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body { "payload": [ {}, { "secret": "anim nostrud enim qui ut" }, { "client_id": "ipsum amet nisi", "secret": "anim " } ] } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "array", "items": { "type": "object", "properties": { "client_id": { "type": "string" }, "secret": { "type": "string" }, "name": { "type": "string" }, "project_id": { "type": "string" } } } } } } #### POST Create a new project client. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "name": { "type": "string" } } } + Response 201 (application/json) Created + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "client_id": { "type": "string" }, "secret": { "type": "string" }, "name": { "type": "string" }, "project_id": { "type": "string" } } } } } ### /api/projects/{projectId}/clients/{clientId} + Parameters + projectId (required) + clientId (required) #### GET Get a project client by id. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "client_id": { "type": "string" }, "secret": { "type": "string" }, "name": { "type": "string" }, "project_id": { "type": "string" } } } } } #### DELETE Delete a project client. + Request (application/json) + Headers Accept: application/json + Body + Response 204 (application/json) No Content + Body ### /api/projects/{projectId}/clients/{clientId}/resetSecret + Parameters + projectId (required) + clientId (required) #### PATCH Reset the project client's secret. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "user_id": { "type": "string" }, "project_id": { "type": "string" }, "role": { "type": "string" } } } } } ### /api/projects/{projectId}/clients/{clientId}/name + Parameters + projectId (required) + clientId (required) #### PATCH Update the project client's name. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "name": { "type": "string" } } } + Response 200 (application/json) Ok + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "user_id": { "type": "string" }, "project_id": { "type": "string" }, "role": { "type": "string" } } } } } ### /api/projects/{projectId}/locales + Parameters + projectId (required) #### GET Get the project locales. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "project_id": { "type": "string" }, "ident": { "type": "string" }, "language": { "type": "string" }, "country": { "type": "string" }, "pairs": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } } } } } #### POST Create a new project locale. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "properties": { "ident": { "type": "string" }, "country": { "type": "string" }, "language": { "type": "string" } } } + Response 201 (application/json) Created + Body {} + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "project_id": { "type": "string" }, "ident": { "type": "string" }, "language": { "type": "string" }, "country": { "type": "string" }, "pairs": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } } } } ### /api/projects/{projectId}/locales/{localeIdent} + Parameters + projectId (required) + localeIdent (required) #### GET Get a project client by id. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body { "payload": { "language": "sint", "country": "aute qui", "id": "Excepteur", "project_id": "officia non" } } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "project_id": { "type": "string" }, "ident": { "type": "string" }, "language": { "type": "string" }, "country": { "type": "string" }, "pairs": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } } } } #### DELETE Delete a project client. + Request (application/json) + Headers Accept: application/json + Body + Response 204 (application/json) No Content + Body ### /api/projects/{projectId}/locales/{localeIdent}/pairs + Parameters + projectId (required) + localeIdent (required) #### PATCH Reset the project client's secret. + Request (application/json) + Headers Accept: application/json + Body {} + Schema { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } + Response 200 (application/json) Ok + Body { "meta": {} } + Schema { "type": "object", "properties": { "meta": { "type": "object", "properties": { "status": { "type": "number" } } }, "payload": { "type": "object", "properties": { "id": { "type": "string" }, "project_id": { "type": "string" }, "ident": { "type": "string" }, "language": { "type": "string" }, "country": { "type": "string" }, "pairs": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } } } } ### /api/projects/{projectId}/locales/{localeIdent}/export/{exportFormat} + Parameters + projectId (required) + localeIdent (required) + exportFormat (required) #### GET Export the locale's pairs in the provided format. Available formats: `keyvaluejson`, `po`, `strings`, `properties`, `xmlproperties`, `android`, `php`, `xlsx`, `csv`. + Request (application/json) + Headers Accept: application/json + Body + Response 200 (application/json) Ok + Body + Schema { "type": "file" }
Add blueprint version of api doc
Add blueprint version of api doc
API Blueprint
mit
anthonynsimon/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot,todes1/parrot,anthonynsimon/parrot,todes1/parrot,anthonynsimon/parrot,anthonynsimon/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot
4a819a96e422d8ee3c9b5ce6a35608e3a9dd3510
apiary.apib
apiary.apib
FORMAT: 1A # Dataface Build and manage data with a spreadsheet-like interface. # Group Sheets Resources related to sheets (which is what dataface calls database tables). ## Sheet Collection [/sheets] ### List All Sheets [GET] + Response 200 (application/json) + Attributes (array[Sheet]) ### Create a New Sheet [POST] + Request (application/json) + Attributes (Sheet) + Response 201 (application/json) + Headers Location: /sheets/{sheet_name} + Attributes (Sheet) ## Sheet [/sheets/{sheet_name}] + Parameters + sheet_name (string) - Name of the sheet ### Get basic information about a Sheet [GET] + Response 200 (application/json) + Attributes (Sheet) ### Update a Sheet [PATCH] To update a Sheet send a JSON payload with the updated value for one or more attributes. + Request (application/json) {"name": "client_invoices"} + Response 200 (application/json) {"name": "client_invoices", "description": "List of invoices"} ### Delete a Sheet [DELETE] + Response 204 ## Sheet Column Collection [/sheets/{sheet_name}/columns] + Parameters + sheet_name (string) - Name of the sheet ### Get a Sheet's Columns [GET] + Response 200 (application/json) + Attributes (array[Column]) ### Create a Column [POST] + Request (application/json) + Attributes (Column) + Response 201 (application/json) + Headers Location: /sheets/{sheet_name}/columns/{column_name} + Attributes (Column) ## Sheet Column [/sheets/{sheet_name}/columns/{column_name}] + Parameters + sheet_name (string) - Name of the sheet + column_name (string) - Name of the column ### Update a Column [PATCH] Use this method to rename a column, alter its type or metadata. + Request (application/json) + Attributes (Column) + Response 200 (application/json) + Attributes (Column) ### Delete a Column [DELETE] + Response 204 ## Sheet Row Collection [/sheets/{sheet_name}/rows] Filter the rows by adding conditions on columns through the querystring parameters. For example: + `?first_name=eq.John&last_name=eq.Doe` + `?age=gt.10&email=like.*doe.com` See the full list of querystring operators in the [PostgREST docs](https://postgrest.com/en/v0.4/api.html#horizontal-filtering-rows). + Parameters + sheet_name (string) - Name of the sheet ### Get a Sheet's Rows [GET] + Request + Headers Range-Unit: items Range: 0-29 X-Order: first_name DESC + Response 200 (application/json) + Headers Range-Unit: items Content-Range: 0-29/* X-Order: first_name DESC + Attributes (array[Sample Row]) ### Add a Row to a Sheet [POST] + Request (application/json) + Attributes (Sample Row) + Response 201 (application/json) + Attributes (Sample Row) ### Update a Row in a Sheet [PATCH] > Don't forget to include the `Range` header to ensure you're limiting your update to a single row! + Request (application/json) + Headers Range-Unit: items Range: 0-0 + Body {"first_name": "Jane", "email": "[email protected]"} + Response 200 (application/json) + Body {"first_name": "Jane", "last_name": "Doe", "age": 35, "email": "[email protected]"} ### Delete a Row in a Sheet [DELETE] + Response 204 # Data Structures ## Sheet (object) + name: `invoices` (string) - Name of the sheet. Should be a valid database table name. + description: `List of invoices` (optional, string) - Description of the sheet. ## Column (object) + name: `first_name` (string) - Name of the column. Should be a valid database column name. + type: `text` (enum[string]) - The type of data stored in the column + Members + `text` + `number` + order: `1` (number) - The order of the column in the sheet (starts at `1`) ## Sample Row (object) + first_name: `John` (string) + last_name: `Doe` (string) + age: `35` (number) + email: `[email protected]` (string)
Add API spec from apiary.io
Add API spec from apiary.io
API Blueprint
mit
timwis/dataface,timwis/dataface
70906cb0bcd95539d7a4ffa25269759051be54ee
docs/gisdataprovider.apib
docs/gisdataprovider.apib
FORMAT: 1A HOST: http://GISDataProvider.apiblueprint.org/ TITLE: GIS Data Provider Specification DATE: 4 September 2015 VERSION: 1.0 PREVIOUS_VERSION: - APIARY_PROJECT: GISDataProvider # GIS Data Provider Specification This specification defines GIS Data Provider version 1.0 API. "GIS (Geographic Information System) Data Provider" is a GE, which is able to serve both outdoor and indoor 3D data. The data shall be served roughly speaking in two fashions: 1. For single user apps, which can make queries to GIS GE, to download specific a single object or a set of geolocated 3D objects (i.e. building and terrain model of a named city centre) 2. For multi-user apps, which communicate via collaborative client platform (e.g. with Synchronization GE) and in which case this component/GE/Enabler/platform takes care of providing the 3D models for the client application. The GIS DP GE itself is a server, which is able to process geolocated queries, an extension to it which is able to manage web-optimized 3D data and a backend database where all geolocated data is saved. Because the GIS GE needs to serve both single user client apps (browsers) and multi-user enabled virtual spaces, an API will be defined to serve fluently both of the cases. In this API is a RESTful one, and allows both the browser app as well as other platforms to use it for downloading geolocated data. ## Editors + Juha Hyvärinen, Cyberlightning Ltd. ## Status This API is final version. This specification is licensed under the [FIWARE Open Specification License](http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_Open_Specification_Legal_Notice_%28essential_patents_license%29). ## Copyright All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the publisher, addressed “Attention: Permissions Coordinator,” at the address below. ## Group Geoserver ## GetCapabilities [/geoserver/ows?service={service}&version={version}&request=GetCapabilities] Capabilities request returns all layers and supported formats from server which can be processed with used module + Parameters + service: w3ds (required, string) - Requested Service + version: 0.4.0 (required, string) - Service version ### View a GetCapabilities request details [GET] + Response 200 (application/xml) <?xml version="1.0" encoding="UTF-8"?> <w3ds:Capabilities version="0.4.0" xmlns="http://www.opengis.net/w3ds/0.4.0" xmlns:w3ds="http://www.opengis.net/w3ds/0.4.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <ows:ServiceIdentification> <ows:Title/> <ows:Abstract/> <ows:ServiceType>OGC W3DS</ows:ServiceType> <ows:ServiceTypeVersion>0.4.0</ows:ServiceTypeVersion> <ows:Fees/> <ows:AccessConstraints/> </ows:ServiceIdentification> <ows:OperationsMetadata> <ows:Operation name="GetCapabilities"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost:8080/geoserver/ows?"> <ows:Constraint name="GetEncoding"> <ows:AllowedValues> <ows:Value>KVP</ows:Value> </ows:AllowedValues> </ows:Constraint> </ows:Get> </ows:HTTP> </ows:DCP> </ows:Operation> <ows:Operation name="GetScene"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost:8080/geoserver/ows?"> <ows:Constraint name="GetEncoding"> <ows:AllowedValues> <ows:Value>KVP</ows:Value> </ows:AllowedValues> </ows:Constraint> </ows:Get> </ows:HTTP> </ows:DCP> </ows:Operation> <ows:Operation name="GetTile"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost:8080/geoserver/ows?"> <ows:Constraint name="GetEncoding"> <ows:AllowedValues> <ows:Value>KVP</ows:Value> </ows:AllowedValues> </ows:Constraint> </ows:Get> </ows:HTTP> </ows:DCP> </ows:Operation> <ows:Operation name="GetFeatureInfo"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost:8080/geoserver/ows?"> <ows:Constraint name="GetEncoding"> <ows:AllowedValues> <ows:Value>KVP</ows:Value> </ows:AllowedValues> </ows:Constraint> </ows:Get> </ows:HTTP> </ows:DCP> </ows:Operation> </ows:OperationsMetadata> <w3ds:Contents> <w3ds:Layer> <ows:Title>terrain</ows:Title> <ows:Abstract/> <ows:Identifier>fiware:terrain</ows:Identifier> <ows:BoundingBox crs="EPSG:3067"> <ows:LowerCorner>240070.40625 7179013.0</ows:LowerCorner> <ows:UpperCorner>633889.625 7784407.0</ows:UpperCorner> </ows:BoundingBox> <ows:OutputFormat>model/x3d+xml</ows:OutputFormat> <ows:OutputFormat>text/html</ows:OutputFormat> <w3ds:DefaultCRS>EPSG:3067</w3ds:DefaultCRS> <w3ds:Queriable>true</w3ds:Queriable> <w3ds:Tiled>false</w3ds:Tiled> </w3ds:Layer> </w3ds:Contents> </w3ds:Capabilities> ## Group W3DS ## W3DS module requests [GET] W3DS module can generate 3D models from polygonal data stored in shapefiles or in databases. Supported response dataformats are: + model/xml3d+xml + application/xml + application/octet-stream ## GetScene [/geoserver/w3ds?version=0.4&service=w3ds&crs={CRS}&format={format}&boundingbox={boundingbox}&layers={layers}&LOD={lod}] The GetScene operation returns a 3D scene representing a subset of the natural or man made structures on the earth surface. Upon receiving a GetScene request, a W3DS shall either satisfy the request or issue a service exception. The required parameters for retrieving a 3D scene from a W3DS comprise spatial, thematic, and other constraints. The minimum set of parameters include, in addition to the mandatory parameters service, request and version, which are part of every W3DS operation, the spatial extent of the scene given as bounding box, the CRS in which the scene shall be provided, the format, and the list of layers. The bounding box defines a rectangular region with edges perpendicular to the selected CRS. LOD is Level of details definition value, this is optional parameter. In order to get LOD working properly, defined layer needs to support LOD data. Format is the definition of the response data format, there is 3 alternative response data formats available: application/xml3d, application/xml and application/octet-stream. application/xml3d returns XML3D presentation of the requested area, application/xml return xml-file which can be used with asset instancing feature and application/octet-stream return binary data in octet-stream format. A GetScene query has the following parameters: + Parameters + CRS: EPSG:3067 (required, string) - Coordinate Reference System in EPSG format + format: model/xml3d+xml (required, string) - Requested response format + boundingbox: 240070.40625,7179013.0,633889.625,7784407.0 (required, string) - bounding box defines a rectangular region with edges perpendicular to the selected CRS + layers: terrain (required, string) - Terrain layer name + lod: 4 (optional, number) - Level Of Detail for terrain ### View a GetScene Detail [GET] + Request XML3D model + Headers Accept: model/xml3d+xml + Response 200 (model/xml3d+xml) + Body <group xmlns="http://www.w3.org/1999/xhtml" id="outputGeometryCollection" class="NodeClassName"> <mesh type="triangles"> <int name="index">0 1 2 1 2 3</int> <float3 name="position">0 -10 0 6273.50 -10 0 0 -10 -6271.72 6273.50 -10 -6271.74</float3> <float3 name="normal">0 0 1 0 0 1 0 0 1 0 0 1</float3> <float2 name="texcoord">0.0 0.0 1.0 0.0 0.0 1.0 1.0 1.0</float2></mesh></group> + Request XML file with XML3D content + Headers Accept: application/xml + Response 200 (application/xml) + Body <?xml version=\"1.0\" encoding=\"utf-8\" ?> <xml3d xmlns=\"http://www.xml3d.org/2009/xml3d\"> <asset id=\"asset\"> <group xmlns="http://www.w3.org/1999/xhtml" id="outputGeometryCollection" class="NodeClassName"> <mesh type="triangles"> <int name="index">0 1 2 1 2 3</int> <float3 name="position">0 -10 0 6273.502 -10 0 0 -10 -6271.74 6273.50 -10 -6271.74</float3> <float3 name="normal">0 0 1 0 0 1 0 0 1 0 0 1</float3> <float2 name="texcoord">0.0 0.0 1.0 0.0 0.0 1.0 1.0 1.0</float2> </mesh> </group> </asset> </xml3d> + Request Octet-Stream + Headers Accept: application/octet-stream + Response 200 (application/octet-stream) + Body 0000 000a 0000 000a 42fb f5b2 42fb a6cb 7fc0 0000 7fc0 0000 43a6 7e35 43af 7a3d 43b3 cd0e 43b5 2e35 43b2 b4dd 43b0 3958 43ad c20c 43ab 52f2 7fc0 0000 7fc0 0000 43a5 bf7d 43ac d53f 43b1 bccd 43b1 ccee 43b0 553f 43ae e168 43ab bdb2 43a8 6687 7fc0 0000 7fc0 0000 43a5 1c8b 43ab 1fdf 43ae e937 43af 2312 43ac e2b0 43a9 5c4a 43a4 deb8 43a4 622d 7fc0 0000 7fc0 0000 43a3 be77 43a9 2106 43ac 3b23 43aa d4bc 43a8 7625 43a4 6312 43a4 bb44 43a7 50a4 7fc0 0000 7fc0 0000 43a2 e810 43a7 02d1 43a8 799a 43a7 89ba 43a4 9ac1 43a6 7604 43aa 1375 43aa 8e35 7fc0 0000 7fc0 0000 43a2 b4bc 43a6 199a 43a5 ff7d 43a4 c852 43a7 824e 43ab 9581 43af 1efa 43ad 9810 7fc0 0000 7fc0 0000 43a1 9b64 43a5 649c 43a5 9979 43a7 c687 43ac 1042 43b2 b9ba 43b5 90c5 43b9 b1aa 7fc0 0000 7fc0 0000 43a0 4c4a 43a3 e021 43a6 9e98 43ab 80e5 43b2 3c29 43b9 778d 43be 9e77 43bf 447b 7fc0 0000 7fc0 0000 439e eaa0 43a4 bf5c 43a8 3168 43af 32d1 43b5 0f5c 43bc 720c 43c1 85a2 43c4 399a 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 ## Group WMS ## WMS module requests [GET] WMS module can process both vector and raster data types and it produces image and height maps. ## GetMap [/geoserver/wms?service={service}&version={version}&request={request}&srs={srs}&format={format}&layers={layers}&bbox={boundingbox}&width={width}&height={height}] GetMap returns rendered map or a heightmap from requested area. Supported output formats are: + image/png + application/atom xml + application/atom+xml + application/bil + application/bil16 + application/bil32 + application/bil8 + application/octet-stream + application/openlayers + application/pdf + application/rss xml + application/rss+xml + application/vnd.google-earth.kml + application/vnd.google-earth.kml xml + application/vnd.google-earth.kml+xml + application/vnd.google-earth.kml+xml;mode=networklink + application/vnd.google-earth.kmz + application/vnd.google-earth.kmz xml + application/vnd.google-earth.kmz+xml + application/vnd.google-earth.kmz;mode=networklink + atom + image/bil + image/dds + image/dds; format=DXT1 + image/dds; format=DXT3 + image/dds; format=ETC1 + image/geotiff + image/geotiff8 + image/gif + image/gif;subtype=animated + image/jpeg + image/png8 + image/png; mode=8bit + image/svg + image/svg xml + image/svg+xml + image/tiff + image/tiff8 + kml + kmz + openlayers + rss + text/html; subtype=openlayers + Parameters + service: WMS (required, string) + version: 1.1.0 (required, string) + request: GetMap (required, string) + srs: EPSG:4326 (required, string) + format: image/jpeg (required, string) + layers: fiware:aerial (required, string) + boundingbox: 24.77355931465547,60.223299073691685,24.791604656806086,60.2322744331105 (required, string) + width: 512 (required, number) + height: 512 (required, number) ### View a GetMap details [GET] + Request Octet-Stream + Headers Accept: application/octet-stream + Response 200 (application/octet-stream) + Body 0000 000a 0000 000a 42fb f5b2 42fb a6cb 7fc0 0000 7fc0 0000 43a6 7e35 43af 7a3d 43b3 cd0e 43b5 2e35 43b2 b4dd 43b0 3958 43ad c20c 43ab 52f2 7fc0 0000 7fc0 0000 43a5 bf7d 43ac d53f 43b1 bccd 43b1 ccee 43b0 553f 43ae e168 43ab bdb2 43a8 6687 7fc0 0000 7fc0 0000 43a5 1c8b 43ab 1fdf 43ae e937 43af 2312 43ac e2b0 43a9 5c4a 43a4 deb8 43a4 622d 7fc0 0000 7fc0 0000 43a3 be77 43a9 2106 43ac 3b23 43aa d4bc 43a8 7625 43a4 6312 43a4 bb44 43a7 50a4 7fc0 0000 7fc0 0000 43a2 e810 43a7 02d1 43a8 799a 43a7 89ba 43a4 9ac1 43a6 7604 43aa 1375 43aa 8e35 7fc0 0000 7fc0 0000 43a2 b4bc 43a6 199a 43a5 ff7d 43a4 c852 43a7 824e 43ab 9581 43af 1efa 43ad 9810 7fc0 0000 7fc0 0000 43a1 9b64 43a5 649c 43a5 9979 43a7 c687 43ac 1042 43b2 b9ba 43b5 90c5 43b9 b1aa 7fc0 0000 7fc0 0000 43a0 4c4a 43a3 e021 43a6 9e98 43ab 80e5 43b2 3c29 43b9 778d 43be 9e77 43bf 447b 7fc0 0000 7fc0 0000 439e eaa0 43a4 bf5c 43a8 3168 43af 32d1 43b5 0f5c 43bc 720c 43c1 85a2 43c4 399a 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000 7fc0 0000
Add apiary file.
Add apiary file.
API Blueprint
apache-2.0
Cyberlightning/GISDataProvider,Cyberlightning/GISDataProvider,Cyberlightning/GISDataProvider
87163f0761b4dc64262ac5247d58089bfc48a25b
Documentation/Api/RestApi.apib
Documentation/Api/RestApi.apib
FORMAT: 1A # phpList REST API v2 # Group Authentication Resources related to login and logout. ## Session [/api/v2/sessions] ### Create a new session (log in) [POST] Given valid login data, this will generate a login token that will be valid for 1 hour. It takes a JSON object containing the following key-value pairs: + `userName` (string): the user name to log in + `password` (string): the plain text password The login token then can be passed as a `loginToken` cookie for request that require authentication. + Request (application/json) { "message": "Success", "userName": "admin", "password": "eetIc/Gropvoc1" } + Response 201 (application/json) + Body { "id": 241, "loginToken": "2cfe100561473c6cdd99c9e2f26fa974" } + Response 401 (application/json) + Body { "code": 1, "message": "Not authorized", "description": "The user name and password did not match any existing user." }
Document the authentication process (#16)
[TASK] Document the authentication process (#16) [ci skip]
API Blueprint
agpl-3.0
phpList/rest-api
36535930e0d297aaa2891511127f12350a3baa34
STATION-METADATA-API-BLUEPRINT.apib
STATION-METADATA-API-BLUEPRINT.apib
FORMAT: 1A Station Metadata API ============================= # General information This is technical documentation for the Station Metadata API This document uses [API blueprint format](https://apiblueprint.org/documentation/). Station Metadata is a service to get information about stations in GeoJSON format. ### Authentication All endpoints are **secured** with HTTP basic authorization and data are transmitted over HTTPS protocol. If you want to get access please use [request form](https://meteogroup.zendesk.com/hc/en-gb/requests/new?ticket_form_id=64951). #Stations Metadata API ## Retrieve station metadata [/stations] For any request all the GET HTTP parameters are optional. + Parameters + locationWithin: `[-180,90],[180,-90]` (string, optional) - top left and bottom right coordinates that construct bounding box of station locations; + accessVisibility: `public` (string, optional) - parameter that filter **public** or **private** stations to show; + providerOrType: `WMO` (string, optional) - describes data provider or type; + type: `SKI_RESORT` (string, optional) - describes type of station place; + hasForecastData: `true` (boolean, optional) - show only stations that provide forecasts; + hasObservationData: `true` (boolean, optional) - show only stations that provide observations; + countryIsoCode: `DE` (string, optional) - filter stations by country ISO code. ### Get a stations metadata for Germany [GET] ####An example 'https://station-metadata.weather.mg/stations?countryIsoCode=DE&hasObservationData=true' + Response 200 (application/json) + Headers Content-Type: application/json Cache-Control: max-age=86400 + Body { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "accessVisibility": "public", "icaoCode": "EDXW", "countryIsoCode": "DE", "hasForecastData": true, "wmoCountryId": 69, "meteoGroupStationId": 10018, "name": "Westerland/Sylt", "providerStationId": "GWT", "providerOrType": "AVIATION", "hasObservationData": true, "stationTimeZoneName": "Europe/Berlin" }, "geometry": { "type": "Point", "coordinates": [ 8.35, 54.9167, 20 ] } }, { "type": "Feature", "properties": { "accessVisibility": "public", "countryIsoCode": "DE", "hasForecastData": true, "wmoCountryId": 69, "meteoGroupStationId": 10020, "name": "List/Sylt", "providerOrType": "WMO/DWD", "hasObservationData": true, "stationTimeZoneName": "Europe/Berlin" }, "geometry": { "type": "Point", "coordinates": [ 8.4125, 55.0112, 26 ] } } ] } #
Add station metadata blueprint
Add station metadata blueprint
API Blueprint
apache-2.0
MeteoGroup/weather-api,MeteoGroup/weather-api
c06418176b5c2971bc6be2a8c9a9e28012c231b7
MS3/Documentation/DyalogAPIs/WidgetDoc.dyalog
MS3/Documentation/DyalogAPIs/WidgetDoc.dyalog
:Class WidgetDoc : MiPageTemplate ∇ Compose;ns;widget;doc;t;opts;og :Access public Add _.StyleSheet'/Styles/widgetDoc.css' (ns widget)←Get'namespace widget' :If 0∊⍴widget Add _.h3'Select widget' opts←'onchange="window.open(this.value,''this'');this.selectedIndex=0"'Add _.select 'disabled=' 'value='opts.Add _.option'[Select widget]' :For ns :In '_DC' '_SF' '_JQ' '_html' og←('label'ns)opts.Add _.optgroup :For widget :In (⍎ns).⎕NL ¯9 ('value=?namespace=',ns,'&widget=',widget)og.Add _.option widget :EndFor :EndFor :Else doc←ns Document widget doc[;2]←{New _.pre ⍵}¨doc[;2] Add _.h3 ns,'.',widget (Add #._.Table doc).CellAttr←'class="widgetDoc"' 'class="widgetDocContent"' :EndIf ∇ ∇ r←ns Document widget;ref;wref;src;mask;chunk;pv;c;c1;c2;samples;files :Access public shared r←'' :If 9.1=#.⎕NC⊂ns ref←#.⍎ns :If 9=ref.⎕NC widget wref←ref⍎widget src←1↓⎕SRC wref src↓⍨←+/∧\''∘≡¨src src←#.Strings.dlb¨src src←src/⍨∧\'⍝'=⊃¨src src←HtmlSafeText¨#.Strings.dlb¨1↓¨src pv←∨/¨'::'∘⍷¨src r←0 2⍴⊂'' :For chunk :In pv⊂src c←⊃chunk (c1 c2)←{⍵{(1,1↓<\⍵)⊂⍺}'::'⍷⍵}c c2←#.Strings.deb 2↓c2 c2←c2{0∊⍴⍺:⍵ ⋄ 0∊⍴⍵:⊂⍺ ⋄ (⊂⍺),⍵}1↓chunk c2←¯2↓∊c2,¨⊂⎕UCS 13 10 r⍪←c1 c2 :EndFor :If 0≠wref.⎕NC⊂'DocBase' r⍪←'Documentation'('target=_blank'New _.A(2⍴⊂wref.DocBase)) :EndIf samples←'/Examples/',(ns~'_'),'/' :If ~0∊⍴files←1⌷[2]#.Files.List #.Boot.ms.Config.AppRoot,samples :AndIf ~0∊⍴files/⍨←∨/files∘.#.Strings.(beginsWith nocase)widget∘,¨'Simp' 'Adv' r⍪←'Sample Pages'({'target=_blank'New _.A(2⍴⊂⍵)}¨samples∘,¨files) :EndIf :EndIf :EndIf ∇ :EndClass
:Class WidgetDoc : MiPageTemplate ∇ Compose;ns;widget;doc :Access public (ns widget)←Get'namespace widget' Add _.StyleSheet'/Styles/widgetDoc.css' doc←ns Document widget :Select doc :Case ¯1 (Add _.h3('Namespace "',ns,'" not found.')).Style'color' 'red' :Case ¯2 (Add _.h3('Widget "',widget,'" not found in namespace ',ns)).Style'color' 'red' :Else Add _.h3 ns,'.',widget :If 0∊⍴doc Add _.h4'No documentation found.' :Else doc[;2]←{New _.pre ⍵}¨doc[;2] (Add #._.Table doc).CellAttr←'class="widgetDoc"' 'class="widgetDocContent"' :EndIf :EndSelect ∇ ∇ r←ns Document widget;ref;wref;src;mask;chunk;pv;c;c1;c2;samples;files :Access public shared r←¯1 :If 9.1=#.⎕NC⊂ns ref←#.⍎ns r←¯2 :If 9=ref.⎕NC widget wref←ref⍎widget src←1↓⎕SRC wref src↓⍨←+/∧\''∘≡¨src src←#.Strings.dlb¨src src←src/⍨∧\'⍝'=⊃¨src src←HtmlSafeText¨#.Strings.dlb¨1↓¨src pv←∨/¨'::'∘⍷¨src r←0 2⍴⊂'' :For chunk :In pv⊂src c←⊃chunk (c1 c2)←{⍵{(1,1↓<\⍵)⊂⍺}'::'⍷⍵}c c2←#.Strings.deb 2↓c2 c2←c2{0∊⍴⍺:⍵ ⋄ 0∊⍴⍵:⊂⍺ ⋄ (⊂⍺),⍵}1↓chunk c2←¯2↓∊c2,¨⊂⎕UCS 13 10 r⍪←c1 c2 :EndFor :If 0≠wref.⎕NC⊂'DocBase' r⍪←'Documentation'('target=_blank'New _.A(2⍴⊂wref.DocBase)) :EndIf samples←'/Examples/',(ns~'_'),'/' :If ~0∊⍴files←1⌷[2]#.Files.List #.Boot.ms.Config.AppRoot,samples files/⍨←∨/files∘.#.Strings.(beginsWith nocase)widget∘,¨'Simp' 'Adv' :AndIf ~0∊⍴files r⍪←'Sample Pages'({'target=_blank'New _.A(2⍴⊂⍵)}¨samples∘,¨files) :EndIf :EndIf :EndIf ∇ :EndClass
Revert "Resolve conflict"
Revert "Resolve conflict" This reverts commit 58740171f4b5f40819b69972297295e7cf9330d4.
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
6f8e21cd32b1c92e23658ef77d9e0b8976e06495
HTML/_SF/ejdigitalgauge.dyalog
HTML/_SF/ejdigitalgauge.dyalog
:class ejDigitalGauge : #._SF._ejWidget ⍝ Description:: Syncfusion Digital Gauge widget ⍝ Constructor:: [text [typeface]] ⍝ text - text to render in the digital gauge ⍝ typeface - typeface to use - choices are: ⍝ '7' - 7-segment ⍝ '14' - 14-segment ⍝ '16' - 16-segment ⍝ '88dot' - 8×8 dot matrix with round dots ⍝ '88square' - 8×8 dot matrix with square dots ⍝ seglength - numeric segment length (default based on typeface) ⍝ segwidth - numeric segment width (default based on typeface) ⍝ ⍝ Public Fields:: ⍝ Text - text to render in the digital gauge ⍝ Typeface - typeface to use - choices are: ⍝ '7' - 7-segment ⍝ '14' - 14-segment ⍝ '16' - 16-segment (default) ⍝ '88dot' - 8×8 dot matrix with round dots ⍝ '88square' - 8×8 dot matrix with square dots ⍝ SegLength - numeric segment length (default based on typeface) ⍝ SegWidth - numeric segment width (default based on typeface) :field public shared readonly DocBase←'http://help.syncfusion.com/js/api/ejDigitalGauge.html' :field public shared readonly ApiLevel←3 :field public shared readonly DocDyalog←'/Documentation/DyalogAPIs/Syncfusion/ejDigitalGauge.html' :field public shared readonly IntEvt←'init' 'itemRendering' 'load' 'renderComplete' :field public Text←'' :field public Typeface←'16' :field public SegLength←⍬ :field public SegWidth←⍬ ∇ make :Access public JQueryFn←Uses←'ejDigitalGauge' :Implements constructor InternalEvents←IntEvt ∇ ∇ make1 args :Access public JQueryFn←Uses←'ejDigitalGauge' :Implements constructor InternalEvents←IntEvt Text Typeface SegLength SegWidth←args defaultArgs Text Typeface SegLength SegWidth ∇ ∇ r←Render;typeface;ind;text :Access public :If ~0∊⍴Text ⍝ if the user doesn't specify Text, then we assume he's setting everything himself manually 'items[1].value'Set text←⍕,Text ind←((,'7')'14' '16' '88dot' '88square')⍳⊂,Typeface :If 0∊⍴SegLength SegLength←ind⊃10 10 10 3 3 10 :EndIf :If 0∊⍴SegWidth SegWidth←ind⊃1 1 1 3 3 1 :EndIf 'items[1].characterSettings.type'SetIfNotSet ind⊃'sevensegment' 'fourteensegment' 'sixteensegment' 'eightcrosseightdotmatrix' 'eightcrosseightsquarematrix' 'sixteensegment' 'items[1].segmentSettings.count'SetIfNotSet⊃⍴,text 'items[1].segmentSettings.length'SetIfNotSet SegLength 'items[1].segmentSettings.width'SetIfNotSet SegWidth :EndIf r←⎕BASE.Render ∇ :EndClass
:class ejDigitalGauge : #._SF._ejWidget ⍝ Description:: Syncfusion Digital Gauge widget ⍝ Constructor:: [text [typeface [spacing [seglength [segwidth]]]]] ⍝ text - text to render in the digital gauge ⍝ typeface - typeface to use - choices are: ⍝ '7' - 7-segment ⍝ '14' - 14-segment ⍝ '16' - 16-segment ⍝ '88dot' - 8×8 dot matrix with round dots ⍝ '88square' - 8×8 dot matrix with square dots ⍝ spacing - spacing between characters ⍝ seglength - numeric segment length (default based on typeface) ⍝ segwidth - numeric segment width (default based on typeface) ⍝ ⍝ Public Fields:: ⍝ Text - text to render in the digital gauge ⍝ Typeface - typeface to use - choices are: ⍝ '7' - 7-segment ⍝ '14' - 14-segment ⍝ '16' - 16-segment ⍝ '88dot' - 8×8 dot matrix with round dots ⍝ '88square' - 8×8 dot matrix with square dots ⍝ Spacing - spacing between characters (default 4) ⍝ SegLength - numeric segment length (default based on typeface) ⍝ SegWidth - numeric segment width (default based on typeface) :field public shared readonly DocBase←'http://help.syncfusion.com/js/api/ejDigitalGauge.html' :field public shared readonly ApiLevel←3 :field public shared readonly DocDyalog←'/Documentation/DyalogAPIs/Syncfusion/ejDigitalGauge.html' :field public shared readonly IntEvt←'init' 'itemRendering' 'load' 'renderComplete' :field public Text←'' :field public Typeface←'16' :field public Spacing←4 :field public SegLength←⍬ :field public SegWidth←⍬ ∇ make :Access public JQueryFn←Uses←'ejDigitalGauge' :Implements constructor InternalEvents←IntEvt ∇ ∇ make1 args :Access public JQueryFn←Uses←'ejDigitalGauge' :Implements constructor InternalEvents←IntEvt Text Typeface Spacing SegLength SegWidth←args defaultArgs Text Typeface Spacing SegLength SegWidth ∇ ∇ r←Render;typeface;ind;text :Access public :If ~0∊⍴Text ⍝ if the user doesn't specify Text, then we assume he's setting everything himself manually 'items[1].value'Set text←⍕,Text ind←((,'7')'14' '16' '88dot' '88square')⍳⊂,Typeface :If 0∊⍴SegLength SegLength←ind⊃10 10 10 3 3 10 :EndIf :If 0∊⍴SegWidth SegWidth←ind⊃1 1 1 3 3 1 :EndIf 'items[1].characterSettings.type'SetIfNotSet ind⊃'sevensegment' 'fourteensegment' 'sixteensegment' 'eightcrosseightdotmatrix' 'eightcrosseightsquarematrix' 'sixteensegment' 'items[1].characterSettings.spacing'SetIfNotSet Spacing 'items[1].segmentSettings.count'SetIfNotSet⊃⍴,text 'items[1].segmentSettings.length'SetIfNotSet SegLength 'items[1].segmentSettings.width'SetIfNotSet SegWidth :EndIf r←⎕BASE.Render ∇ :EndClass
update ejDigitalGauge - add character spacing
update ejDigitalGauge - add character spacing
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
8f74fc592af5d8c6ab79b01cbcbab37b3e1d53cf
HTML/_DC/Select.dyalog
HTML/_DC/Select.dyalog
:class Select : #._html.select ⍝ Description:: Dyalog Enhanced HTML select ⍝ Constructor:: [options [[selected] [[disabled] [prompt]]]] ⍝ options - vector of options or 2 column matrix of displayed[;1] and returned[;2] values ⍝ selected - Boolean or integer array indicating pre-selected options(s) ⍝ disabled - Boolean or integer array indicating disabled options(s) ⍝ prompt - first item to display (has no value) (default '[Select]') ⍝ ⍝ Public Fields:: ⍝ Options - vector of options or 2 column matrix of displayed[;1] and returned[;2] values ⍝ Selected - Boolean or integer array indicating pre-selected options(s) ⍝ Disabled - Boolean or integer array indicating disabled options(s) ⍝ Prompt - first item to display (has no value) (default '[Select]') ⍝ ⍝ Examples:: ⍝ Select ('Choice 1' 'Choice 2' 'Choice 3') ⍝ Select (3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') 2) ⍝ second item is selected ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') (0 1 0)) ⍝ second item is selected ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') 2 3 'Pick One') ⍝ second item is selected, third item is disabled ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') (2 3) 1) ⍝ second and third items are selected, first item is disabled :field public Options←0 2⍴⊂'' ⍝ vector or matrix [;1] display, [;2] value :field public Selected←⍬ ⍝ either Boolean integer vector indicating :field public Prompt←'[Select]' ⍝ character vector "Prompt" choice - the first choice on the list and does not have a value :field public Disabled←⍬ ⍝ either Boolean integer vector indicating ∇ make :Access public :Implements constructor ∇ ∇ make1 args;attr :Access public :Implements constructor args←eis args :If (|≡args)∊0 1 2 :AndIf ~0∊⍴⊃args args←,⊂args :EndIf (Options Selected Disabled Prompt)←args defaultArgs Options Selected Disabled Prompt ∇ ∇ r←Render;opts;sel :Access public Content←opts←'' SetInputName Add BuildOptions(Options Selected Disabled) r←⎕BASE.Render ∇ ∇ r←BuildOptions(opts sel dis);v r←'' :If ~0∊⍴opts opts←eis opts :If 1=⍴⍴opts opts←opts,⍪opts :EndIf :EndIf v←⍳⍬⍴⍴opts (sel dis)←v∘∊¨sel dis :If 1<+/sel ⍝ if we have multiple items selected :AndIf 0∊⍴⊃Attrs[⊂'multiple'] ⍝ and the multiple attribute is not set Attrs[⊂'multiple']←⊂'multiple' ⍝ then set it :EndIf :If ~0∊⍴Prompt :AndIf 0∊⍴⊃Attrs[⊂'multiple'] ⍝ prompt makes no sense if multiple selections are allowed r,←('disabled="disabled" selected="selected"'New #._html.option Prompt).Render :EndIf r,←FormatOptions(opts sel dis) ∇ ∇ r←FormatOptions(opts sel dis);o;s;d :Access Public Shared r←'' :If 1=⍴⍴opts ⋄ opts←opts,⍪opts ⋄ :EndIf :For o s d :InEach (↓opts)sel dis r,←'<option',({⍵ ine' value="',(HtmlSafeText ⍵),'"'}2⊃o),(s/' selected="selected"'),(d/' disabled="disabled"'),'>',(1⊃o),'</option>' :EndFor ∇ ∇ r←{selector}ReplaceOptions args;sel;opts;dis ⍝ Replaces select elements options - used by callback functions ⍝ Ex: r←Execute ReplaceOptions ('New Option 1' 'New Option 2') 1 ⍝ arg = options [[selected] [disabled]] :Access public :If 0=⎕NC'selector' ⋄ selector←'#',id ⋄ :EndIf args←eis args :If (|≡args)∊0 1 2 :AndIf ~0∊⍴⊃args args←,⊂args :EndIf (opts sel dis)←args defaultArgs Options ⍬ ⍬ r←selector #.JQ.Replace BuildOptions(opts sel dis) ∇ :endclass
:class Select : #._html.select ⍝ Description:: Dyalog Enhanced HTML select ⍝ Constructor:: [options [[selected] [[disabled] [prompt]]]] ⍝ options - vector of options or 2 column matrix of displayed[;1] and returned[;2] values ⍝ selected - Boolean or integer array indicating pre-selected options(s) ⍝ disabled - Boolean or integer array indicating disabled options(s) ⍝ prompt - first item to display (has no value) (default '[Select]') ⍝ ⍝ Public Fields:: ⍝ Options - vector of options or 2 column matrix of displayed[;1] and returned[;2] values ⍝ Selected - Boolean or integer array indicating pre-selected options(s) ⍝ Disabled - Boolean or integer array indicating disabled options(s) ⍝ Prompt - first item to display (has no value) (default '[Select]') ⍝ ⍝ Examples:: ⍝ Select ('Choice 1' 'Choice 2' 'Choice 3') ⍝ Select (3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') 2) ⍝ second item is selected ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') (0 1 0)) ⍝ second item is selected ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') 2 3 'Pick One') ⍝ second item is selected, third item is disabled ⍝ Select ((3 2⍴'One' 'c1' 'Two' 'c2' 'Three' 'c3') (2 3) 1) ⍝ second and third items are selected, first item is disabled :field public Options←0 2⍴⊂'' ⍝ vector or matrix [;1] display, [;2] value :field public Selected←⍬ ⍝ either Boolean integer vector indicating :field public Prompt←'[Select]' ⍝ character vector "Prompt" choice - the first choice on the list and does not have a value :field public Disabled←⍬ ⍝ either Boolean integer vector indicating ∇ make :Access public :Implements constructor ∇ ∇ make1 args;attr :Access public :Implements constructor args←eis args :If (|≡args)∊0 1 2 :AndIf ~0∊⍴⊃args args←,⊂args :EndIf (Options Selected Disabled Prompt)←args defaultArgs Options Selected Disabled Prompt ∇ ∇ r←Render;opts;sel :Access public Content←opts←'' SetInputName Add BuildOptions(Options Selected Disabled) r←⎕BASE.Render ∇ ∇ r←BuildOptions(opts sel dis);v r←'' :If ~0∊⍴opts opts←eis opts :If 1=⍴⍴opts opts←opts,⍪opts :EndIf :EndIf v←⍳⍬⍴⍴opts (sel dis)←v∘∊∘{∧/⍵∊0 1:⍵/⍳⍴⍵ ⋄ ⍵}∘,¨sel dis :If 1<+/sel ⍝ if we have multiple items selected :AndIf 0∊⍴⊃Attrs[⊂'multiple'] ⍝ and the multiple attribute is not set Attrs[⊂'multiple']←⊂'multiple' ⍝ then set it :EndIf :If ~0∊⍴Prompt :AndIf 0∊⍴⊃Attrs[⊂'multiple'] ⍝ prompt makes no sense if multiple selections are allowed r,←('disabled="disabled" selected="selected"'New #._html.option Prompt).Render :EndIf r,←FormatOptions(opts sel dis) ∇ ∇ r←FormatOptions(opts sel dis);o;s;d :Access Public Shared r←'' :If 1=⍴⍴opts ⋄ opts←opts,⍪opts ⋄ :EndIf :For o s d :InEach (↓opts)sel dis r,←'<option',({⍵ ine' value="',(HtmlSafeText ⍵),'"'}2⊃o),(s/' selected="selected"'),(d/' disabled="disabled"'),'>',(1⊃o),'</option>' :EndFor ∇ ∇ r←{selector}ReplaceOptions args;sel;opts;dis ⍝ Replaces select elements options - used by callback functions ⍝ Ex: r←Execute ReplaceOptions ('New Option 1' 'New Option 2') 1 ⍝ arg = options [[selected] [disabled]] :Access public :If 0=⎕NC'selector' ⋄ selector←'#',id ⋄ :EndIf args←eis args :If (|≡args)∊0 1 2 :AndIf ~0∊⍴⊃args args←,⊂args :EndIf (opts sel dis)←args defaultArgs Options ⍬ ⍬ r←selector #.JQ.Replace BuildOptions(opts sel dis) ∇ :endclass
Fix Boolean option for _.Select.(Selected Disabled)
Fix Boolean option for _.Select.(Selected Disabled)
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
fe233518e42256d5cb197b79a56e3ef025417d06
Core/SupportedHtml5Elements.dyalog
Core/SupportedHtml5Elements.dyalog
:Namespace SupportedHtml5Elements ⍝ this namespace is used to build the _html namespace containing definitions for all HTML5 elements ⍝ element names followed by '*' have no closing tag Elements←' a abbr acronym address area* article aside audio b base* bdi bdo big blockquote' Elements,←' body br* button canvas caption circle* cite code col* colgroup command datalist dd del' Elements,←' details dfn div dl dt ellipse* em embed* fieldset figcaption figure footer form' Elements,←' h1 h2 h3 h4 h5 h6 head header hgroup hr* html i iframe img* input* ins kbd keygen label' Elements,←' legend li line* link* map mark menu meta* meter nav noscript object ol optgroup option' Elements,←' output p param* path* polygon* polyline* pre progress q rect* rp rt ruby s samp script' Elements,←' section select small source* span strong style sub summary sup svg table tbody td' Elements,←' textarea tfoot th thead time title tr track tt u ul var video wbr' ∇ Build_html_namespace;e;def;noend;class;make;make1;make2;endclass;make1a;doc class←,⊂':Class ∆ : #.HtmlElement' doc←':field public shared readonly DocBase←''http://www.w3schools.com/tags/tag_∆.asp''' ':field public shared readonly DocDyalog←''/Documentation/DyalogAPIs/html5.html''' ':field public shared readonly APILevel←2' make←'∇make' ':Access Public' 'NoEndTag←⍺' ':Implements Constructor :Base ''∆''' '∇' make1←'∇make1 arg' ':Access Public' 'NoEndTag←⍺' ':Implements Constructor :Base ''∆'' arg' '∇' make1a←'∇make1 arg' ':Access Public' 'NoEndTag←⍺' ':Implements Constructor :Base ''∆'' '''' arg' '∇' make2←'∇make2 (content attr);a' ':Access Public' 'NoEndTag←⍺' 'a←(⊂''∆''),⊂⍣(isString a)⊢a←content attr' ':Implements Constructor :Base a' '∇' endclass←,⊂':EndClass' #._html.(⎕EX ⎕NL ¯9.4) ⍝ erase all classes :For e :In {⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}Elements e↓⍨←-noend←'*'=¯1↑e #._html.⎕FIX⊃,/(⍕¨e noend)∘{((,¨'∆⍺')⎕R ⍺),¨⍵}¨(1 1 1,(noend⌽1 0),1 1)/class doc make make1 make1a make2 endclass :EndFor ∇ :EndNamespace
:Namespace SupportedHtml5Elements ⍝ this namespace is used to build the _html namespace containing definitions for all HTML5 elements ⍝ element names followed by '*' have no closing tag Elements←' a abbr acronym address area* article aside audio b base* bdi bdo big blockquote' Elements,←' body br* button canvas caption circle* cite code col* colgroup command datalist dd del' Elements,←' details dfn div dl dt ellipse* em embed* fieldset figcaption figure footer form' Elements,←' h1 h2 h3 h4 h5 h6 head header hgroup hr* html i iframe img* input* ins kbd keygen label' Elements,←' legend li line* link* map mark menu meta* meter nav noscript object ol optgroup option' Elements,←' output p param* path* polygon* polyline* pre progress q rect* rp rt ruby s samp script' Elements,←' section select small source* span strong style sub summary sup svg table tbody td' Elements,←' textarea tfoot th thead time title tr track tt u ul var video wbr' ∇ Build_html_namespace;e;def;noend;class;make;make1;make2;endclass;make1a;doc class←,⊂':Class ∆ : #.HtmlElement' doc←':field public shared readonly DocBase←''http://www.w3schools.com/tags/tag_∆.asp''' ':field public shared readonly DocDyalog←''/Documentation/DyalogAPIs/html5.html''' ':field public shared readonly APILevel←2' make←'∇make' ':Access Public' 'NoEndTag←⍺' ':Implements Constructor :Base (,''∆'')' '∇' make1←'∇make1 arg' ':Access Public' 'NoEndTag←⍺' ':Implements Constructor :Base (,''∆'') arg' '∇' make1a←'∇make1 arg' ':Access Public' 'NoEndTag←⍺' ':Implements Constructor :Base (,''∆'') '''' arg' '∇' make2←'∇make2 (content attr);a' ':Access Public' 'NoEndTag←⍺' 'a←(⊂,''∆''),⊂⍣(isString a)⊢a←content attr' ':Implements Constructor :Base a' '∇' endclass←,⊂':EndClass' #._html.(⎕EX ⎕NL ¯9.4) ⍝ erase all classes :For e :In {⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}Elements e↓⍨←-noend←'*'=¯1↑e #._html.⎕FIX⊃,/(⍕¨e noend)∘{((,¨'∆⍺')⎕R ⍺),¨⍵}¨(1 1 1,(noend⌽1 0),1 1)/class doc make make1 make1a make2 endclass :EndFor ∇ :EndNamespace
make single-character-named HTML5 elements more tolerant of scalar content arguments
make single-character-named HTML5 elements more tolerant of scalar content arguments
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
269632ced628e14ac084225bb594f22ebc10702b
languages/APL/demo.apl
languages/APL/demo.apl
1 2 3 4 5~1 3 5
10×2 X←8+3 X÷2
revert an accident change to demo.apl
[APL] revert an accident change to demo.apl git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@12645 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
APL
artistic-2.0
ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot
c2480ba8a1c6adb839b8c777364a29fe46a3d730
MS3/Examples/SF/ejDatePickerAdvanced.dyalog
MS3/Examples/SF/ejDatePickerAdvanced.dyalog
:Class ejDatePickerAdvanced : MiPageSample ⍝ Control:: _SF.ejDatePicker ⍝ Description:: Insert mutually interdependant calendars ⍝ Show 2 calendars to select reservation dates. ⍝ The first date cannot be before today and the second cannot be the ⍝ date before tomorrow. Its default is 1 week after check in. ∇ Compose;today;fromidn;minto;tbl;tr;td;head;todate;from :Access Public today←3↑⎕TS fromidn←dateToIDN today Add _.h1'Drop ↓ Inn' Add _.h2'Hotel reservation system' ⍝ The table header tbl←Add _.table head←tbl.Add _.thead (head.Add _.tr).{Add _.th ⍵}¨'Check in' 'Check out' tr←tbl.Add _.tr ⍝ The in date td←tr.Add _.td from←'in'td.Add _SF.ejDatePicker today'yyyy/MM/dd' <<<<<<< HEAD from.Set⊂'minDate'(newDate today) from.On'change' 'setNewDate',⊂('in' 'model' 'value')('out' 'eval' '$("#out").ejDatePicker("model.value")') ======= from.Set'minDate'(newDate today) from.On'change' 'setNewDate'(('in' 'argument' 'value')('out' 'eval' '$("#out").ejDatePicker("model.value")')) >>>>>>> 5ab62425095ccf15d890974e9c9cbf78695bbc72 ⍝ The out date td←tr.Add _.td todate←IDNToDate fromidn+7 TO←'out'td.Add _SF.ejDatePicker todate'yyyy/MM/dd' minto←newDate IDNToDate fromidn+1 TO.Set⊂'minDate'minto ∇ newDate←{'⍎new Date("',(⍕⍵),'")'} dateToIDN←{2 ⎕NQ'.' 'datetoidn'⍵} IDNToDate←{3↑ 2 ⎕NQ'.' 'idntodate'⍵} ∇ r←setNewDate;in;out :Access public ⍝ Reset minimum reservation check out date in←dateToIDN stringToDate⍕Get'in' r←'minDate'TO.Update newDate IDNToDate in+1 out←dateToIDN stringToDate⍕Get'out' ⍝ If the new IN date is not before the OUT date we reset OUT to 1 week after :If in≥out r,←'value'TO.Update newDate IDNToDate in+7 :EndIf ∇ MONTHS←↓12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec' FI←{(b v)←⎕vfi ⍵ ⋄ b/v} ∇ ymd←stringToDate str;pos;mon;t ⍝ str is of the genre "Wed Aug 05 2015 00:00:00 GMT-0400 (Eastern Daylight Time)" ⍝ We need to weed out the day of the week and the time str←(+/∧\' '=str)↓str ⍝ remove the leading spaces :If 0∊⍴t←MONTHS ⎕S 0 3⊢str ⍝ look for the month as a string. If not found ymd←3↑FI str ⍝ grab the 1st 3 numbers found ymd←ymd[⍒(2×31<ymd)+ymd<12] ⍝ put in correct order :Else ⍝ otherwise (if found) (pos mon)←0 1+1⊃t :If ~0∊⍴t←FI pos↑str ⍝ any number before the month? (e.g. 2 May 2021) ymd←⌽⍣(31<⍬⍴t)⊢(1↑FI pos↓str),mon,t :Else ymd←¯1⌽mon,2↑FI pos↓str :EndIf :EndIf ∇ :EndClass
:Class ejDatePickerAdvanced : MiPageSample ⍝ Control:: _SF.ejDatePicker ⍝ Description:: Insert mutually interdependant calendars ⍝ Show 2 calendars to select reservation dates. ⍝ The first date cannot be before today and the second cannot be the ⍝ date before tomorrow. Its default is 1 week after check in. ∇ Compose;today;fromidn;minto;tbl;tr;td;head;todate;from :Access Public today←3↑⎕TS fromidn←dateToIDN today Add _.h1'Drop ↓ Inn' Add _.h2'Hotel reservation system' ⍝ The table header tbl←Add _.table head←tbl.Add _.thead (head.Add _.tr).{Add _.th ⍵}¨'Check in' 'Check out' tr←tbl.Add _.tr ⍝ The in date td←tr.Add _.td from←'in'td.Add _SF.ejDatePicker today'yyyy/MM/dd' from.Set⊂'minDate'(newDate today) from.On'change' 'setNewDate',⊂('in' 'model' 'value')('out' 'eval' '$("#out").ejDatePicker("model.value")') ⍝ The out date td←tr.Add _.td todate←IDNToDate fromidn+7 TO←'out'td.Add _SF.ejDatePicker todate'yyyy/MM/dd' minto←newDate IDNToDate fromidn+1 TO.Set⊂'minDate'minto ∇ newDate←{'⍎new Date("',(⍕⍵),'")'} dateToIDN←{2 ⎕NQ'.' 'datetoidn'⍵} IDNToDate←{3↑ 2 ⎕NQ'.' 'idntodate'⍵} ∇ r←setNewDate;in;out :Access public ⍝ Reset minimum reservation check out date in←dateToIDN stringToDate⍕Get'in' r←'minDate'TO.Update newDate IDNToDate in+1 out←dateToIDN stringToDate⍕Get'out' ⍝ If the new IN date is not before the OUT date we reset OUT to 1 week after :If in≥out r,←'value'TO.Update newDate IDNToDate in+7 :EndIf ∇ MONTHS←↓12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec' FI←{(b v)←⎕vfi ⍵ ⋄ b/v} ∇ ymd←stringToDate str;pos;mon;t ⍝ str is of the genre "Wed Aug 05 2015 00:00:00 GMT-0400 (Eastern Daylight Time)" ⍝ We need to weed out the day of the week and the time str←(+/∧\' '=str)↓str ⍝ remove the leading spaces :If 0∊⍴t←MONTHS ⎕S 0 3⊢str ⍝ look for the month as a string. If not found ymd←3↑FI str ⍝ grab the 1st 3 numbers found ymd←ymd[⍒(2×31<ymd)+ymd<12] ⍝ put in correct order :Else ⍝ otherwise (if found) (pos mon)←0 1+1⊃t :If ~0∊⍴t←FI pos↑str ⍝ any number before the month? (e.g. 2 May 2021) ymd←⌽⍣(31<⍬⍴t)⊢(1↑FI pos↓str),mon,t :Else ymd←¯1⌽mon,2↑FI pos↓str :EndIf :EndIf ∇ :EndClass
Fix ejDatePickerAdvanced merge problem
Fix ejDatePickerAdvanced merge problem
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
24a87630536ac8b44500309692101c88d0885701
MS3/QA/Examples/DC/SelectAdvanced.dyalog
MS3/QA/Examples/DC/SelectAdvanced.dyalog
 msg←SelectAdvanced;result;output;sel;froot;prev ⍝ Test /Examples/DC/SelectAdvanced ⍝ Ensure 'multi' (the selection list) is there: msg←'selection list not there' :If 0≢sel←Find'multi' ⍝ Grab the 2 elements already chosen: Click'PressMe' output←Find'output' {0≠⍴output.Text}Retry ⍬ ⍝ Wait to see if it gets populated msg←'Expected output was not produced.' :AndIf 'You picked: Bananas Pears'≡prev←output.Text ⍝ Make a single selection: froot←'Grapes' 'multi'SelectByText'-'froot Click'PressMe' output←Find'output' {prev≢output.Text}Retry ⍬ ⍝ Wait to see if it gets populated :AndIf (prev←output.Text)≡'You picked: ',froot ⍝ Make another selection: 'multi'SelectByText'Pears' Click'PressMe' output←Find'output' {prev≢output.Text}Retry ⍬ ⍝ Wait to see if it gets populated :AndIf (prev←output.Text)≡'You picked: ',froot,' Pears' msg←'' :EndIf
 msg←SelectAdvanced;result;output;sel;froot;prev ⍝ Test /Examples/DC/SelectAdvanced ⍝ Ensure 'multi' (the selection list) is there: msg←'selection list not there' :If 0≢sel←Find'multi' ⍝ Grab the 2 elements already chosen: Click'PressMe' output←Find'output' {0≠⍴output.Text}Retry ⍬ ⍝ Wait to see if it gets populated msg←'Expected output was not produced.' :AndIf 'You picked: Bananas Pears'≡prev←output.Text ⍝ Make a single selection: froot←'Grapes' 'multi'SelectItemText'~'froot Click'PressMe' output←Find'output' {prev≢output.Text}Retry ⍬ ⍝ Wait to see if it gets populated :AndIf (prev←output.Text)≡'You picked: ',froot ⍝ Make another selection: 'multi'SelectItemText'Pears' Click'PressMe' output←Find'output' {prev≢output.Text}Retry ⍬ ⍝ Wait to see if it gets populated :AndIf (prev←output.Text)≡'You picked: ',froot,' Pears' msg←'' :EndIf
Rename of SelectByText to SelectItemText
Rename of SelectByText to SelectItemText
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
a0a42fd77b52525ab45ce2b233b6e27c7ffb7409
Core/Page.dyalog
Core/Page.dyalog
:Class Page : #.MiPage ⍝ Class to be used with HTMLRenderer (Dyalog v16 and later) :field public _Renderer←'' :field public _Url←'' :field public _Interactive←0 :field public _CallbackFn←'Callback' :field public _Config :field public _Request :field public _Args :field public Props :field public Coord←'ScaledPixel' :field public Size←⍬ ⍬ :field public ReadOnly NL←⎕UCS 10 :field public shared APLVersion←{⊃(//)⎕VFI ⍵/⍨2>+\'.'=⍵}2⊃#.⎕WG 'APLVersion' begins←{⍺≡(⍴⍺)↑⍵} ∇ make :Access public :Implements constructor ⎕SIGNAL makeCommon ∇ ∇ make1 arg ⍝ args are: [1] HTML content [2] URL :Access public :Implements constructor arg←,⊆arg (content _Url)←2↑arg,(⍴arg)↓'' '' :If ~0∊⍴content ⋄ Add content ⋄ :EndIf ⎕SIGNAL makeCommon ∇ ∇ r←makeCommon →0↓⍨0∊⍴r←(17>APLVersion)/⊂('EN' 11)('Message' 'Dyalog v17.0 or later is required to use HTMLRenderer-based features') Props←⎕NS'' _Config←#.Boot.ms.Config _PageName←3⊃⎕SI,⊂'WC2Page' ∇ ∇ Close :Implements destructor :Trap 0 2 ⎕NQ _Renderer'Close' :EndTrap ∇ ∇ Run :Access public :If 0∊⍴_Renderer run&0 :Else Reset Render :EndIf ∇ ∇ Reset :Access public Body.Content←'' Head.Content←'' ∇ ∇ run arg :Access public _Renderer←⎕NEW'HTMLRenderer'(('Coord'Coord)('Size'Size)('Event'('onHTTPRequest' '__CallbackFn'))('URL'_PageName)('InterceptedURLs'(1 2⍴'*' 1))) :If ~0∊⍴props←_Renderer.PropList∩Props.⎕NL ¯2 {_Renderer⍎⍺,'←⍵'}/¨{⍵(Props⍎⍵)}¨props :EndIf _Renderer.Wait ∇ ∇ Render :Access public _Renderer.HTML←⎕BASE.Render ∇ ∇ {r}←{args}Add content :Access public :If 0=⎕NC'args' ⋄ args←⊢ ⋄ :EndIf r←args ⎕BASE.Add content ∇ ∇ {r}←{args}New content :Access public :If 0=⎕NC'args' ⋄ args←⊢ ⋄ :EndIf r←args ⎕BASE.New content ∇ ∇ r←__CallbackFn args;ext;mimeType;filename;url;mask;cbdata;request;int;handler;content :Access public r←args →0⍴⍨0∊⍴8⊃args request←⎕NEW #.HtmlRenderRequest(args(819⌶_PageName)) :If 0∊⍴request.Page ⍝ initialization r[4 5 6 7]←1 200 'OK' 'text/html' r[10]←⊂UnicodeToHtml ⎕BASE.Render r[9]←⊂NL,⍨∊NL,⍨¨('Content-Type: ',7⊃r)('Content-Length: ',⍕≢10⊃r) :ElseIf ~0∊⍴ext←(819⌶)1↓⊃¯1↑1 ⎕NPARTS request.Page ⍝ !!!need to handle case where another MiPage is requested :If #.Files.Exists filename←∊1 ⎕NPARTS _Config #.MiServer.Virtual request.Page :If ' '∨.≠handler←⊃_Config.MappingHandlers.handler/⍨<\_Config.MappingHandlers.ext≡¨⊂'.',ext (mimeType content)←⍎'filename #.MappingHandlers.',handler,' request' :Else mimeType←#.Boot.ms.Config.ContentTypes tableLookup ext content←{{(⎕NUNTIE ⍵)⊢⎕NREAD ⍵,(⎕DR' '),¯1}⍵ ⎕NTIE 0}filename :EndIf r[7]←mimeType r[4 5 6]←1 200 'OK' r[9]←⊂NL,⍨∊NL,⍨¨'Content-Type: ' 'Content-Length: ',¨⍕¨mimeType(≢content) r[10]←⊂content :Else r[4 5 6 7]←1 404 'NOT FOUND' '' r[9 10]←⊂'' :EndIf :ElseIf request.isAPLJax _Args←args _Request←request ⎕THIS #.MiServer.MoveRequestData _Request _what←_Request.GetData'_what' _event←_Request.GetData'_event' _value←_Request.GetData'_value' _selector←_Request.GetData'_selector' _target←_Request.GetData'_target' _currentTarget←_Request.GetData'_currentTarget' _callback←_Request.GetData'_callback' :If _CallbackFn≢'Callback' r←⍎'_Args ',_CallbackFn,' _Request' ⍝ did you specify your own HTMLRenderer callback function? :Else cbdata←Callback r[10]←⊂UnicodeToHtml #.JSON.toAPLJAX cbdata ⍝ we expect an APLJAX-style response r[4 5 6 7]←1 200 'OK' 'application/json' r[9]←⊂NL,⍨∊NL,⍨¨'Content-Type: ' 'Content-Length: ',¨⍕¨'application/json'(≢10⊃r) :EndIf :EndIf r[9]←⊂(⎕UCS 32)~⍨9⊃r ∇ ∇ r←Callback;_context;_found;_valence :Access public overridable r←'' :If ''≢_callback _context←'' :While ~_found←3=⎕NC _context,_callback :If ~0∊⍴_context :If (,'#')≡⍕⍎_context ⍝ popped up to root and still not found? :Leave :EndIf :EndIf _context,←'##.' :EndWhile :If _found _valence←|1 2⊃⎕AT _context,_callback r←⍎('_Args '/⍨_valence=2),_context,_callback,' _Request'/⍨_valence>0 :Else ⎕←'Callback function not found: ',_callback :EndIf :EndIf ∇ ∇ r←UnicodeToHtml txt;u;ucs :Access public shared ⍝ converts chars ⎕UCS >127 to HTML safe format r←,⍕txt u←127<ucs←⎕UCS r (u/r)←(~∘' ')¨↓'G<&#ZZZ9;>'⎕FMT u/ucs r←∊r ∇ tableLookup←{(⍺[;2],⊂'')[⍺[;1]⍳⊆,⍵]} :EndClass
:Class Page : #.MiPage ⍝ Class to be used with HTMLRenderer (Dyalog v16 and later) :field public _Renderer←'' :field public _Url←'' :field public _Interactive←0 :field public _CallbackFn←'Callback' :field public _Config :field public _Request :field public _Args :field public Props :field public Coord←'ScaledPixel' :field public Size←⍬ ⍬ :field public ReadOnly NL←⎕UCS 10 :field public shared APLVersion←{⊃(//)⎕VFI ⍵/⍨2>+\'.'=⍵}2⊃#.⎕WG 'APLVersion' begins←{⍺≡(⍴⍺)↑⍵} ∇ make :Access public :Implements constructor ⎕SIGNAL makeCommon ∇ ∇ make1 arg ⍝ args are: [1] HTML content [2] URL :Access public :Implements constructor arg←,⊆arg (content _Url)←2↑arg,(⍴arg)↓'' '' :If ~0∊⍴content ⋄ Add content ⋄ :EndIf ⎕SIGNAL makeCommon ∇ ∇ r←makeCommon →0↓⍨0∊⍴r←(17>APLVersion)/⊂('EN' 11)('Message' 'Dyalog v17.0 or later is required to use HTMLRenderer-based features') Props←⎕NS'' _Config←#.Boot.ms.Config _PageName←3⊃⎕SI,⊂'WC2Page' ∇ ∇ Close :Implements destructor :Trap 0 2 ⎕NQ _Renderer'Close' :EndTrap ∇ ∇ Run :Access public :If 0∊⍴_Renderer run&0 :Else Reset Show :EndIf ∇ ∇ Reset :Access public Body.Content←'' Head.Content←'' ∇ ∇ run arg :Access public _Renderer←⎕NEW'HTMLRenderer'(('Coord'Coord)('Size'Size)('Event'('onHTTPRequest' '__CallbackFn'))('URL'_PageName)('InterceptedURLs'(1 2⍴'*' 1))) :If ~0∊⍴props←_Renderer.PropList∩Props.⎕NL ¯2 {_Renderer⍎⍺,'←⍵'}/¨{⍵(Props⍎⍵)}¨props :EndIf _Renderer.Wait ∇ ∇ r←Render :Access public r←⎕BASE.Render ∇ ∇ Show :Access public _Renderer.HTML←Render ∇ ∇ {r}←{args}Add content :Access public :If 0=⎕NC'args' ⋄ args←⊢ ⋄ :EndIf r←args ⎕BASE.Add content ∇ ∇ {r}←{args}New content :Access public :If 0=⎕NC'args' ⋄ args←⊢ ⋄ :EndIf r←args ⎕BASE.New content ∇ ∇ r←__CallbackFn args;ext;mimeType;filename;url;mask;cbdata;request;int;handler;content :Access public r←args →0⍴⍨0∊⍴8⊃args request←⎕NEW #.HtmlRenderRequest(args(819⌶_PageName)) :If 0∊⍴request.Page ⍝ initialization r[4 5 6 7]←1 200 'OK' 'text/html' r[10]←⊂UnicodeToHtml Render r[9]←⊂NL,⍨∊NL,⍨¨('Content-Type: ',7⊃r)('Content-Length: ',⍕≢10⊃r) :ElseIf ~0∊⍴ext←(819⌶)1↓⊃¯1↑1 ⎕NPARTS request.Page ⍝ !!!need to handle case where another MiPage is requested :If #.Files.Exists filename←∊1 ⎕NPARTS _Config #.MiServer.Virtual request.Page :If ' '∨.≠handler←⊃_Config.MappingHandlers.handler/⍨<\_Config.MappingHandlers.ext≡¨⊂'.',ext (mimeType content)←⍎'filename #.MappingHandlers.',handler,' request' :Else mimeType←#.Boot.ms.Config.ContentTypes tableLookup ext content←{{(⎕NUNTIE ⍵)⊢⎕NREAD ⍵,(⎕DR' '),¯1}⍵ ⎕NTIE 0}filename :EndIf r[7]←mimeType r[4 5 6]←1 200 'OK' r[9]←⊂NL,⍨∊NL,⍨¨'Content-Type: ' 'Content-Length: ',¨⍕¨mimeType(≢content) r[10]←⊂content :Else r[4 5 6 7]←1 404 'NOT FOUND' '' r[9 10]←⊂'' :EndIf :ElseIf request.isAPLJax _Args←args _Request←request ⎕THIS #.MiServer.MoveRequestData _Request _what←_Request.GetData'_what' _event←_Request.GetData'_event' _value←_Request.GetData'_value' _selector←_Request.GetData'_selector' _target←_Request.GetData'_target' _currentTarget←_Request.GetData'_currentTarget' _callback←_Request.GetData'_callback' :If _CallbackFn≢'Callback' r←⍎'_Args ',_CallbackFn,' _Request' ⍝ did you specify your own HTMLRenderer callback function? :Else cbdata←Callback r[10]←⊂UnicodeToHtml #.JSON.toAPLJAX cbdata ⍝ we expect an APLJAX-style response r[4 5 6 7]←1 200 'OK' 'application/json' r[9]←⊂NL,⍨∊NL,⍨¨'Content-Type: ' 'Content-Length: ',¨⍕¨'application/json'(≢10⊃r) :EndIf :EndIf r[9]←⊂(⎕UCS 32)~⍨9⊃r ∇ ∇ r←Callback;_context;_found;_valence :Access public overridable r←'' :If ''≢_callback _context←'' :While ~_found←3=⎕NC _context,_callback :If ~0∊⍴_context :If (,'#')≡⍕⍎_context ⍝ popped up to root and still not found? :Leave :EndIf :EndIf _context,←'##.' :EndWhile :If _found _valence←|1 2⊃⎕AT _context,_callback r←⍎('_Args '/⍨_valence=2),_context,_callback,' _Request'/⍨_valence>0 :Else ⎕←'Callback function not found: ',_callback :EndIf :EndIf ∇ ∇ r←UnicodeToHtml txt;u;ucs :Access public shared ⍝ converts chars ⎕UCS >127 to HTML safe format r←,⍕txt u←127<ucs←⎕UCS r (u/r)←(~∘' ')¨↓'G<&#ZZZ9;>'⎕FMT u/ucs r←∊r ∇ tableLookup←{(⍺[;2],⊂'')[⍺[;1]⍳⊆,⍵]} :EndClass
Make Page.Render return rendered HTML, add Show method to show rendered HTML in HTMLRenderer
Make Page.Render return rendered HTML, add Show method to show rendered HTML in HTMLRenderer
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
b01f333a1797aa6c96a61c51d6958194c3b92a64
lib/prelude.apl
lib/prelude.apl
$dot ← { WA ← (1↓⍴⍵),⍴⍺ KA ← (⊃⍴⍴⍺)-1 VA ← ⍳ ⊃ ⍴WA ZA ← (KA⌽¯1↓VA),¯1↑VA TA ← ZA⍉WA⍴⍺ ⍝ Replicate, transpose WB ← (¯1↓⍴⍺),⍴⍵ KB ← ⊃ ⍴⍴⍺ VB ← ⍳ ⊃ ⍴WB ZB0 ← (-KB) ↓ KB ⌽ ⍳(⊃⍴VB) ZB ← (¯1↓(⍳ KB)),ZB0,KB TB ← ZB⍉WB⍴⍵ ⍝ Replicate, transpose ⍺⍺ / TA ⍵⍵ TB ⍝ Compute the result } $out ← { A ← ⍺ B ← ⍵ T ← (⊃(⍴⍴A))⌽⍳⊃⍴(⍴B),⍴A x ← T ⍉ ((⍴B),(⍴A)) ⍴ A y ← ((⍴A),(⍴B)) ⍴ B x ⍺⍺ y } $slashbar ← { ⍉ ⍺⍺ / ⍉ ⍵ } $log ← { ⍝ Dyadic logarithm (⍟⍵)÷⍟⍺ }
$dot ← { WA ← (1↓⍴⍵),⍴⍺ KA ← (⊃⍴⍴⍺)-1 VA ← ⍳ ⊃ ⍴WA ZA ← (KA⌽¯1↓VA),¯1↑VA TA ← ZA⍉WA⍴⍺ ⍝ Replicate, transpose WB ← (¯1↓⍴⍺),⍴⍵ KB ← ⊃ ⍴⍴⍺ VB ← ⍳ ⊃ ⍴WB ZB0 ← (-KB) ↓ KB ⌽ ⍳(⊃⍴VB) ZB ← (¯1↓(⍳ KB)),ZB0,KB TB ← ZB⍉WB⍴⍵ ⍝ Replicate, transpose ⍺⍺ / TA ⍵⍵ TB ⍝ Compute the result } $out ← { A ← ⍺ B ← ⍵ T ← (⊃(⍴⍴A))⌽⍳⊃⍴(⍴B),⍴A x ← T ⍉ ((⍴B),(⍴A)) ⍴ A y ← ((⍴A),(⍴B)) ⍴ B x ⍺⍺ y } $slashbar ← { ⍉ ⍺⍺ / ⍉ ⍵ } $log ← { ⍝ Dyadic logarithm (⍟⍵)÷⍟⍺ } ReadCSVDouble ← ⎕ReadDoubleVecFile ReadCSVInt ← ⎕ReadIntVecFile xor ← ⎕INT32XOR and ← ⎕INT32AND sll ← ⎕INT32SHL srl ← ⎕INT32SHR testBit ← { 0≠⍵ and 1 sll (⍺-1) }
Add file reading and bitwise operations to TAIL-prelude
Add file reading and bitwise operations to TAIL-prelude
APL
mit
melsman/apltail
3b523dda2cacf471a4794b7e235f9df37d18c72b
HTML/_HTML.dyalog
HTML/_HTML.dyalog
:Namespace _HTML :class Form : #._html.form :field public Method←'post' :field public Action←'' :field public Serialize←0 ∇ make;c :Access public :Implements constructor :If {6::0 ⋄ ''≢c∘←##.context ⍵}'_Request' Action←c._Request.Page :EndIf ∇ ∇ make1 action :Access public :Implements constructor Action←action ∇ ∇ r←Render :Access public Attr['action' 'method']←Action Method r←⎕BASE.Render ∇ :endclass :class InputSubmit : #._html.input ∇ Make :Access public :Implements constructor :base (name value)←'submit' 'submit' SetAttr('type' 'submit') ∇ ∇ Make1 args;n;v :Access public :Implements constructor :base args←eis args (n v)←2↑args,(⍴args)↓'submit' 'submit' (name value)←n v SetAttr('type' 'submit') ∇ :endclass :class Input : #._html.input :field public Label←'' ∇ Make1 args;l;n;t;v :Access public :Implements constructor args←eis args t n v l←4↑args,(⍴args)↓'text' '' '' '' (type value Label)←t v l :If ~0∊⍴n ⋄ name←id←n ⋄ :EndIf ∇ ∇ html←Render :Access public html←'' :If ~0∊⍴Label :If id≡⎕NULL ⋄ id←'gen',⍕?1000 ⋄ :EndIf html,←'<label for="',(⍕id),'">',Label,'</label>' :EndIf html,←⎕BASE.Render ∇ :endclass :class InputGrid : #._html.table :field public Border←0 :field public Labels←'' :field public Inputs←'' :field public Headings←'' ∇ html←Render;cells;rows :Access public cells←{⎕NEW #._html.td(⍵)}¨renderIt¨Labels,[1.1]Inputs cells[;1].style←⊂'text-align:right' rows←⎕NEW¨(⊃⍴cells)⍴#._html.tr rows.Add↓cells Content←rows.Render SetAttr'border'(⍕Border) html←⎕BASE.Render ∇ :endclass :class EditField : #._html.input ∇ make1 nm :Access public :Implements constructor name←nm id←name type←'text' ∇ ∇ make2(nm val) :Access public :Implements constructor :If ~1=≡name←nm val ⍝ handle 2-character names (name value)←nm val :EndIf id←name type←'text' ∇ ∇ make3(nm val att) :Access public :Implements constructor :If ~1=≡name←nm val att ⍝ handle 3-character names (name value)←nm val SetAttr att :EndIf id←name type←'text' ∇ :endclass :class Button : #._html.button :field _content←'' ∇ Make0 :Access public :Implements constructor :base SetAttr('type' 'button') ∇ ∇ Make args;n;v :Access public :Implements constructor :base ⍝ arguments are name value {content} args←eis args (n v _content)←3↑args,(⍴args)↓'button' 'button' '' :If 0∊⍴_content ⋄ _content←v ⋄ :EndIf (name value)←n v id←name SetAttr('type' 'button') ∇ ∇ html←Render :Access public :If 0∊⍴Content Content←_content :EndIf html←⎕BASE.Render ∇ :endclass :class Script : #._html.script :field public File←'' :field public Code←'' ∇ Make0 :Access public :Implements constructor SetAttr'type="text/javascript"' ∇ ∇ Make1 params :Access public :Implements constructor params←eis params Code File←2↑params,(⍴params)↓'' '' SetAttr'type="text/javascript"' ∇ ∇ html←Render :Access public :If ~0∊⍴File SetAttr('src'File) :ElseIf ~0∊⍴Code Content←Code :EndIf html←⎕BASE.Render ∇ :endclass :class Style : #._html.style :field public Selector←'' :field public Styles←'' ∇ Make1 params :Access public :Implements constructor params←eis params (Selector Styles)←2↑params,(⍴params)↓'' '' ∇ ∇ html←Render :Access public Content←Selector,#.HTMLUtils.Styles Styles html←⎕BASE.Render ∇ :endclass :class StyleSheet : #._html.link :field public href←'' ∇ Make1 params :Access public :Implements constructor href←params ∇ ∇ html←Render :Access public SetAttr(('href'href)('rel' 'stylesheet')('type' 'text/css')) html←⎕BASE.Render ∇ :endclass :class Table : #._html.table :field public Data←0 0⍴⊂'' :field public CellAttr←'' :field public HeaderRows←0 :field public HeaderAttr←'' :field public MakeCellIds←0 :field public MakeRowIds←0 ∇ Make0 :Access public :Implements constructor ∇ ∇ Make1 data :Access public :Implements constructor data←eis data (Data CellAttr HeaderRows HeaderAttr MakeCellIds MakeRowIds)←6↑data,(⍴data)↓Data CellAttr HeaderRows HeaderAttr MakeCellIds MakeRowIds ∇ ∇ html←Render;data;atts;tda;tha;hdrrows;cellids;rowids;rows;x;head;body;table;thead;tbody :Access public data tda tha hdrrows cellids rowids←Data CellAttr HeaderAttr HeaderRows MakeCellIds MakeRowIds hdrrows←⍬⍴hdrrows data←((rows←×/¯1↓⍴data),¯1↑⍴data)⍴data head←body←(0 1×⍴data)⍴⊂'' :If 0≠hdrrows head←{⎕NEW #._html.th ⍵}¨hdrrows↑data :If cellids head.id←{∊'rc',¨⍕¨⍵}¨⍳⍴head :EndIf :If ~0∊⍴tha head.SetAttr¨(⍴head)⍴⊂¨eis tha :EndIf :EndIf :If 0<(⊃⍴data)-hdrrows body←{⎕NEW #._html.td ⍵}¨hdrrows↓data :If cellids body.id←{∊'rc',¨⍕¨⍵}¨hdrrows↓⍳⍴data :EndIf :If ~0∊⍴tda body.SetAttr¨(⍴body)⍴⊂¨eis tda :EndIf :EndIf (table←⎕NEW¨rows⍴#._html.tr).Add↓head⍪body :If rowids table.id←{'row',⍕⍵}⍳rows :EndIf thead←tbody←'' :If 0≠hdrrows (thead←⎕NEW #._html.thead).Add hdrrows↑table :EndIf :If 0<(⊃⍴data)-hdrrows (tbody←⎕NEW #._html.tbody).Add hdrrows↓table :EndIf Content←thead,tbody html←⎕BASE.Render ∇ :endclass :EndNamespace
:Namespace _HTML :class Form : #._html.form :field public Method←'post' :field public Action←'' :field public Serialize←0 ∇ make;c :Access public :Implements constructor :If {6::0 ⋄ ''≢c∘←##.context ⍵}'_Request' Action←c._Request.Page :EndIf ∇ ∇ make1 action :Access public :Implements constructor Action←action ∇ ∇ r←Render :Access public Attr['action' 'method']←Action Method r←⎕BASE.Render ∇ :endclass :class InputSubmit : #._html.input ∇ Make :Access public :Implements constructor :base (name value)←'submit' 'submit' SetAttr('type' 'submit') ∇ ∇ Make1 args;n;v :Access public :Implements constructor :base args←eis args (n v)←2↑args,(⍴args)↓'submit' 'submit' (name value)←n v SetAttr('type' 'submit') ∇ :endclass :class Input : #._html.input :field public Label←'' ∇ Make1 args;l;n;t;v :Access public :Implements constructor args←eis args t n v l←4↑args,(⍴args)↓'text' '' '' '' (type value Label)←t v l :If ~0∊⍴n ⋄ name←id←n ⋄ :EndIf ∇ ∇ html←Render :Access public html←'' :If ~0∊⍴Label :If id≡⎕NULL ⋄ id←'gen',⍕?1000 ⋄ :EndIf html,←'<label for="',(⍕id),'">',Label,'</label>' :EndIf html,←⎕BASE.Render ∇ :endclass :class InputGrid : #._html.table :field public Border←0 :field public Labels←'' :field public Inputs←'' :field public Headings←'' ∇ html←Render;cells;rows :Access public cells←{⎕NEW #._html.td(⍵)}¨renderIt¨Labels,[1.1]Inputs cells[;1].style←⊂'text-align:right' rows←⎕NEW¨(⊃⍴cells)⍴#._html.tr rows.Add↓cells Content←rows.Render SetAttr'border'(⍕Border) html←⎕BASE.Render ∇ :endclass :class EditField : #._html.input ∇ make1 nm :Access public :Implements constructor name←nm id←name type←'text' ∇ ∇ make2(nm val) :Access public :Implements constructor :If ~1=≡name←nm val ⍝ handle 2-character names (name value)←nm val :EndIf id←name type←'text' ∇ ∇ make3(nm val att) :Access public :Implements constructor :If ~1=≡name←nm val att ⍝ handle 3-character names (name value)←nm val SetAttr att :EndIf id←name type←'text' ∇ :endclass :class Button : #._html.button :field _content←'' ∇ Make0 :Access public :Implements constructor :base SetAttr('type' 'button') ∇ ∇ Make args;n;v :Access public :Implements constructor :base ⍝ arguments are name value {content} args←eis args (n v _content)←3↑args,(⍴args)↓'button' 'button' '' :If 0∊⍴_content ⋄ _content←v ⋄ :EndIf (name value)←n v id←name SetAttr('type' 'button') ∇ ∇ html←Render :Access public :If 0∊⍴Content Content←_content :EndIf html←⎕BASE.Render ∇ :endclass :class Script : #._html.script :field public File←'' :field public Code←'' ∇ Make0 :Access public :Implements constructor SetAttr'type="text/javascript"' ∇ ∇ Make1 params :Access public :Implements constructor params←eis params Code File←2↑params,(⍴params)↓'' '' SetAttr'type="text/javascript"' ∇ ∇ html←Render :Access public :If ~0∊⍴File SetAttr('src'File) :ElseIf ~0∊⍴Code Content←Code :EndIf html←⎕BASE.Render ∇ :endclass :class Style : #._html.style :field public Selector←'' :field public Styles←'' ∇ Make1 params :Access public :Implements constructor params←eis params (Selector Styles)←2↑params,(⍴params)↓'' '' ∇ ∇ html←Render :Access public Content←Selector,#.HTMLUtils.Styles Styles html←⎕BASE.Render ∇ :endclass :class StyleSheet : #._html.link :field public href←'' ∇ Make1 params :Access public :Implements constructor href←params ∇ ∇ html←Render :Access public SetAttr(('href'href)('rel' 'stylesheet')('type' 'text/css')) html←⎕BASE.Render ∇ :endclass :class Table : #._html.table :field public Data←0 0⍴⊂'' :field public CellAttr←'' :field public HeaderRows←0 :field public HeaderAttr←'' :field public MakeCellIds←0 :field public MakeRowIds←0 ∇ Make0 :Access public :Implements constructor ∇ ∇ Make1 data :Access public :Implements constructor Data←data ∇ ∇ html←Render;data;atts;tda;tha;hdrrows;cellids;rowids;rows;x;head;body;table;thead;tbody :Access public data tda tha hdrrows cellids rowids←Data CellAttr HeaderAttr HeaderRows MakeCellIds MakeRowIds hdrrows←⍬⍴hdrrows data←((rows←×/¯1↓⍴data),¯1↑⍴data)⍴data head←body←(0 1×⍴data)⍴⊂'' :If 0≠hdrrows head←{⎕NEW #._html.th ⍵}¨hdrrows↑data :If cellids head.id←{∊'rc',¨⍕¨⍵}¨⍳⍴head :EndIf :If ~0∊⍴tha head.SetAttr¨(⍴head)⍴⊂¨eis tha :EndIf :EndIf :If 0<(⊃⍴data)-hdrrows body←{⎕NEW #._html.td ⍵}¨hdrrows↓data :If cellids body.id←{∊'rc',¨⍕¨⍵}¨hdrrows↓⍳⍴data :EndIf :If ~0∊⍴tda body.SetAttr¨(⍴body)⍴⊂¨eis tda :EndIf :EndIf (table←⎕NEW¨rows⍴#._html.tr).Add↓head⍪body :If rowids table.id←{'row',⍕⍵}⍳rows :EndIf thead←tbody←'' :If 0≠hdrrows (thead←⎕NEW #._html.thead).Add hdrrows↑table :EndIf :If 0<(⊃⍴data)-hdrrows (tbody←⎕NEW #._html.tbody).Add hdrrows↓table :EndIf Content←thead,tbody html←⎕BASE.Render ∇ :endclass :EndNamespace
Revert "Extend _HTML.Table"
Revert "Extend _HTML.Table" This reverts commit 74fc0567c21704cfa8a0a0bdc253e7ef64a9df8f.
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
4a0cf0e762c29ce7fdcd5907e3415564f1bb55e7
Core/MiPage.dyalog
Core/MiPage.dyalog
:Class MiPage : #.HtmlPage ⍝∇:require =\HtmlPage.dyalog ⍝∇:require =\JSON.dyalog :Field Public _PageName←'' ⍝ Page file name :Field Public _PageDate←'' ⍝ Page saved date :field Public _Request ⍝ HTTPRequest :field Public _Scripts←'' :field Public _Styles←'' :field Public _CssReset←'' ⍝ location of CSS Reset file (if any) :field Public _CssOverride←'' ⍝ location of CSS Override file (if any) :field Public _Serialized←1 ⍝ serialized forms to return in _PageData :field Public _event ⍝ set by APLJAX callback - event that was triggered :field Public _what ⍝ set by APLJAX callback - name or id of the triggering element :field Public _value ⍝ set by APLJAX callback - value of the triggering element :field Public _selector ⍝ set by APLJAX callback - CSS/jQuery selector for the element that triggered the event :field Public _callback ⍝ set by APLJAX callback - name of the callback function :field Public _target ⍝ set by APLJAX callback - id of the target element :field Public _currentTarget ⍝ set by APLJAX callback - id of the currentTarget element :field Public _PageData ⍝ namespace containing any data passed via forms or URL :field Public _AjaxResponse←'' :field Public _DebugCallbacks←0 :field Public _TimedOut←0 :field Public OnLoad←'' ⍝ page equivalent to ⎕LX :field Public Charset←'UTF-8' ⍝ default charset _used←'' ⍝ keep track of what's been used ∇ Make :Access public :Implements constructor :Base MakeCommon ∇ ∇ Make1 req :Access public _Request←req :Implements constructor :base MakeCommon ∇ ∇ MakeCommon _PageData←⎕NS'' ∇ ∇ {r}←Render;b;styles :Access public Head.Insert #._html.meta''('charset=',⍕Charset) :If ''≢OnLoad Use'JQuery' :EndIf b←RenderBody styles←∪_Styles styles←styles,⍨{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssReset styles←styles,{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssOverride :If ~0∊⍴styles {Insert #._DC.StyleSheet ⍵}¨⌽∪styles :EndIf :If ~0∊⍴_Scripts {(Insert _html.script).Set('src=',⍵)}¨⌽∪_Scripts :EndIf :If ~0∊⍴Handlers b,←∊Handlers.Render :EndIf :If ''≢OnLoad b,←(⎕NEW #._html.script('$(function(){',OnLoad,'});')).Render :EndIf r←RenderPage b :If 0≠⎕NC⊂'_Request.Response' _Request.Response.HTML←r :EndIf ∇ ∇ {r}←Wrap :Access public r←Render ∇ ∇ Use resources;n;ind;t;x;server :Access public resources←eis resources :For x :In resources :If ~(⊂x)∊_used :Select ⊃x :Case '⍎' ⍝ script _Scripts,←⊂1↓x :Case '⍕' ⍝ style sheet _Styles,←⊂1↓x :Else :If 0≠⎕NC'_Request.Server' server←_Request.Server :ElseIf 0≠⎕NC'#.Boot.ms' server←#.Boot.ms :EndIf :If 0≠server.⎕NC⊂'Config.Resources' :AndIf ~0∊n←1↑⍴server.Config.Resources :If n≥ind←server.Config.Resources[;1]⍳⊂x :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 2)⊃server.Config.Resources _Scripts,←t :EndIf :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 3)⊃server.Config.Resources _Styles,←t :EndIf :Else 1 server.Log _PageName,' references unknown resource: ',x :EndIf :EndIf :EndSelect _used,←⊂x :EndIf :EndFor ∇ ∇ r←{proto}Get names;noproto;char :Access public :If noproto←0=⎕NC'proto' ⋄ proto←'' ⋄ :EndIf names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf ~(_PageData.⎕NC names)∊2 9 r←,proto :Else r←_PageData⍎names :If 2≤≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If noproto≥char←0=2|⎕DR proto :AndIf isString r r←#.JSON.toAPL r :EndIf :If noproto⍱char :If 1≠2|⎕DR r r←,proto :EndIf :EndIf :EndIf ∇ ∇ r←GetNames str :Access public →0⍴⍨0∊⍴r←_PageData.⎕NL-2 9 →0⍴⍨0∊⍴str r←r/⍨r #.Strings.beginsWith¨⊂str ∇ ∇ r←{proto}GetRaw names :Access public proto←{6::⍵ ⋄ proto}'' names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf 2≠_PageData.⎕NC names r←,proto :Else r←_PageData⍎names :If 2=≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If ~isChar proto r←{0::⍵ ⋄ 0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ r←{proto}SessionGet names :Access public proto←{6::⍵ ⋄ proto}'' names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘SessionGet¨names :ElseIf 0=_Request.Session.⎕NC names r←proto :Else r←_Request.Session⍎names :If 1<|≡r ⋄ r←∊r ⋄ :EndIf :If ~0 2∊⍨10|⎕DR proto ⍝ if the prototype is numeric :AndIf 0 2∊⍨10|⎕DR r ⍝ and the element is character r←{0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ Close session ⍝ Called when the session ends :Access Public Overridable ∇ :section APLJax ⍝ used for building APLJAX responses ∇ _resetAjax :Access public _AjaxResponse←'' ∇ ∇ r←_id :Access public ⍝ as there seems to be a problem with at least some Syncfusion widgets ⍝ being able to provide the id (or name) of the triggering element, we try to obtain it from _what or _selector r←'' :Trap 0 :If 0∊⍴r←_what :AndIf '#'=⊃_selector r←1↓_selector :EndIf :EndTrap ∇ ∇ r←renderContent content;c :Access public shared r←'' content←eis content :While ~0∊⍴content :Select ≡c←⊃content :Case 0 :If isClass c :Select ⊃⍴content :Case 1 r,←(⎕NEW c).Render :Case 2 r,←(⎕NEW c(2⊃content)).Render :Else r,←(⎕NEW c(1↓content)).Render :EndSelect :ElseIf isInstance c r,←c.Render :Else r,←(⎕NEW #.HtmlElement(''content)).Render :EndIf content←'' :Case 1 :If isClass⊃c r,←(⎕NEW(⊃c)(1↓c)).Render :ElseIf isInstance⊃c ∘∘∘ ⍝ should not happen! (I think) :Else r,←(⎕NEW #.HtmlElement(''c)).Render :EndIf content←1↓content :Else r,←renderContent c content←1↓content :EndSelect :EndWhile ∇ ∇ r←selector Replace content :Access public r←⊂('replace'selector)('data'(renderContent content)) ∇ ∇ r←selector Append content :Access public r←⊂('append'selector)('data'(renderContent content)) ∇ ∇ r←selector Prepend content :Access public r←⊂('prepend'selector)('data'(renderContent content)) ∇ ∇ r←Execute content :Access public r←⊂('execute'content) ∇ ∇ r←name Assign data :Access public r←⊂('assign'name)('data'data) ∇ :endsection :section Position ∇ ref Position args;inds;mask;parameters;my;at;of;collision;within;q :Access public shared ⍝ ref - a reference to an instance of anything based on HtmlElement ⍝ args - position information per jQueryUI's Position widget http://api.jqueryui.com/position/ ⍝ can be in any of the following forms ⍝ 1) positional (my at of collision within) N.B. we don't use the "using" parameter ⍝ example: myDiv Position 'left top' 'right bottom' '#otherElement' ⍝ positions myDiv's top left corner at the bottom right corner of the element with id "otherElement" ⍝ 2) paired ⍝ myDiv Position 'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ myDiv Position ('my' 'left top') ('at' 'right bottom') ('of' '#otherElement') ⍝ myDiv Position 3 2⍴'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ Note: positional arguments are in form horizontal (left center right) vertical (top center bottom) parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} :If isInstance ref :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf parameters(ref{⍺⍺⍎'Position.',⍺,'←',q ⍵})¨args ref.Uses,←⊂'JQueryUI' ref.Use :EndIf ∇ :endsection :section Event Handling Support ∇ r←isPost :Access public r←{0::0 ⋄ _Request.isPost}⍬ ∇ ∇ r←isAPLJax :Access public r←{0::0 ⋄ _Request.isAPLJAX}⍬ ∇ ∇ r←sel Css args ⍝ JQuery css cover :Access public r←(sel #._JSS.JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover :Access public r←(sel #._JSS.JQuery'val')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover :Access public r←(sel #._JSS.JQuery'attr')args ∇ ∇ r←sel RemoveAttr args ⍝ JQuery removeAttr cover :Access public r←(sel #._JSS.JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover :Access public r←(sel #._JSS.JQuery'html')args ∇ :endsection :EndClass
:Class MiPage : #.HtmlPage ⍝∇:require =\HtmlPage.dyalog ⍝∇:require =\JSON.dyalog :Field Public _PageName←'' ⍝ Page file name :Field Public _PageDate←'' ⍝ Page saved date :field Public _Request ⍝ HTTPRequest :field Public _Scripts←'' :field Public _Styles←'' :field Public _CssReset←'' ⍝ location of CSS Reset file (if any) :field Public _CssOverride←'' ⍝ location of CSS Override file (if any) :field Public _Serialized←1 ⍝ serialized forms to return in _PageData :field Public _event ⍝ set by APLJAX callback - event that was triggered :field Public _what ⍝ set by APLJAX callback - name or id of the triggering element :field Public _value ⍝ set by APLJAX callback - value of the triggering element :field Public _selector ⍝ set by APLJAX callback - CSS/jQuery selector for the element that triggered the event :field Public _callback ⍝ set by APLJAX callback - name of the callback function :field Public _target ⍝ set by APLJAX callback - id of the target element :field Public _currentTarget ⍝ set by APLJAX callback - id of the currentTarget element :field Public _PageData ⍝ namespace containing any data passed via forms or URL :field Public _AjaxResponse←'' :field Public _DebugCallbacks←0 :field Public _TimedOut←0 :field Public OnLoad←'' ⍝ page equivalent to ⎕LX :field Public Charset←'UTF-8' ⍝ default charset _used←'' ⍝ keep track of what's been used ∇ Make :Access public :Implements constructor :Base MakeCommon ∇ ∇ Make1 req :Access public _Request←req :Implements constructor :base MakeCommon ∇ ∇ MakeCommon _PageData←⎕NS'' ∇ ∇ {r}←Render;b;styles :Access public Head.Insert #._html.meta''('charset=',⍕Charset) :If ''≢OnLoad Use'JQuery' :EndIf b←RenderBody styles←∪_Styles styles←styles,⍨{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssReset styles←styles,{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssOverride :If ~0∊⍴styles {Insert #._DC.StyleSheet ⍵}¨⌽∪styles :EndIf :If ~0∊⍴_Scripts {(Insert _html.script).Set('src=',⍵)}¨⌽∪_Scripts :EndIf :If ~0∊⍴Handlers b,←∊Handlers.Render :EndIf :If ''≢OnLoad b,←(⎕NEW #._html.script('$(function(){',OnLoad,'});')).Render :EndIf r←RenderPage b :If 0≠⎕NC⊂'_Request.Response' _Request.Response.HTML←r :EndIf ∇ ∇ {r}←Wrap :Access public r←Render ∇ ∇ Use resources;n;ind;t;x;server :Access public resources←eis resources :For x :In resources :If ~(⊂x)∊_used :Select ⊃x :Case '⍎' ⍝ script _Scripts,←⊂1↓x :Case '⍕' ⍝ style sheet _Styles,←⊂1↓x :Else :If 0≠⎕NC'_Request.Server' server←_Request.Server :ElseIf 0≠⎕NC'#.Boot.ms' server←#.Boot.ms :EndIf :If 0≠server.⎕NC⊂'Config.Resources' :AndIf ~0∊n←1↑⍴server.Config.Resources :If n≥ind←server.Config.Resources[;1]⍳⊂x :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 2)⊃server.Config.Resources _Scripts,⍨←t :EndIf :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 3)⊃server.Config.Resources _Styles,⍨←t :EndIf :Else 1 server.Log _PageName,' references unknown resource: ',x :EndIf :EndIf :EndSelect _used,←⊂x :EndIf :EndFor ∇ ∇ r←{proto}Get names;noproto;char :Access public :If noproto←0=⎕NC'proto' ⋄ proto←'' ⋄ :EndIf names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf ~(_PageData.⎕NC names)∊2 9 r←,proto :Else r←_PageData⍎names :If 2≤≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If noproto≥char←0=2|⎕DR proto :AndIf isString r r←#.JSON.toAPL r :EndIf :If noproto⍱char :If 1≠2|⎕DR r r←,proto :EndIf :EndIf :EndIf ∇ ∇ r←GetNames str :Access public →0⍴⍨0∊⍴r←_PageData.⎕NL-2 9 →0⍴⍨0∊⍴str r←r/⍨r #.Strings.beginsWith¨⊂str ∇ ∇ r←{proto}GetRaw names :Access public proto←{6::⍵ ⋄ proto}'' names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf 2≠_PageData.⎕NC names r←,proto :Else r←_PageData⍎names :If 2=≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If ~isChar proto r←{0::⍵ ⋄ 0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ r←{proto}SessionGet names :Access public proto←{6::⍵ ⋄ proto}'' names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘SessionGet¨names :ElseIf 0=_Request.Session.⎕NC names r←proto :Else r←_Request.Session⍎names :If 1<|≡r ⋄ r←∊r ⋄ :EndIf :If ~0 2∊⍨10|⎕DR proto ⍝ if the prototype is numeric :AndIf 0 2∊⍨10|⎕DR r ⍝ and the element is character r←{0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ Close session ⍝ Called when the session ends :Access Public Overridable ∇ :section APLJax ⍝ used for building APLJAX responses ∇ _resetAjax :Access public _AjaxResponse←'' ∇ ∇ r←_id :Access public ⍝ as there seems to be a problem with at least some Syncfusion widgets ⍝ being able to provide the id (or name) of the triggering element, we try to obtain it from _what or _selector r←'' :Trap 0 :If 0∊⍴r←_what :AndIf '#'=⊃_selector r←1↓_selector :EndIf :EndTrap ∇ ∇ r←renderContent content;c :Access public shared r←'' content←eis content :While ~0∊⍴content :Select ≡c←⊃content :Case 0 :If isClass c :Select ⊃⍴content :Case 1 r,←(⎕NEW c).Render :Case 2 r,←(⎕NEW c(2⊃content)).Render :Else r,←(⎕NEW c(1↓content)).Render :EndSelect :ElseIf isInstance c r,←c.Render :Else r,←(⎕NEW #.HtmlElement(''content)).Render :EndIf content←'' :Case 1 :If isClass⊃c r,←(⎕NEW(⊃c)(1↓c)).Render :ElseIf isInstance⊃c ∘∘∘ ⍝ should not happen! (I think) :Else r,←(⎕NEW #.HtmlElement(''c)).Render :EndIf content←1↓content :Else r,←renderContent c content←1↓content :EndSelect :EndWhile ∇ ∇ r←selector Replace content :Access public r←⊂('replace'selector)('data'(renderContent content)) ∇ ∇ r←selector Append content :Access public r←⊂('append'selector)('data'(renderContent content)) ∇ ∇ r←selector Prepend content :Access public r←⊂('prepend'selector)('data'(renderContent content)) ∇ ∇ r←Execute content :Access public r←⊂('execute'content) ∇ ∇ r←name Assign data :Access public r←⊂('assign'name)('data'data) ∇ :endsection :section Position ∇ ref Position args;inds;mask;parameters;my;at;of;collision;within;q :Access public shared ⍝ ref - a reference to an instance of anything based on HtmlElement ⍝ args - position information per jQueryUI's Position widget http://api.jqueryui.com/position/ ⍝ can be in any of the following forms ⍝ 1) positional (my at of collision within) N.B. we don't use the "using" parameter ⍝ example: myDiv Position 'left top' 'right bottom' '#otherElement' ⍝ positions myDiv's top left corner at the bottom right corner of the element with id "otherElement" ⍝ 2) paired ⍝ myDiv Position 'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ myDiv Position ('my' 'left top') ('at' 'right bottom') ('of' '#otherElement') ⍝ myDiv Position 3 2⍴'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ Note: positional arguments are in form horizontal (left center right) vertical (top center bottom) parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} :If isInstance ref :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf parameters(ref{⍺⍺⍎'Position.',⍺,'←',q ⍵})¨args ref.Uses,←⊂'JQueryUI' ref.Use :EndIf ∇ :endsection :section Event Handling Support ∇ r←isPost :Access public r←{0::0 ⋄ _Request.isPost}⍬ ∇ ∇ r←isAPLJax :Access public r←{0::0 ⋄ _Request.isAPLJAX}⍬ ∇ ∇ r←sel Css args ⍝ JQuery css cover :Access public r←(sel #._JSS.JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover :Access public r←(sel #._JSS.JQuery'val')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover :Access public r←(sel #._JSS.JQuery'attr')args ∇ ∇ r←sel RemoveAttr args ⍝ JQuery removeAttr cover :Access public r←(sel #._JSS.JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover :Access public r←(sel #._JSS.JQuery'html')args ∇ :endsection :EndClass
Fix to make sure scripts/css files that the user adds to his page load after any framework scripts
Fix to make sure scripts/css files that the user adds to his page load after any framework scripts
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
dcafb097eefd8c07c8d8a50a5b3af302726c50d7
MS3/Examples/SF/ejTabAdvanced.dyalog
MS3/Examples/SF/ejTabAdvanced.dyalog
:Class ejTabAdvanced : MiPageSample ⍝ Control:: _SF.ejTab ⍝ Description:: Add an advanced tabbed interface ∇ Compose;captions;contents;intro;tab :Access public intro←'Frequently used features include the ability to switch between four orientations ' intro,←'and load content asynchronously from another page.' Add title'_SF.ejTab - Simple Example ' Add h2'_SF.ejTab - Syncfusion Tab Control' Add _html.p intro Add h2'Tabs on the left' captions←'Tab One' 'Another' 'Third Tab' contents←⊂'/Examples/Data/SampleText1.txt' ⍝ First one contents,←'These<br/>are<br/>the<br/>contents<br/>of<br/>the<br/>tab<br/>labelled<br/><br/>'∘,¨1↓captions tab←Add #._SF.ejTab(captions contents) 'headerPosition'tab.Set'left' tab.IsURL←1 0 0 ⍝ Let it know which are URLs ∇ :EndClass
:Class ejTabAdvanced : MiPageSample ⍝ Control:: _SF.ejTab ⍝ Description:: Add an advanced tabbed interface ∇ Compose;captions;contents;intro;tab :Access public intro←'Frequently used features include the ability to switch between four orientations ' intro,←'and load content asynchronously from another page.' Add _.title'_SF.ejTab - Simple Example ' Add _.h2'_SF.ejTab - Syncfusion Tab Control' Add _html.p intro Add _.h2'Tabs on the left' captions←'Tab One' 'Another' 'Third Tab' contents←⊂'/Examples/Data/SampleText1.txt' ⍝ First one contents,←'These<br/>are<br/>the<br/>contents<br/>of<br/>the<br/>tab<br/>labelled<br/><br/>'∘,¨1↓captions tab←Add _.ejTab(captions contents) 'headerPosition'tab.Set'left' tab.IsURL←1 0 0 ⍝ Let it know which are URLs ∇ :EndClass
Update ejTabAdvanced.dyalog
Update ejTabAdvanced.dyalog _ was missing in some Add-statements
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
8959932e709d15239fba175f10123b2776bd2c30
Core/MiPage.dyalog
Core/MiPage.dyalog
:Class MiPage : #.HtmlPage ⍝∇:require =\HtmlPage.dyalog ⍝∇:require =\JSON.dyalog :Field Public _PageName←'' ⍝ Page file name :Field Public _PageDate←'' ⍝ Page saved date :field Public _Request ⍝ HTTPRequest :field Public _Scripts←'' :field Public _Styles←'' :field Public _CssReset←'' ⍝ location of CSS Reset file (if any) :field Public _CssOverride←'' ⍝ location of CSS Override file (if any) :field public _Serialized←1 ⍝ serialized forms to return in _PageData :field Public _event ⍝ set by APLJAX callback - event that was triggered :field Public _what ⍝ set by APLJAX callback - name or id of the triggering element :field Public _value ⍝ set by APLJAX callback - value of the triggering element :field Public _selector ⍝ set by APLJAX callback - CSS/jQuery selector for the element that triggered the event :field Public _callback ⍝ set by APLJAX callback - name of the callback function :field public _PageData :field public _AjaxResponse←'' :field public _DebugCallbacks←0 :field public OnLoad←'' ⍝ page equivalent to ⎕LX _used←'' ⍝ keep track of what's been used ∇ Make :Access public :Implements constructor :Base MakeCommon ∇ ∇ Make1 req :Access public _Request←req :Implements constructor :base MakeCommon ∇ ∇ MakeCommon _PageData←⎕NS'' ∇ ∇ {r}←Render;b;styles :Access public :If ''≢OnLoad Use'JQuery' :EndIf b←RenderBody styles←∪_Styles styles←styles,⍨{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssReset styles←styles,{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssOverride :If ~0∊⍴styles {Insert #._DC.StyleSheet ⍵}¨⌽∪styles :EndIf :If ~0∊⍴_Scripts {(Insert _html.script).Set('src=',⍵)}¨⌽∪_Scripts :EndIf :If ~0∊⍴Handlers b,←∊Handlers.Render :EndIf :If ''≢OnLoad b,←(⎕NEW #._html.script('$(function(){',OnLoad,'});')).Render :EndIf r←RenderPage b :If 0≠⎕NC⊂'_Request.Response' _Request.Response.HTML←r :EndIf ∇ ∇ {r}←Wrap :Access public r←Render ∇ ∇ Use resources;n;ind;t;x :Access public resources←eis resources :For x :In resources :If ~(⊂x)∊_used :Select ⊃x :Case '⍎' ⍝ script _Scripts,←⊂1↓x :Case '⍕' ⍝ style sheet _Styles,←⊂1↓x :Else :If 0≠⎕NC⊂'_Request.Server.Config.Resources' :AndIf ~0∊n←1↑⍴_Request.Server.Config.Resources :If n≥ind←_Request.Server.Config.Resources[;1]⍳⊂x :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 2)⊃_Request.Server.Config.Resources _Scripts,←t :EndIf :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 3)⊃_Request.Server.Config.Resources _Styles,←t :EndIf :Else 1 _Request.Server.Log _PageName,' references unknown resource: ',x :EndIf :EndIf :EndSelect _used,←⊂x :EndIf :EndFor ∇ ∇ r←{proto}Get names :Access public proto←{6::⍵ ⋄ proto}'' names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf ~(_PageData.⎕NC names)∊2 9 r←,proto :Else r←_PageData⍎names :If 2≤≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If isString r r←#.JSON.toAPL r :EndIf :EndIf ∇ ∇ r←GetNames str :Access public →0⍴⍨0∊⍴r←_PageData.⎕NL-2 9 →0⍴⍨0∊⍴str r←r/⍨r #.Strings.beginsWith¨⊂str ∇ ∇ r←{proto}GetRaw names :Access public proto←{6::⍵ ⋄ proto}'' names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf 2≠_PageData.⎕NC names r←,proto :Else r←_PageData⍎names :If 2=≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If ~isChar proto r←{0::⍵ ⋄ 0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ r←{proto}SessionGet names :Access public proto←{6::⍵ ⋄ proto}'' names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘SessionGet¨names :ElseIf 2≠_Request.Session.⎕NC names r←proto :Else r←_Request.Session⍎names :If 1<|≡r ⋄ r←∊r ⋄ :EndIf :If ~0 2∊⍨10|⎕DR proto r←{0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ Close session ⍝ Called when the session ends :Access Public Overridable ∇ :section APLJax ⍝ used for building APLJAX responses ∇ _resetAjax :Access public _AjaxResponse←'' ∇ ∇ r←_id :Access public ⍝ as there seems to be a problem with at least some Syncfusion widgets ⍝ being able to provide the id (or name) of the triggering element, we try to obtain it from _what or _selector r←'' :Trap 0 :If 0∊⍴r←_what :AndIf '#'=⊃_selector r←1↓_selector :EndIf :EndTrap ∇ ∇ r←renderContent content;c r←'' content←eis content :While ~0∊⍴content :Select ≡c←⊃content :Case 0 :If isClass c :Select ⊃⍴content :Case 1 r,←(⎕NEW c).Render :Case 2 r,←(⎕NEW c(2⊃content)).Render :Else r,←(⎕NEW c(1↓content)).Render :EndSelect :ElseIf isInstance c r,←c.Render :Else r,←(⎕NEW #.HtmlElement(''content)).Render :EndIf content←'' :Case 1 :If isClass⊃c r,←(⎕NEW(⊃c)(1↓c)).Render :ElseIf isInstance⊃c ∘∘∘ ⍝ should not happen! (I think) :Else r,←(⎕NEW #.HtmlElement(''c)).Render :EndIf content←1↓content :Else r,←renderContent c content←1↓content :EndSelect :EndWhile ∇ ∇ r←selector Replace content :Access public r←⊂('replace'selector)('data'(renderContent content)) ∇ ∇ r←selector Append content :Access public r←⊂('append'selector)('data'(renderContent content)) ∇ ∇ r←selector Prepend content :Access public r←⊂('prepend'selector)('data'(renderContent content)) ∇ ∇ r←Execute content :Access public r←⊂('execute'content) ∇ ∇ r←name Assign data :Access public r←⊂('assign'name)('data'data) ∇ :endsection :section Position ∇ ref Position args;inds;mask;parameters;my;at;of;collision;within;q :Access public shared ⍝ ref - a reference to an instance of anything based on HtmlElement ⍝ args - position information per jQueryUI's Position widget http://api.jqueryui.com/position/ ⍝ can be in any of the following forms ⍝ 1) positional (my at of collision within) N.B. we don't use the "using" parameter ⍝ example: myDiv Position 'left top' 'right bottom' '#otherElement' ⍝ positions myDiv's top left corner at the bottom right corner of the element with id "otherElement" ⍝ 2) paired ⍝ myDiv Position 'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ myDiv Position ('my' 'left top') ('at' 'right bottom') ('of' '#otherElement') ⍝ myDiv Position 3 2⍴'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ Note: positional arguments are in form horizontal (left center right) vertical (top center bottom) parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} :If isInstance ref :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf parameters(ref{⍺⍺⍎'Position.',⍺,'←',q ⍵})¨args ref.Uses,←⊂'JQueryUI' ref.Use :EndIf ∇ :endsection :section Event Handling Support ∇ r←isPost :Access public r←{0::0 ⋄ _Request.isPost}⍬ ∇ ∇ r←isAPLJax :Access public r←{0::0 ⋄ _Request.isAPLJAX}⍬ ∇ ∇ r←sel Css args ⍝ JQuery css cover :Access public r←(sel #._JSS.JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover :Access public r←(sel #._JSS.JQuery'val')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover :Access public r←(sel #._JSS.JQuery'attr')args ∇ ∇ r←sel RemoveAttr args ⍝ JQuery removeAttr cover :Access public r←(sel #._JSS.JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover :Access public r←(sel #._JSS.JQuery'html')args ∇ :endsection :EndClass
:Class MiPage : #.HtmlPage ⍝∇:require =\HtmlPage.dyalog ⍝∇:require =\JSON.dyalog :Field Public _PageName←'' ⍝ Page file name :Field Public _PageDate←'' ⍝ Page saved date :field Public _Request ⍝ HTTPRequest :field Public _Scripts←'' :field Public _Styles←'' :field Public _CssReset←'' ⍝ location of CSS Reset file (if any) :field Public _CssOverride←'' ⍝ location of CSS Override file (if any) :field public _Serialized←1 ⍝ serialized forms to return in _PageData :field Public _event ⍝ set by APLJAX callback - event that was triggered :field Public _what ⍝ set by APLJAX callback - name or id of the triggering element :field Public _value ⍝ set by APLJAX callback - value of the triggering element :field Public _selector ⍝ set by APLJAX callback - CSS/jQuery selector for the element that triggered the event :field Public _callback ⍝ set by APLJAX callback - name of the callback function :field public _PageData :field public _AjaxResponse←'' :field public _DebugCallbacks←0 :field public OnLoad←'' ⍝ page equivalent to ⎕LX _used←'' ⍝ keep track of what's been used ∇ Make :Access public :Implements constructor :Base MakeCommon ∇ ∇ Make1 req :Access public _Request←req :Implements constructor :base MakeCommon ∇ ∇ MakeCommon _PageData←⎕NS'' ∇ ∇ {r}←Render;b;styles :Access public :If ''≢OnLoad Use'JQuery' :EndIf b←RenderBody styles←∪_Styles styles←styles,⍨{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssReset styles←styles,{0∊⍴⍵:⍵ ⋄ ⊂⍵}_CssOverride :If ~0∊⍴styles {Insert #._DC.StyleSheet ⍵}¨⌽∪styles :EndIf :If ~0∊⍴_Scripts {(Insert _html.script).Set('src=',⍵)}¨⌽∪_Scripts :EndIf :If ~0∊⍴Handlers b,←∊Handlers.Render :EndIf :If ''≢OnLoad b,←(⎕NEW #._html.script('$(function(){',OnLoad,'});')).Render :EndIf r←RenderPage b :If 0≠⎕NC⊂'_Request.Response' _Request.Response.HTML←r :EndIf ∇ ∇ {r}←Wrap :Access public r←Render ∇ ∇ Use resources;n;ind;t;x :Access public resources←eis resources :For x :In resources :If ~(⊂x)∊_used :Select ⊃x :Case '⍎' ⍝ script _Scripts,←⊂1↓x :Case '⍕' ⍝ style sheet _Styles,←⊂1↓x :Else :If 0≠⎕NC⊂'_Request.Server.Config.Resources' :AndIf ~0∊n←1↑⍴_Request.Server.Config.Resources :If n≥ind←_Request.Server.Config.Resources[;1]⍳⊂x :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 2)⊃_Request.Server.Config.Resources _Scripts,←t :EndIf :If ~0∊⍴t←{(~0∘∊∘⍴¨⍵)/⍵}(⊂ind 3)⊃_Request.Server.Config.Resources _Styles,←t :EndIf :Else 1 _Request.Server.Log _PageName,' references unknown resource: ',x :EndIf :EndIf :EndSelect _used,←⊂x :EndIf :EndFor ∇ ∇ r←{proto}Get names :Access public proto←{6::⍵ ⋄ proto}'' names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf ~(_PageData.⎕NC names)∊2 9 r←,proto :Else r←_PageData⍎names :If 2≤≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If isString r r←#.JSON.toAPL r :EndIf :EndIf ∇ ∇ r←GetNames str :Access public →0⍴⍨0∊⍴r←_PageData.⎕NL-2 9 →0⍴⍨0∊⍴str r←r/⍨r #.Strings.beginsWith¨⊂str ∇ ∇ r←{proto}GetRaw names :Access public proto←{6::⍵ ⋄ proto}'' names←eis names names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘Get¨names :ElseIf 2≠_PageData.⎕NC names r←,proto :Else r←_PageData⍎names :If 2=≡r :If 1=⍴,r r←⊃r :EndIf :EndIf :If ~isChar proto r←{0::⍵ ⋄ 0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ r←{proto}SessionGet names :Access public proto←{6::⍵ ⋄ proto}'' names←,⍕names names←#.Strings.deb names :If ' '∊names names←{⎕ML←3 ⋄ ⍵⊂⍨⍵≠' '}names r←proto∘SessionGet¨names ⍝ :ElseIf 2≠_Request.Session.⎕NC names ⍝ MB: edited with Brian in Italy to also return objects (actually: anything) :ElseIf 0=_Request.Session.⎕NC names r←proto :Else r←_Request.Session⍎names :If 1<|≡r ⋄ r←∊r ⋄ :EndIf :If ~0 2∊⍨10|⎕DR proto r←{0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w}r :EndIf :EndIf ∇ ∇ Close session ⍝ Called when the session ends :Access Public Overridable ∇ :section APLJax ⍝ used for building APLJAX responses ∇ _resetAjax :Access public _AjaxResponse←'' ∇ ∇ r←_id :Access public ⍝ as there seems to be a problem with at least some Syncfusion widgets ⍝ being able to provide the id (or name) of the triggering element, we try to obtain it from _what or _selector r←'' :Trap 0 :If 0∊⍴r←_what :AndIf '#'=⊃_selector r←1↓_selector :EndIf :EndTrap ∇ ∇ r←renderContent content;c r←'' content←eis content :While ~0∊⍴content :Select ≡c←⊃content :Case 0 :If isClass c :Select ⊃⍴content :Case 1 r,←(⎕NEW c).Render :Case 2 r,←(⎕NEW c(2⊃content)).Render :Else r,←(⎕NEW c(1↓content)).Render :EndSelect :ElseIf isInstance c r,←c.Render :Else r,←(⎕NEW #.HtmlElement(''content)).Render :EndIf content←'' :Case 1 :If isClass⊃c r,←(⎕NEW(⊃c)(1↓c)).Render :ElseIf isInstance⊃c ∘∘∘ ⍝ should not happen! (I think) :Else r,←(⎕NEW #.HtmlElement(''c)).Render :EndIf content←1↓content :Else r,←renderContent c content←1↓content :EndSelect :EndWhile ∇ ∇ r←selector Replace content :Access public r←⊂('replace'selector)('data'(renderContent content)) ∇ ∇ r←selector Append content :Access public r←⊂('append'selector)('data'(renderContent content)) ∇ ∇ r←selector Prepend content :Access public r←⊂('prepend'selector)('data'(renderContent content)) ∇ ∇ r←Execute content :Access public r←⊂('execute'content) ∇ ∇ r←name Assign data :Access public r←⊂('assign'name)('data'data) ∇ :endsection :section Position ∇ ref Position args;inds;mask;parameters;my;at;of;collision;within;q :Access public shared ⍝ ref - a reference to an instance of anything based on HtmlElement ⍝ args - position information per jQueryUI's Position widget http://api.jqueryui.com/position/ ⍝ can be in any of the following forms ⍝ 1) positional (my at of collision within) N.B. we don't use the "using" parameter ⍝ example: myDiv Position 'left top' 'right bottom' '#otherElement' ⍝ positions myDiv's top left corner at the bottom right corner of the element with id "otherElement" ⍝ 2) paired ⍝ myDiv Position 'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ myDiv Position ('my' 'left top') ('at' 'right bottom') ('of' '#otherElement') ⍝ myDiv Position 3 2⍴'my' 'left top' 'at' 'right bottom' 'of' '#otherElement' ⍝ Note: positional arguments are in form horizontal (left center right) vertical (top center bottom) parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} :If isInstance ref :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf parameters(ref{⍺⍺⍎'Position.',⍺,'←',q ⍵})¨args ref.Uses,←⊂'JQueryUI' ref.Use :EndIf ∇ :endsection :section Event Handling Support ∇ r←isPost :Access public r←{0::0 ⋄ _Request.isPost}⍬ ∇ ∇ r←isAPLJax :Access public r←{0::0 ⋄ _Request.isAPLJAX}⍬ ∇ ∇ r←sel Css args ⍝ JQuery css cover :Access public r←(sel #._JSS.JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover :Access public r←(sel #._JSS.JQuery'val')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover :Access public r←(sel #._JSS.JQuery'attr')args ∇ ∇ r←sel RemoveAttr args ⍝ JQuery removeAttr cover :Access public r←(sel #._JSS.JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover :Access public r←(sel #._JSS.JQuery'html')args ∇ :endsection :EndClass
Update MiPage.dyalog
Update MiPage.dyalog Edited SessionGet to return any valid object stored in the Session.
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
afaf7997539c9cf7f2972d73b091a2e35a6a85fa
MS3/index.dyalog
MS3/index.dyalog
:Class index : MiPageTemplate ∇ Compose;left;mid;right;sp;vp :Access public Use'ejTab' ⍝ May get added by callbacks newdiv←{⍵ New _.div} ⍝ Make a div textspan←{'.textspan'New _.span ⍵} ⍝ And a span horz←{⍺←⊣ ⋄ r⊣(r←⍺ New _.StackPanel ⍵).Horizontal←1} ⍝ Horizontal StackPanel Add _.StyleSheet'/Styles/homepage.css' (left mid right)←newdiv¨'leftBar' 'midBar' 'rightBar' sp←'mainSP'horz left mid right sp.Items[1 3].style←⊂'width: 150px; max-height: 300px;' sp.Items[2].style←⊂'margin: 5px;' sp.style←'height: 250px; width: 100%;' vp←Add _.StackPanel sp(newdiv'divSampleTab') vp.style←'width:100%' PopulateLeft left PopulateMid mid PopulateRight right ∇ ∇ PopulateLeft thediv;class;depths;group;items;names;ref;samples;tv;vp ⍝ Populate the Left Bar names←{0::⍬ ⋄ ¯7↓¨6⊃#.Files.DirX #.Boot.AppRoot,⍵}'/Examples/Apps/*.dyalog' items←(1,(⍴names)⍴2),(⍪(⊂'Apps'),names),⊂'Apps' :For (group ref) :In ('Base HTML'_html)('Wrapped HTML'_HTML)('Dyalog Controls'_DC)('JQueryUI'_JQ)('SyncFusion'_SF) names←{({#.HtmlElement=⊃⊃⌽⎕CLASS ⍵}¨⍵)/⍵}ref.(⍎¨⎕NL ¯9.4) class←2↓⍕ref ⍝ Remove leading #. names←(3+⍴class)↓¨⍕¨names ⍝ samples←class FindSamples names names←(⊂group),⊃,/(⊂¨names),¨samples depths←1,∊2,⍪(⍴¨samples)⍴¨3 items⍪←depths,(⍪names),(⊂class) :EndFor thediv.Add textspan'Samples' tv←thediv.Add _.ejTreeView(0 ¯1↓Samples←items) tv.style←'max-height: 300px' tv.On'nodeSelect' 'onSelectSample'('node' 'eval' 'argument.id') ∇ ∇ r←space FindSamples names;folder;i;samples;suffix space,←(space≡'_HTML')/'plus' ⍝ _HTML is in the HTMLplus folder folder←#.Boot.AppRoot,'Examples/',(1↓space),'/' samples←{0::⍬ ⋄ ¯7↓¨6⊃#.Files.DirX ⍵}folder,'*.dyalog' r←(⍴names)⍴⊂'' :For suffix :In 'Simple' 'Advanced' i←(((-⍴suffix)↑¨samples)∊⊂suffix)/⍳⍴samples i←{(⍵≤⍴names)/⍵}names⍳(-⍴suffix)↓¨samples[i] r[i]←r[i],¨⊂⊂suffix :EndFor ∇ ∇ PopulateRight thediv;pages;ul ⍝ Populate the Right Bar thediv.Add textspan'Documentation' pages←1 2⍴'SyncFusion APIs' 'http://helpjs.syncfusion.com/js/api/ejaccordion' pages⍪←'SyncFusion Demos' 'http://js.syncfusion.com/demos/web/' pages⍪←'JQueryUI' 'https://jqueryui.com/' pages⍪←2 2⍴'HTML' 'http://www.w3schools.com/html/' 'CSS' 'http://www.w3schools.com/css/' pages[;2]←↓pages[;,2],⊂'target=_blank"' ul←thediv.Add _.Ul pages ul.style←'font-size: 10px;' thediv.Add _.br thediv.Add textspan'Resources' pages←1 2⍴'MiServer Forum' 'http://www.dyalog.com/forum/viewforum.php?f=34' pages⍪←'Blog' 'http://www.dyalog.com/blog/category/miserver/' pages⍪←'GitHub Repo' 'https://github.com/Dyalog/MiServer' pages⍪←'dyalog.com' 'http://www.dyalog.com' pages[;2]←↓pages[;,2],⊂'target=_blank"' ul←thediv.Add _.Ul pages ul.style←'font-size: 10px;' ∇ ∇ PopulateMid mid;btns;size mid.Add¨3⍴_.br btns←LinkButton'Download MiServer' '/styles/images/download-zone.png' '/download...' btns,←LinkButton'Read More' '/styles/images/support.png' '/readmore...' mid.Add horz btns ∇ ∇ r←LinkButton(label image link);a;d;size d←newdiv'.linkbutton' size←'height: 32px; width: 32px;' 'src' 'style'(d.Add _.img).Set image size d.Add textspan label r←New _.A d link ∇ ∇ r←onSelectSample;code;control;depth;folder;html;i;iframe;node;p;page;sample;samples;section;simple;source;sp;space;t;tab;text;titles;url :Access Public ⍝ When a sample is selected, call this node←⊃2⊃⎕VFI{((+\⍵='_')⍳2)↓⍵}⊃_PageData.node (control space section)←3↑,Samples[1+node-(⌽node↑Samples[;1])⍳2 1;2 3] (depth sample)←Samples[node;1 2] :If (depth=2)∧3 'Simple'≡Samples[(1↑⍴Samples)⌊node+1;1 3] (depth sample)←3 'Simple' ⍝ Clicked on control which has a Simple Sample :EndIf space,←(space≡'_HTML')/'plus' ⍝ _HTML is in the HTMLplus folder :If (depth=2)∧section≢'Apps' ⍝ Depth 2 outside Apps means no sample r←'#divSampleTab'Replace'' :Else folder←#.Boot.AppRoot url←'Examples/',(1↓space),'/',control,sample,'.dyalog' code←{0::,⊂'[file read failed]' ⋄ #.UnicodeFile.ReadNestedText ⍵}folder,url (code←New _.div(#.HTMLInput.APLToHTMLColour code)).Set'id="codeblock"' iframe←'src' 'width'(New _.iframe).Set('/',url,'?NoWrapper=1')800 sp←New horz code iframe r←'#divSampleTab'Replace sp :EndIf ∇ :EndClass
:Class index : MiPageTemplate ∇ Compose;left;mid;right;sp;vp :Access public Use'ejTab' ⍝ May get added by callbacks newdiv←{⍵ New _.div} ⍝ Make a div textspan←{'.textspan'New _.span ⍵} ⍝ And a span horz←{⍺←⊣ ⋄ r⊣(r←⍺ New _.StackPanel ⍵).Horizontal←1} ⍝ Horizontal StackPanel Add _.StyleSheet'/Styles/homepage.css' (left mid right)←newdiv¨'leftBar' 'midBar' 'rightBar' sp←'mainSP'horz left mid right sp.Items[1 3].style←⊂'width: 150px; max-height: 300px;' sp.Items[2].style←⊂'margin: 5px;' sp.style←'height: 250px; width: 100%;' vp←Add _.StackPanel sp(newdiv'divSampleTab') vp.style←'width:100%' PopulateLeft left PopulateMid mid PopulateRight right ∇ ∇ PopulateLeft thediv;class;depths;group;items;names;ref;samples;tv;vp ⍝ Populate the Left Bar names←{0::⍬ ⋄ ¯7↓¨6⊃#.Files.DirX #.Boot.AppRoot,⍵}'/Examples/Apps/*.dyalog' items←(1,(⍴names)⍴2),(⍪(⊂'Apps'),names),⊂'Apps' :For (group ref) :In ('Base HTML'_html)('Wrapped HTML'_HTML)('Dyalog Controls'_DC)('JQueryUI'_JQ)('SyncFusion'_SF) names←{({#.HtmlElement=⊃⊃⌽⎕CLASS ⍵}¨⍵)/⍵}ref.(⍎¨⎕NL ¯9.4) class←2↓⍕ref ⍝ Remove leading #. names←(3+⍴class)↓¨⍕¨names ⍝ samples←class FindSamples names names←(⊂group),⊃,/(⊂¨names),¨samples depths←1,∊2,⍪(⍴¨samples)⍴¨3 items⍪←depths,(⍪names),(⊂class) :EndFor thediv.Add textspan'Samples' tv←thediv.Add _.ejTreeView(0 ¯1↓Samples←items) tv.style←'max-height: 300px' tv.On'nodeSelect' 'onSelectSample'('node' 'eval' 'argument.id') ∇ ∇ r←space FindSamples names;folder;i;samples;suffix space,←(space≡'_HTML')/'plus' ⍝ _HTML is in the HTMLplus folder folder←#.Boot.AppRoot,'Examples/',(1↓space),'/' samples←{0::⍬ ⋄ ¯7↓¨6⊃#.Files.DirX ⍵}folder,'*.dyalog' r←(⍴names)⍴⊂'' :For suffix :In 'Simple' 'Advanced' i←(((-⍴suffix)↑¨samples)∊⊂suffix)/⍳⍴samples i←{(⍵≤⍴names)/⍵}names⍳(-⍴suffix)↓¨samples[i] r[i]←r[i],¨⊂⊂suffix :EndFor ∇ ∇ PopulateRight thediv;pages;ul ⍝ Populate the Right Bar thediv.Add textspan'Documentation' pages←1 2⍴'SyncFusion APIs' 'http://helpjs.syncfusion.com/js/api/ejaccordion' pages⍪←'SyncFusion Demos' 'http://js.syncfusion.com/demos/web/' pages⍪←'JQueryUI' 'https://jqueryui.com/' pages⍪←2 2⍴'HTML' 'http://www.w3schools.com/html/' 'CSS' 'http://www.w3schools.com/css/' pages[;2]←↓pages[;,2],⊂'target=_blank"' ul←thediv.Add _.Ul pages ul.style←'font-size: 10px;' thediv.Add _.br thediv.Add textspan'Resources' pages←1 2⍴'MiServer Forum' 'http://www.dyalog.com/forum/viewforum.php?f=34' pages⍪←'Blog' 'http://www.dyalog.com/blog/category/miserver/' pages⍪←'GitHub Repo' 'https://github.com/Dyalog/MiServer' pages⍪←'dyalog.com' 'http://www.dyalog.com' pages[;2]←↓pages[;,2],⊂'target=_blank"' ul←thediv.Add _.Ul pages ul.style←'font-size: 10px;' ∇ ∇ PopulateMid mid;btns;size mid.Add¨3⍴_.br btns←LinkButton'Download MiServer' '/styles/images/download-zone.png' '/download...' btns,←LinkButton'Read More' '/styles/images/support.png' '/readmore...' mid.Add horz btns ∇ ∇ r←LinkButton(label image link);a;d;size d←newdiv'.linkbutton' size←'height: 32px; width: 32px;' 'src' 'style'(d.Add _.img).Set image size d.Add textspan label r←New _.A d link ∇ ∇ r←onSelectSample;code;control;depth;folder;html;i;iframe;node;p;page;sample;samples;section;simple;source;sp;space;t;tab;text;titles;url :Access Public ⍝ When a sample is selected, call this node←⊃2⊃⎕VFI{((+\⍵='_')⍳2)↓⍵}⊃_PageData.node (control space section)←3↑,Samples[1+node-(⌽node↑Samples[;1])⍳2 1;2 3] (depth sample)←Samples[node;1 2] :If (depth=2)∧3 'Simple'≡Samples[(⊃⍴Samples)⌊node+1;1 2] (depth sample)←3 'Simple' ⍝ Clicked on control which has a Simple Sample :EndIf space,←(space≡'_HTML')/'plus' ⍝ _HTML is in the HTMLplus folder :If (depth=2)∧section≢'Apps' ⍝ Depth 2 outside Apps means no sample r←'#divSampleTab'Replace'' :Else folder←#.Boot.AppRoot url←'Examples/',(1↓space),'/',control,sample,'.dyalog' code←{0::,⊂'[file read failed]' ⋄ #.UnicodeFile.ReadNestedText ⍵}folder,url (code←New _.div(#.HTMLInput.APLToHTMLColour code)).Set'id="codeblock"' iframe←'src' 'width'(New _.iframe).Set('/',url,'?NoWrapper=1')800 sp←New horz code iframe r←'#divSampleTab'Replace sp :EndIf ∇ :EndClass
Allow click on a control in index page to show Simple sample if it exists.
Allow click on a control in index page to show Simple sample if it exists.
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
ead24874953313e5f434d13fa8aced2f054eac5c
MS3/Examples/DC/EditFieldSimple.dyalog
MS3/Examples/DC/EditFieldSimple.dyalog
:Class EditFieldSimple : MiPageSample ⍝ Control:: _DC.EditField _DC.Button _html.label ⍝ Description:: Collect input and echo it on a button press ∇ Compose;btn;F1;label;name :Access Public F1←'myform'Add _.Form ⍝ Create a form label←('for"name"')F1.Add _.label'Please enter your name' name←'name'F1.Add _.EditField done←'done'F1.Add _.Button'Done' done.On'click' 'CallbackFn' 'result'F1.Add _.div ⍝ a div to contain output, updated by CallbackFn ∇ ∇ r←CallbackFn :Access Public r←'#result'Replace _.p('Hello, ',(Get'name'),'!') ∇ :EndClass
:Class EditFieldSimple : MiPageSample ⍝ Control:: _DC.EditField _DC.Button _html.label ⍝ Description:: Collect input and echo it on a button press ∇ Compose;btn;F1;label;name :Access Public F1←'myform'Add _.Form ⍝ Create a form label←('for="name"')F1.Add _.label'Please enter your name' name←'name'F1.Add _.EditField done←'done'F1.Add _.Button'Done' done.On'click' 'CallbackFn' 'result'F1.Add _.div ⍝ a div to contain output, updated by CallbackFn ∇ ∇ r←CallbackFn :Access Public r←'#result'Replace _.p('Hello, ',(Get'name'),'!') ∇ :EndClass
Add missing '=' in MS3/Examples/DC/EditFieldSample
Add missing '=' in MS3/Examples/DC/EditFieldSample
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
424f6d7fee9a345afd5037d9a89b8080a0b90a00
HTML/_JSS.dyalog
HTML/_JSS.dyalog
:Namespace _JSS ⍝ Javascript Snippets (⎕ML ⎕IO)←1 ⍝ this list will grow over time as usage patterns are discovered eis←{(,∘⊂)⍣((326∊⎕DR ⍵)<2>|≡⍵),⍵} ⍝ Enclose if simple quote←{0∊⍴⍵: '' ⋄ '"',(('"' ⎕R '\\\0')⍕⍵),'"'} ine←{0∊⍴⍺:'' ⋄ ⍵} ⍝ if not empty fmtSelector←{{'this'≡⍵:⍵ ⋄quote ⍵}¯2↓∊{⍵,', '}¨eis ⍵} fmtData←#.JSON.fromAPL ⍝ {{(326=⍵)<0=2|⍵}⎕DR ⍵:quote ⍵ ⋄ ⍕⍵} JAchars←#.JSON.JAchars ∇ r←Alert txt ⍝ popup alert text r←'alert(',(quote txt),');' ∇ ∇ r←CloseWindow ⍝ close the browser window r←'var w=window.open(window.location,''_self''); w.close();' ∇ ∇ r←sel Css args ⍝ JQuery css cover r←(sel JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover r←(sel JQuery'val')args ∇ ∇ r←sel Prop args ⍝ JQuery prop cover r←(sel JQuery'prop')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover r←(sel JQuery'attr')args ∇ ∇ r←sel RemoveClass args r←(sel JQuery'removeClass')args ∇ ∇ r←sel RemoveAttr args r←(sel JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover r←(sel JQuery'html')args ∇ ∇ r←sel Show args r←(sel JQuery'show')args ∇ ∇ r←sel Hide args r←(sel JQuery'hide')args ∇ ∇ r←sel Toggle args r←(sel JQuery'toggle')args ∇ ∇ r←sel Trigger args r←(sel JQuery'trigger')args ∇ ∇ r←Submit sel r←(sel JQuery'submit')'' ∇ ∇ r←sel Position args;Position;inds;parameters;q;mask parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} Position←⎕NS ⍬ :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf mask←⍬∘≢¨args args←mask/args parameters←mask/parameters parameters({⍎'Position.',⍺,'←',q ⍵})¨args :If ~0∊⍴Position.⎕NL-2 r←0 #.JQ.JQueryfn'position'sel Position :EndIf ∇ ∇ r←{eval}JSDate date ⍝ snippet to create a JS date (JavaScript months are 0-11!!!) ⍝ date is in 6↑⎕TS form ⍝ eval is optional Boolean to indicate whether to prepend '⍎' to the snippet (default is 0=do not prepend) ⍝ prepending ⍎ tells MiServer that this is an executable phrase and not simply a string :If 0=⎕NC'eval' ⋄ eval←0 ⋄ :EndIf :If 0 2∊⍨10|⎕DR date ⍝ char? date←'"',date,'"' :Else date←1↓∊','∘,∘⍕¨0 ¯1 0 0 0 0+6↑date :EndIf ⍝ r←(~eval)↓'⍎new Date(',date,')' ⍝ ⍝ 180221, MBaas: ⍎ no longer supported :If eval r←⊂'new Date(',date,')' :Else r←'new Date(',date,')' :EndIf ∇ ∇ r←{varname}JSData data ⍝ return var definition to build a JavaScript object based on data ⍝ varname is the name of the variable ⍝ data is either a matrix of [1;] column names, (1↓) data ⍝ or a vector of namespaces :If 0=⎕NC'varname' ⋄ varname←'' ⋄ :EndIf :If 2=⍴⍴data data←#.JSON.fromTable data :EndIf r←(((~0∊⍴varname)/'var ',varname,' = '),0 0 1 #.JSON.fromAPL data),';' ∇ ∇ r←{val}(sel JQuery fn)args;opt ⍝ construct JavaScript to call a jQuery function - eg val(), html(), css(), prop(), or attr() ⍝ optionally setting a value for ⍝ Get a jQuery parameter: ⍝ ('"#id"' JQuery 'attr') '"data-role"' ⍝ Set a jQuery parameter: ⍝ '"blue"' ('#id' JQuery 'css') 'background-color' ⍝ args←eis args :If 0=⎕NC'val' (opt val)←2↑args,(⍴args)↓''⎕NULL :Else opt←⊃args :EndIf :If val≡⎕NULL r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),',',(fmtData val),');' :EndIf ∇ ∇ r←{val}(fn JQueryOpt sel)opt :If 0=⎕NC'val' r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),',',(fmtData val),');' :EndIf ∇ :Class StorageObject ⍝ !!!Prototype!!! ∇ r←{what}Set(type value);name;w;v :Access public shared ⍝ value may be :Access public shared r←'' :If 9.1=⎕NC⊂'value' ⍝ namespace? :For name :In value.⎕NL-2 r,←formatSet(type name(value⍎name)) :EndFor :Else value←eis value :If 2=⎕NC'what' ⍝ value is list of name value pairs what←eis what :Else (what value)←↓[1]((⌊0.5×⍴value),2)⍴value :EndIf :For (w v) :InEach (what value) r,←formatSet(type w v) :EndFor :EndIf ∇ ∇ r←formatSet(type what value) :Access public shared r←type,'.setItem("',what,'",JSON.stringify(',(#.JSON.fromAPL value),');' ∇ ∇ r←type Remove what;w;ww :Access public shared what←eis what r←'' :For w :In what :If ' '∊w←#.Strings.deb w :For ww :In ' '#.Utils.penclose w r,←type,'.removeItem("',w,'");' :EndFor :Else r,←type,'.removeItem("',w,'");' :EndIf :EndFor ∇ ∇ r←type Get what :Access public shared r←'' r,←'<input type="hidden" name="',w,'" value="',JSON ∇ :endclass :class localStorage : StorageObject ∇ r←{what}Set value :If 0=⎕NC'what' r←⎕BASE.Set('localStorage'value) :Else r←what ⎕BASE.Set('localStorage'value) :EndIf ∇ ∇ r←Remove what :Access public shared r← ∇ ∇ r←{name}Get what :Access public shared ∇ :EndClass :Class sessionStorage ∇ r←{what}Set value :Access public shared ∇ :endclass :class sessionStorage :endclass :EndNamespace
:Namespace _JSS ⍝ Javascript Snippets (⎕ML ⎕IO)←1 ⍝ this list will grow over time as usage patterns are discovered eis←{(,∘⊂)⍣((326∊⎕DR ⍵)<2>|≡⍵),⍵} ⍝ Enclose if simple quote←{0∊⍴⍵: '' ⋄ '"',(('"' ⎕R '\\\0')⍕⍵),'"'} ine←{0∊⍴⍺:'' ⋄ ⍵} ⍝ if not empty fmtSelector←{{'this'≡⍵:⍵ ⋄quote ⍵}¯2↓∊{⍵,', '}¨eis ⍵} fmtData←#.JSON.fromAPL ⍝ {{(326=⍵)<0=2|⍵}⎕DR ⍵:quote ⍵ ⋄ ⍕⍵} JAchars←#.JSON.JAchars ∇ r←Alert txt ⍝ popup alert text r←'alert(',(quote txt),');' ∇ ∇ r←CloseWindow ⍝ close the browser window r←'var w=window.open(window.location,''_self''); w.close();' ∇ ∇ r←sel Css args ⍝ JQuery css cover r←(sel JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover r←(sel JQuery'val')args ∇ ∇ r←sel Prop args ⍝ JQuery prop cover r←(sel JQuery'prop')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover r←(sel JQuery'attr')args ∇ ∇ r←sel RemoveAttr args r←(sel JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover r←(sel JQuery'html')args ∇ ∇ r←sel Show args r←(sel JQuery'show')args ∇ ∇ r←sel Hide args r←(sel JQuery'hide')args ∇ ∇ r←sel Toggle args r←(sel JQuery'toggle')args ∇ ∇ r←sel Trigger args r←(sel JQuery'trigger')args ∇ ∇ r←Submit sel r←(sel JQuery'submit')'' ∇ ∇ r←sel Position args;Position;inds;parameters;q;mask parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} Position←⎕NS ⍬ :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf mask←⍬∘≢¨args args←mask/args parameters←mask/parameters parameters({⍎'Position.',⍺,'←',q ⍵})¨args :If ~0∊⍴Position.⎕NL-2 r←0 #.JQ.JQueryfn'position'sel Position :EndIf ∇ ∇ r←{eval}JSDate date ⍝ snippet to create a JS date (JavaScript months are 0-11!!!) ⍝ date is in 6↑⎕TS form ⍝ eval is optional Boolean to indicate whether to prepend '⍎' to the snippet (default is 0=do not prepend) ⍝ prepending ⍎ tells MiServer that this is an executable phrase and not simply a string :If 0=⎕NC'eval' ⋄ eval←0 ⋄ :EndIf :If 0 2∊⍨10|⎕DR date ⍝ char? date←'"',date,'"' :Else date←1↓∊','∘,∘⍕¨0 ¯1 0 0 0 0+6↑date :EndIf ⍝ r←(~eval)↓'⍎new Date(',date,')' ⍝ ⍝ 180221, MBaas: ⍎ no longer supported :If eval r←⊂'new Date(',date,')' :Else r←'new Date(',date,')' :EndIf ∇ ∇ r←{varname}JSData data ⍝ return var definition to build a JavaScript object based on data ⍝ varname is the name of the variable ⍝ data is either a matrix of [1;] column names, (1↓) data ⍝ or a vector of namespaces :If 0=⎕NC'varname' ⋄ varname←'' ⋄ :EndIf :If 2=⍴⍴data data←#.JSON.fromTable data :EndIf r←(((~0∊⍴varname)/'var ',varname,' = '),0 0 1 #.JSON.fromAPL data),';' ∇ ∇ r←{val}(sel JQuery fn)args;opt ⍝ construct JavaScript to call a jQuery function - eg val(), html(), css(), prop(), or attr() ⍝ optionally setting a value for ⍝ Get a jQuery parameter: ⍝ ('"#id"' JQuery 'attr') '"data-role"' ⍝ Set a jQuery parameter: ⍝ '"blue"' ('#id' JQuery 'css') 'background-color' ⍝ args←eis args :If 0=⎕NC'val' (opt val)←2↑args,(⍴args)↓''⎕NULL :Else opt←⊃args :EndIf :If val≡⎕NULL r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),',',(fmtData val),');' :EndIf ∇ ∇ r←{val}(fn JQueryOpt sel)opt :If 0=⎕NC'val' r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),',',(fmtData val),');' :EndIf ∇ :Class StorageObject ⍝ !!!Prototype!!! ∇ r←{what}Set(type value);name;w;v :Access public shared ⍝ value may be :Access public shared r←'' :If 9.1=⎕NC⊂'value' ⍝ namespace? :For name :In value.⎕NL-2 r,←formatSet(type name(value⍎name)) :EndFor :Else value←eis value :If 2=⎕NC'what' ⍝ value is list of name value pairs what←eis what :Else (what value)←↓[1]((⌊0.5×⍴value),2)⍴value :EndIf :For (w v) :InEach (what value) r,←formatSet(type w v) :EndFor :EndIf ∇ ∇ r←formatSet(type what value) :Access public shared r←type,'.setItem("',what,'",JSON.stringify(',(#.JSON.fromAPL value),');' ∇ ∇ r←type Remove what;w;ww :Access public shared what←eis what r←'' :For w :In what :If ' '∊w←#.Strings.deb w :For ww :In ' '#.Utils.penclose w r,←type,'.removeItem("',w,'");' :EndFor :Else r,←type,'.removeItem("',w,'");' :EndIf :EndFor ∇ ∇ r←type Get what :Access public shared r←'' r,←'<input type="hidden" name="',w,'" value="',JSON ∇ :endclass :class localStorage : StorageObject ∇ r←{what}Set value :If 0=⎕NC'what' r←⎕BASE.Set('localStorage'value) :Else r←what ⎕BASE.Set('localStorage'value) :EndIf ∇ ∇ r←Remove what :Access public shared r← ∇ ∇ r←{name}Get what :Access public shared ∇ :EndClass :Class sessionStorage ∇ r←{what}Set value :Access public shared ∇ :endclass :class sessionStorage :endclass :EndNamespace
Revert "Added _JSS.RemoveClass"
Revert "Added _JSS.RemoveClass" This reverts commit d3e328a8550be6fa274a8778708866417d79d28e.
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
35c1f81dfac1819ecf317610cff4457865494bf0
HTML/_DC/Icon.dyalog
HTML/_DC/Icon.dyalog
:class Icon : #._html.span ⍝ Description:: Dyalog Icon widget ⍝ Constructor:: [spec] ⍝ spec - either a single or pair of string which specify the icon(s) to use ⍝ each consists of a vendor-prefix, dash, icon-name, and optionally space-separated modifiers ⍝ when two strings are used, it represents a "stacked" icon, with second icon overlayed on the first ⍝ "stacked" icons are a feature of FontAwesome icons - using other icons may or may not have the desired visual effect ⍝ ⍝ Public Fields:: ⍝ Spec - either a single or pair of string which specify the icon(s) to use ⍝ each consists of a vendor-prefix, dash, icon-name, and optionally space-separated modifiers ⍝ when two strings are used, it represents a "stacked" icon, with second icon overlayed on the first ⍝ "stacked" icons are a feature of FontAwesome icons - using other icons may or may not have the desired visual effect ⍝ ⍝ Examples:: ⍝ Add _.Icon 'fa-cloud-upload' ⍝ FontAwesome: http://fontawesome.io/icons/ ⍝ Add _.Icon 'md-fingerprint' ⍝ Google Material Design: https://design.google.com/icons/ ⍝ Add _.Icon 'e-delete-column_01' ⍝ Syncfusion Essential JavaScript: http://js.syncfusion.com/demos/web/#!/azure/icon/EJIcons ⍝ '.fa-spin' Add _.Icon 'md-track_changes' ⍝ FontAwesome effects (works on non-FA icons too) ⍝ 'style="color: red;"' Add _.Icon 'e-stop' ⍝ Applying own styling ⍝ Add _.Icon 'fa-square fa-2x' 'fa-terminal fa-inverse' ⍝ Stacking inverse small on large ⍝ Add _.Icon 'fa-camera' 'fa-ban fa-2x' ⍝ Stacking large on small :field public shared readonly ApiLevel←3 :Field public Spec←⍬ :field public shared readonly DocBase←'http://fontawesome.io/examples/' ∇ Make :Access public :Implements constructor ∇ ∇ Make1 args;last :Access public :Implements constructor :If 2|⎕DR last←⊃¯1↑Spec←args Order←last ⋄ Spec←¯1↓args :EndIf ∇ ∇ r←Render;prefix;spec;icon;classes;n :Access public Spec←eis Spec Spec,←eis Content Content←⍬ :If 1=⍴Spec ⍝ Simple icon Spec←{⊃⍣(1<≡⍵)⊢⍵}Spec ⍝ Disclose if nested (eis⍣¯1) :If isInstance Spec Spec←Spec.Spec :EndIf (prefix spec)←Spec SplitOn1st'-' :Select ¯1↓prefix :Case 'fa' ⍝ FontAwesome Use'faIcons' AddClass'fa ',Spec :Case 'md' ⍝ Google Use'mdIcons' (icon classes)←(spec,' ')SplitOn1st' ' AddClass'material-icons ',classes Content←¯1↓icon :CaseList (,'e')'ej' ⍝ Syncfusion Use'ejIcons' AddClass'e-icon e-',spec AddStyle'display: inline-block' ⍝ add this because default Syncfusion is "block" :Else Content←Spec :EndSelect :Else Use'faIcons' AddClass'fa-stack' :For spec :In Spec :If isInstance spec spec.AddClass'fa-stack-1x' Add spec :Else (Add _.Icon spec).AddClass'fa-stack-1x' :EndIf :EndFor :EndIf SetUse r←⎕BASE.Render ∇ SplitOn1st←{(l↑⍺)((l←⍺⍳⍵)↓⍺)} :endclass
:class Icon : #._html.span ⍝ Description:: Dyalog Icon widget ⍝ Constructor:: [spec] ⍝ spec - either a single or pair of string which specify the icon(s) to use ⍝ each consists of a vendor-prefix, dash, icon-name, and optionally space-separated modifiers ⍝ when two strings are used, it represents a "stacked" icon, with second icon overlayed on the first ⍝ "stacked" icons are a feature of FontAwesome icons - using other icons may or may not have the desired visual effect ⍝ ⍝ Public Fields:: ⍝ Spec - either a single or pair of string which specify the icon(s) to use ⍝ each consists of a vendor-prefix, dash, icon-name, and optionally space-separated modifiers ⍝ when two strings are used, it represents a "stacked" icon, with second icon overlayed on the first ⍝ "stacked" icons are a feature of FontAwesome icons - using other icons may or may not have the desired visual effect ⍝ ⍝ Examples:: ⍝ Add _.Icon 'fa-cloud-upload' ⍝ FontAwesome: http://fontawesome.io/icons/ ⍝ Add _.Icon 'md-fingerprint' ⍝ Google Material Design: https://design.google.com/icons/ ⍝ Add _.Icon 'e-delete-column_01' ⍝ Syncfusion Essential JavaScript: http://js.syncfusion.com/demos/web/#!/azure/icon/EJIcons ⍝ '.fa-spin' Add _.Icon 'md-track_changes' ⍝ FontAwesome effects (works on non-FA icons too) ⍝ 'style="color: red;"' Add _.Icon 'e-stop' ⍝ Applying own styling ⍝ Add _.Icon 'fa-square fa-2x' 'fa-terminal fa-inverse' ⍝ Stacking inverse small on large ⍝ Add _.Icon 'fa-camera' 'fa-ban fa-2x' ⍝ Stacking large on small :field public shared readonly ApiLevel←3 :Field public Spec←⍬ :field public shared readonly DocBase←'http://fontawesome.io/examples/' ∇ Make :Access public :Implements constructor ∇ ∇ Make1 args;last :Access public :Implements constructor :If 2|⎕DR last←⊃¯1↑Spec←args Order←last ⋄ Spec←¯1↓args :EndIf ∇ ∇ r←Render;prefix;spec;icon;classes;n;origContent;origSpec;origClass :Access public (origSpec origContent origClass)←Spec Content class Spec←eis Spec Spec,←eis Content Content←⍬ :If 1=⍴Spec ⍝ Simple icon Spec←{⊃⍣(1<≡⍵)⊢⍵}Spec ⍝ Disclose if nested (eis⍣¯1) :If isInstance Spec Spec←Spec.Spec :EndIf (prefix spec)←Spec SplitOn1st'-' :Select ¯1↓prefix :Case 'fa' ⍝ FontAwesome Use'faIcons' AddClass'fa ',Spec :Case 'md' ⍝ Google Use'mdIcons' (icon classes)←(spec,' ')SplitOn1st' ' AddClass'material-icons ',classes Content←¯1↓icon :CaseList (,'e')'ej' ⍝ Syncfusion Use'ejIcons' AddClass'e-icon e-',spec AddStyle'display: inline-block' ⍝ add this because default Syncfusion is "block" :Else Content←Spec :EndSelect :Else Use'faIcons' AddClass'fa-stack' :For spec :In Spec :If isInstance spec spec.AddClass'fa-stack-1x' Add spec :Else (Add _.Icon spec).AddClass'fa-stack-1x' :EndIf :EndFor :EndIf SetUse r←⎕BASE.Render (Spec Content class)←origSpec origContent((1+origClass≡UNDEF)⊃origClass'') ⍝ cannot just "unset" class ∇ SplitOn1st←{(l↑⍺)((l←⍺⍳⍵)↓⍺)} :endclass
reset _.Icon Content, Spec, and class after Render
reset _.Icon Content, Spec, and class after Render
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
6b46a0d74b93fc9ee25c3b50e67b7941b3ee3663
HTML/_DC/InputGrid.dyalog
HTML/_DC/InputGrid.dyalog
:class InputGrid : #._html.table :field public Border←0 :field public Labels←'' :field public Inputs←'' :field public Headings←'' :field public LabelPosition←'left' ⍝ valid values are 'left' 'right' :field public Horizontal←0 ⍝ default is vertical ∇ make :Access public :Implements constructor :base ∇ ∇ make1 args;data;sel :Access public :Implements constructor args←eis args :Select ⊃⍴args :Case 1 :Select ⊃⍴⍴args←⊃args :Case 1 Labels←Values←data :Case 2 (Labels Values)←↓[1]data :EndSelect :Case 2 ⍝ Labels Inputs (Labels Inputs)←args :EndSelect ∇ ∇ html←Render;cells;rows :Access public cells←{⎕NEW #._html.td(⍵)}¨renderIt¨Labels,[1.1]Inputs cells[;1].style←⊂'text-align:right' cells←(⍉⍣Horizontal)cells rows←⎕NEW¨(⊃⍴cells)⍴#._html.tr rows.Add↓cells Content←rows.Render Set'border'(⍕Border) html←⎕BASE.Render ∇ :endclass
:class InputGrid : #._html.table :field public Border←0 :field public Labels←'' :field public Inputs←'' :field public Headings←'' :field public LabelPosition←'left' ⍝ valid values are 'left' 'right' :field public Horizontal←0 ⍝ default is vertical ∇ make :Access public :Implements constructor :base ∇ ∇ make1 args;data;sel :Access public :Implements constructor args←eis args :Select ⊃⍴args :Case 1 :Select ⊃⍴⍴args←⊃args :Case 1 Labels←Values←data :Case 2 (Labels Values)←↓[1]data :EndSelect :Case 2 ⍝ Labels Inputs (Labels Inputs)←args :EndSelect ∇ ∇ html←Render;cells;rows :Access public cells←{⎕NEW #._html.td(⍵)}¨renderIt¨(,Labels),[1.1],Inputs cells[;1].style←⊂'text-align:right' cells←(⍉⍣Horizontal)cells rows←⎕NEW¨(⊃⍴cells)⍴#._html.tr rows.Add↓cells Content←rows.Render Set'border'(⍕Border) html←⎕BASE.Render ∇ :endclass
make sure InputGrid labels and inputs are vector
make sure InputGrid labels and inputs are vector
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
339b57a8bf8864ff13274293bfb6ec71a5e05df8
languages/APL/demo.apl
languages/APL/demo.apl
1 2 3 4 5~1 3 5
10×2 X←8+3 X÷2
revert an accident change to demo.apl
[APL] revert an accident change to demo.apl git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@12645 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
APL
artistic-2.0
youprofit/parrot,FROGGS/parrot,tewk/parrot-select,tkob/parrot,youprofit/parrot,FROGGS/parrot,parrot/parrot,fernandobrito/parrot,tewk/parrot-select,FROGGS/parrot,gagern/parrot,youprofit/parrot,gagern/parrot,youprofit/parrot,fernandobrito/parrot,youprofit/parrot,tkob/parrot,youprofit/parrot,parrot/parrot,fernandobrito/parrot,fernandobrito/parrot,parrot/parrot,FROGGS/parrot,tewk/parrot-select,parrot/parrot,gitster/parrot,tkob/parrot,tewk/parrot-select,tkob/parrot,parrot/parrot,gitster/parrot,youprofit/parrot,FROGGS/parrot,fernandobrito/parrot,gitster/parrot,gitster/parrot,tkob/parrot,fernandobrito/parrot,tkob/parrot,tewk/parrot-select,FROGGS/parrot,tkob/parrot,youprofit/parrot,FROGGS/parrot,gagern/parrot,gagern/parrot,gitster/parrot,gagern/parrot,FROGGS/parrot,tewk/parrot-select,gagern/parrot,fernandobrito/parrot,gitster/parrot,tkob/parrot,tewk/parrot-select,gagern/parrot,gitster/parrot
4a4a435fe7495e604329a041e5f18cb5d93145d4
QA/QA.dyalog
QA/QA.dyalog
:Namespace QA ⍝ MiServer 3 QA suite ∇ Run RenderHTML RenderPages ∇ ∇ result←RenderHTML;nss;ns;class;c;name;res;f;root ⍝ make sure all HTML-generating classes render nss←#.(_html _HTML _JQ _SF) ⍝ add _JQM when it's ready root←#.Boot.MSRoot result←0 6⍴'' 0 0 0 0 0 ⍝ [1] name [2] DocBase? [3] DocDyalog? [3] ApiLevel [4] Renders [5] id=constructor[1] :For ns :In nss :For class :In (ns.⎕NL ¯9)~(⊂'SALT_Data'),'_'ns.⎕NL ¯9 res←0 0 0 0 'N/A' name←⍕c←ns⍎class res[1]←0≠c.⎕NC⊂'DocBase' :If res[2]←0≠f←c.⎕NC⊂'DocDyalog' res[2]×←¯1*#.Files.Exists root,c.DocDyalog :EndIf res[3]←{6::0 ⋄ ⍵.ApiLevel}c res[4]←{0::0 ⋄ 1⊣(⎕NEW ⍵).Render}c :If #._html≢ns res[5]←{0::0 ⋄ 'xyz'≡(⎕NEW ⍵'xyz').id}c :EndIf result⍪←(⊂name),res :EndFor :EndFor result←'Element/Widget' 'DocBase?' 'DocDyalog?' 'ApiLevel' 'Renders?' 'id=args[1]?'⍪result ∇ ∇ r←RenderPages;class r←0 2⍴'' 0 r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMiPageTemplate' r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMiPageSample' r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMS3Page' r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMS2Page' ∇ ∇ r←_Test_Page page;class;z r←'Passed' :Trap 0 class←⎕SE.SALT.Load page z←⎕NEW class z._Request←⎕NEW #.HTTPRequest('' '') z._Request.Server←#.Boot.ms {}⎕XML z.Wrap :Else r←∊⎕DM :EndTrap ∇ :EndNamespace
:Namespace QA ⍝ MiServer 3 QA suite ∇ Run RenderHTML RenderPages ∇ ∇ result←RenderHTML;nss;ns;class;c;name;res;f;root ⍝ make sure all HTML-generating classes render nss←#.(_html _HTML _DC _JQ _SF) ⍝ add _JQM when it's ready root←#.Boot.MSRoot result←0 6⍴'' 0 0 0 0 0 ⍝ [1] name [2] DocBase? [3] DocDyalog? [3] ApiLevel [4] Renders [5] id=constructor[1] :For ns :In nss :For class :In (ns.⎕NL ¯9)~(⊂'SALT_Data'),'_'ns.⎕NL ¯9 res←0 0 0 0 'N/A' name←⍕c←ns⍎class res[1]←0≠c.⎕NC⊂'DocBase' :If res[2]←0≠f←c.⎕NC⊂'DocDyalog' res[2]×←¯1*#.Files.Exists root,c.DocDyalog :EndIf res[3]←{6::0 ⋄ ⍵.ApiLevel}c res[4]←{0::0 ⋄ 1⊣(⎕NEW ⍵).Render}c :If #._html≢ns res[5]←{0::0 ⋄ 'xyz'≡(⎕NEW ⍵'xyz').id}c :EndIf result⍪←(⊂name),res :EndFor :EndFor result←'Element/Widget' 'DocBase?' 'DocDyalog?' 'ApiLevel' 'Renders?' 'id=args[1]?'⍪result ∇ ∇ r←RenderPages;class r←0 2⍴'' 0 r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMiPageTemplate' r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMiPageSample' r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMS3Page' r⍪←{⍵(_Test_Page ⍵)}#.Boot.MSRoot,'QA/TestMS2Page' ∇ ∇ r←_Test_Page page;class;z r←'Passed' :Trap 0 class←⎕SE.SALT.Load page z←⎕NEW class z._Request←⎕NEW #.HTTPRequest('' '') z._Request.Server←#.Boot.ms {}⎕XML z.Wrap :Else r←∊⎕DM :EndTrap ∇ :EndNamespace
Add Insert method to HtmlPage
Add Insert method to HtmlPage
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
f0169a0b061b879b0e2148e26131b87943aa8021
HTML/_DC/FontIconsBase.dyalog
HTML/_DC/FontIconsBase.dyalog
:Class FontIconsBase : #.HtmlElement :field public shared readonly DocBase←'http://fortawesome.github.io/Font-Awesome/icons/' :field public Family←'fa' ⍝ bt=Blacktie or other prefixes for FontIcons :field public Container←'i' :field public icon←'' :field public StackSize←'1x' ⍝ only relevant for the outer tag in stacks! :field private Args←'' :field private Stack←⍳0 ∇ Make0 ⍝ empty constructor mostly used for stacks, but possibly for "normal" icons as well (assign icon after construction!) :Access public :Implements Constructor ∇ ∇ Make1 args :Access Public ⍝ args is the name of the icon (w/o prefix) and possibly other specs ⍝ (such as 2x - again, w/o prefix, space-separated, ie "camera 2x"!) icon←args Args←args :Implements Constructor :Base args ∇ ∇ Make2(cnt atts) :Access public Args←cnt atts icon←cnt :Implements Constructor :Base'' ('' atts) Content←'' ⍝ setting Content to '' shouldn't be neccessary, but without it, we're getting wrong results as seen below: ⍝ d←⎕new MiPage ⍝ d.Add _.FontAwesome 'camera' '#bla' ⍝ +d.Render ⍝<!DOCTYPE html><html><head></head> ⍝<body><i id="bla" class="fa fa-camera">#bla</i> ⍝ ↑↑↑↑ somehow the id made it into the Content! ⍝</body> ⍝</html> ∇ ∇ {r}←stack arg :Access public r←New FontIconsBase arg r.Family←Family Stack,←r ∇ ∇ ul items;item;ulCnt;Cnt;atts;iTag :Access public ⍝ pairs is a nested vector of class/text, ⍝ i.e. (('check-square' 'List icons')('check-square' 'can be used')...) ⍝ it is also possibly to add attributes after the 1st two elems to assign an id or style to the li ⍝ (to add attributes to the inner i-Attribute, nest the 2nd element!) ⍝ And when you need to assign id to the content, you'll have to embed it into a span yourself: ⍝ ('check-square' '<span id="foo">List Icons</span>') ⍝ (NB: it would also be possible to override the class which will ruin the purpose, ⍝ but I wasn't sure whether we should take care to avoid that by eliminating '.'-elems ⍝ or if it wouldn't be better (and easier) to just create the mess the user asked for ;-)) ⍝ For discussion: only collect the items here, so that multiple ul-Calls ⍝ are possible to add to a single list (so all the "work" should be done in Render instead) :If 2=≡items ⋄ items←,⊂items ⋄ :EndIf ulCnt←'' ⋄ Content←'' :For item :In items (icon Cnt)←2↑item atts←'' ⋄ :If 1<|≡Cnt ⋄ (Cnt atts)←Cnt ⋄ :EndIf icon←'li ',icon iTag←(New _.i''((⊂'.',setClass 1),eis atts)).Render,Cnt ulCnt,←(New _.li iTag(2↓item)).Render :EndFor icon←'' Content←ulCnt class←'fa-ul' Container←'ul' ∇ ∇ r←Render;icon3;i1;i2;Stack∆ :Access Public ⍝ unfortunately this usage of "Uses" does not work, if has no effect on the header (also see my email from Oct17th) :Select Family :Case 'fa' ⋄ Uses←'FontAwesome' :Case 'bt' ⋄ Uses←'BlackTie' :Else ⍝ when user uses FontIcon-app, he needs to handle "Use" on his own! :EndSelect :If 0<⍴Stack Stack∆←Stack Stack←⍳0 :If 0<⍴icon icon←(RemoveSize icon),' stack',GetSize r←Render ⍝ first elem :Else r←'' :EndIf ⎕←'first=',r :For obj :In Stack∆ obj.icon←(RemoveSize obj.icon),' stack',obj.GetSize r∆←obj.Render r,←r∆ :EndFor icon←'stack ',StackSize ⋄ Container←'span' Content←r :EndIf Tag←Container :If 0<⍴icon ⋄ icon←SetSize ⋄ class←setClass(0=⎕NC'Stack∆') ⋄ :EndIf r←⎕BASE.Render ∇ ∇ r←GetSize ⍝ searches icon for a size-specification :Access public :If 0=⍴r←('-(lg|[12345]x)'⎕S'\1')icon r←'-1x' :EndIf ∇ ∇ res←SetSize ⍝ searches icon for a size-specification :Access public res←icon :If 0=⍴('-(lg|[12345]x)'⎕S'\1')icon ⍝ do not use GetSize here - we're interested to see if it has been set or not res←icon,' 1x' :EndIf ∇ ∇ res←RemoveSize res ⍝ remove Size attribute from element :Access public res←('-(lg|[12345]x)'⎕R'')res ∇ ∇ R←setClass includeFamily R←Family{⎕ML←1 ⋄ (includeFamily/⍺),∊(' ',⍺,'-')∘,¨1↓¨(⍵=' ')⊂⍵}' ',icon ∇ :EndClass
:Class FontIconsBase : #.HtmlElement :field public shared readonly DocBase←'http://fontawesome.io/icons/' :field public Family←'fa' ⍝ bt=Blacktie or other prefixes for FontIcons :field public Resource←'placeholder' :field public Container←'i' :field public icon←'' :field public StackSize←'1x' ⍝ only relevant for the outer tag in stacks! :field private Args←'' :field private Stack←⍳0 ∇ Make0 ⍝ empty constructor mostly used for stacks, but possibly for "normal" icons as well (assign icon after construction!) :Access public :Implements Constructor ∇ ∇ Make1 args :Access Public ⍝ args is the name of the icon (w/o prefix) and possibly other specs ⍝ (such as 2x - again, w/o prefix, space-separated, ie "camera 2x"!) icon←args Args←args :Implements Constructor :Base args ∇ ∇ Make2(cnt atts) :Access public Args←cnt atts icon←cnt :Implements Constructor :Base'' ('' atts) Content←'' ∇ ∇ {r}←stack arg :Access public r←New FontIconsBase arg r.Family←Family Stack,←r ∇ ∇ ul items;item;ulCnt;Cnt;atts;iTag :Access public ⍝ pairs is a nested vector of class/text, ⍝ i.e. (('check-square' 'List icons')('check-square' 'can be used')...) ⍝ it is also possibly to add attributes after the 1st two elems to assign an id or style to the li ⍝ (to add attributes to the inner i-Attribute, nest the 2nd element!) ⍝ And when you need to assign id to the content, you'll have to embed it into a span yourself: ⍝ ('check-square' '<span id="foo">List Icons</span>') ⍝ (NB: it would also be possible to override the class which will ruin the purpose, ⍝ but I wasn't sure whether we should take care to avoid that by eliminating '.'-elems ⍝ or if it wouldn't be better (and easier) to just create the mess the user asked for ;-)) ⍝ For discussion: only collect the items here, so that multiple ul-Calls ⍝ are possible to add to a single list (so all the "work" should be done in Render instead) :If 2=≡items ⋄ items←,⊂items ⋄ :EndIf ulCnt←'' ⋄ Content←'' :For item :In items (icon Cnt)←2↑item atts←'' ⋄ :If 1<|≡Cnt ⋄ (Cnt atts)←Cnt ⋄ :EndIf icon←'li ',icon iTag←(New _.i''((⊂'.',setClass 1),eis atts)).Render,Cnt ulCnt,←(New _.li iTag(2↓item)).Render :EndFor icon←'' Content←ulCnt class←'fa-ul' Container←'ul' ∇ ∇ r←Render;icon3;i1;i2;Stack∆ :Access Public ⍝ Brian: unfortunately this usage of "Uses" does not work, if has no effect on the header (also see my email from Oct17th) Uses←Resource :If 0<⍴Stack Stack∆←Stack Stack←⍳0 :If 0<⍴icon icon←(RemoveSize icon),' stack',GetSize r←Render ⍝ first elem :Else r←'' :EndIf :For obj :In Stack∆ obj.icon←(RemoveSize obj.icon),' stack',obj.GetSize r∆←obj.Render r,←r∆ :EndFor icon←'stack ',StackSize ⋄ Container←'span' Content←r :EndIf Tag←Container :If 0<⍴icon ⋄ icon←SetSize ⋄ class←setClass(0=⎕NC'Stack∆') ⋄ :EndIf r←⎕BASE.Render ∇ ∇ r←GetSize ⍝ searches icon for a size-specification :Access public :If 0=⍴r←('-(lg|[12345]x)'⎕S'\1')icon r←'-1x' :EndIf ∇ ∇ res←SetSize ⍝ searches icon for a size-specification :Access public res←icon :If 0=⍴('-(lg|[12345]x)'⎕S'\1')icon ⍝ do not use GetSize here - we're interested to see if it has been set or not res←icon,' 1x' :EndIf ∇ ∇ res←RemoveSize res ⍝ remove Size attribute from element :Access public res←('-(lg|[12345]x)'⎕R'')res ∇ ∇ R←setClass includeFamily R←Family{⎕ML←1 ⋄ (includeFamily/⍺),∊(' ',⍺,'-')∘,¨1↓¨(⍵=' ')⊂⍵}' ',icon ∇ ∇ {R}←Classname DeriveClass(rsc fmly);cls :Access public shared ⍝ example: 'myfa'DeriveClass'FontAwesome' 'fa' ⍝ Add _.myfa'camera' :If rsc[1]=':' rsc←'⍎https://use.fonticons.com/',(1↓rsc),'.js' :EndIf cls←ScriptFollows ⍝ :Class %Classname : #._DC.FontIconsBase ⍝ :field public readonly family←'%family' ⍝ :field public readonly Resource←'%Resource' ⍝ ∇ make0 ⍝ :access public ⍝ Resource {6::⍺∇1↓⍵ ⋄ (1⊃⍵).Use ⍺}⎕rsi ⍝ find environment where we can execute "Use" ⍝ :implements constructor :base ⍝ ∇ ⍝ ⍝ ∇ make1 arg ⍝ :access public ⍝ Resource {6::⍺∇1↓⍵ ⋄ (1⊃⍵).Use ⍺}⎕rsi ⍝ find environment where we can execute "Use" ⍝ :implements constructor :base arg ⍝ ∇ ⍝ ⍝ ∇ make2 (arg1 arg2) ⍝ :access public ⍝ Resource {6::⍺∇1↓⍵ ⋄ (1⊃⍵).Use ⍺}⎕rsi ⍝ find environment where we can execute "Use" ⍝ :implements constructor :base (arg1 arg2) ⍝ ∇ ⍝ :EndClass cls←(('%Classname'Classname)('%family'fmly)('%Resource'rsc))Subst cls ⍝ Morten: ⎕fix did not like to fix the class as vector with NL - perhaps an extension for the future??? cls←(⎕UCS 13)#.Utils.penclose cls~⎕UCS 10 :If 0=⎕NC'#._' ⋄ '#._'⎕NS'' ⋄ :EndIf ⍝ might not be there yet during boot, when FontAwesome-Class is being set up... R←#._.⎕FIX cls ∇ ⍝ ideally FontAwesome should be made available right after loading this class... ⍝ 'FontAwesome'DeriveClass'FontAwesome' 'fa' :EndClass
Update FontIconsBase.dyalog
Update FontIconsBase.dyalog
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
ccac7cf6cd707966d6154437ac3bfe5499266921
HTML/_JSS.dyalog
HTML/_JSS.dyalog
:Namespace _JSS ⍝ Javascript Snippets (⎕ML ⎕IO)←1 ⍝ this list will grow over time as usage patterns are discovered eis←{(,∘⊂)⍣((326∊⎕DR ⍵)<2>|≡⍵),⍵} ⍝ Enclose if simple enlist←{⎕ML←1 ⋄ ∊⍵} quote←{0∊⍴⍵: '' ⋄ '"',(('"' ⎕R '\\\0')⍕⍵),'"'} ine←{0∊⍴⍺:'' ⋄ ⍵} ⍝ if not empty fmtSelector←{{'this'≡⍵:⍵ ⋄quote ⍵}¯2↓enlist{⍵,', '}¨eis ⍵} fmtData←{{(326=⍵)<0=2|⍵}⎕DR ⍵:quote ⍵ ⋄ ⍕⍵} JAchars←#.JSON.JAchars ∇ r←Alert txt ⍝ popup alert text r←'alert(',(quote txt),');' ∇ ∇ r←CloseWindow ⍝ close the browser window r←'var w=window.open(window.location,''_self''); w.close();' ∇ ∇ r←sel Css args ⍝ JQuery css cover r←(sel JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover r←(sel JQuery'val')args ∇ ∇ r←sel Prop args ⍝ JQuery prop cover r←(sel JQuery'prop')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover r←(sel JQuery'attr')args ∇ ∇ r←sel RemoveAttr args r←(sel JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover r←(sel JQuery'html')args ∇ ∇ r←sel Show args r←(sel JQuery'show')args ∇ ∇ r←sel Hide args r←(sel JQuery'hide')args ∇ ∇ r←sel Toggle args r←(sel JQuery'toggle')args ∇ ∇ r←sel Trigger args r←(sel JQuery'trigger')args ∇ ∇ r←Submit sel r←(sel JQuery'submit')'' ∇ ∇ r←sel Position args;Position;inds;parameters;q;mask parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} Position←⎕NS ⍬ :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf mask←⍬∘≢¨args args←mask/args parameters←mask/parameters parameters({⍎'Position.',⍺,'←',q ⍵})¨args :If ~0∊⍴Position.⎕NL-2 r←0 #.JQ.JQueryfn'position'sel Position :EndIf ∇ ∇ r←{eval}JSDate date ⍝ snippet to create a JS date (JavaScript months are 0-11!!!) ⍝ date is in 6↑⎕TS form ⍝ eval is optional Boolean to indicate whether to prepend '⍎' to the snippet (default is 0=do not prepend) ⍝ prepending ⍎ tells MiServer that this is an executable phrase and not simply a string :If 0=⎕NC'eval' ⋄ eval←0 ⋄ :EndIf :If 0 2∊⍨10|⎕DR date ⍝ char? date←'"',date,'"' :Else date←1↓∊','∘,∘⍕¨0 ¯1 0 0 0 0+6↑date :EndIf r←(~eval)↓'⍎new Date(',date,')' ∇ ∇ r←{varname}JSData data ⍝ return var definition to build a JavaScript object based on data ⍝ varname is the name of the variable ⍝ data is either a matrix of [1;] column names, (1↓) data ⍝ or a vector of namespaces :If 0=⎕NC'varname' ⋄ varname←'' ⋄ :EndIf :If 2=⍴⍴data data←#.JSON.fromTable data :EndIf r←(((~0∊⍴varname)/'var ',varname,' = '),0 0 1 #.JSON.fromAPL data),';' ∇ ∇ r←{val}(sel JQuery fn)args;opt ⍝ construct JavaScript to call a jQuery function - eg val(), html(), css(), prop(), or attr() ⍝ optionally setting a value for ⍝ Get a jQuery parameter: ⍝ ('"#id"' JQuery 'attr') '"data-role"' ⍝ Set a jQuery parameter: ⍝ '"blue"' ('#id' JQuery 'css') 'background-color' ⍝ args←eis args :If 0=⎕NC'val' (opt val)←2↑args,(⍴args)↓''⎕NULL :Else opt←⊃args :EndIf :If val≡⎕NULL r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),',',(fmtData val),');' :EndIf ∇ ∇ r←{val}(fn JQueryOpt sel)opt :If 0=⎕NC'val' r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),',',(fmtData val),');' :EndIf ∇ :Class StorageObject ⍝ !!!Prototype!!! ∇ r←{what}Set(type value);name;w;v :Access public shared ⍝ value may be :Access public shared r←'' :If 9.1=⎕NC⊂'value' ⍝ namespace? :For name :In value.⎕NL-2 r,←formatSet(type name(value⍎name)) :EndFor :Else value←eis value :If 2=⎕NC'what' ⍝ value is list of name value pairs what←eis what :Else (what value)←↓[1]((⌊0.5×⍴value),2)⍴value :EndIf :For (w v) :InEach (what value) r,←formatSet(type w v) :EndFor :EndIf ∇ ∇ r←formatSet(type what value) :Access public shared r←type,'.setItem("',what,'",JSON.stringify(',(#.JSON.fromAPL value),');' ∇ ∇ r←type Remove what;w;ww :Access public shared what←eis what r←'' :For w :In what :If ' '∊w←#.Strings.deb w :For ww :In ' '#.Utils.penclose w r,←type,'.removeItem("',w,'");' :EndFor :Else r,←type,'.removeItem("',w,'");' :EndIf :EndFor ∇ ∇ r←type Get what :Access public shared r←'' r,←'<input type="hidden" name="',w,'" value="',JSON ∇ :endclass :class localStorage : StorageObject ∇ r←{what}Set value :If 0=⎕NC'what' r←⎕BASE.Set('localStorage'value) :Else r←what ⎕BASE.Set('localStorage'value) :EndIf ∇ ∇ r←Remove what :Access public shared r← ∇ ∇ r←{name}Get what :Access public shared ∇ :EndClass :Class sessionStorage ∇ r←{what}Set value :Access public shared ∇ :endclass :class sessionStorage :endclass :EndNamespace
:Namespace _JSS ⍝ Javascript Snippets (⎕ML ⎕IO)←1 ⍝ this list will grow over time as usage patterns are discovered eis←{(,∘⊂)⍣((326∊⎕DR ⍵)<2>|≡⍵),⍵} ⍝ Enclose if simple enlist←{⎕ML←1 ⋄ ∊⍵} quote←{0∊⍴⍵: '' ⋄ '"',(('"' ⎕R '\\\0')⍕⍵),'"'} ine←{0∊⍴⍺:'' ⋄ ⍵} ⍝ if not empty fmtSelector←{{'this'≡⍵:⍵ ⋄quote ⍵}¯2↓enlist{⍵,', '}¨eis ⍵} fmtData←#.JSON.fromAPL ⍝ {{(326=⍵)<0=2|⍵}⎕DR ⍵:quote ⍵ ⋄ ⍕⍵} JAchars←#.JSON.JAchars ∇ r←Alert txt ⍝ popup alert text r←'alert(',(quote txt),');' ∇ ∇ r←CloseWindow ⍝ close the browser window r←'var w=window.open(window.location,''_self''); w.close();' ∇ ∇ r←sel Css args ⍝ JQuery css cover r←(sel JQuery'css')args ∇ ∇ r←sel Val args ⍝ JQuery val cover r←(sel JQuery'val')args ∇ ∇ r←sel Prop args ⍝ JQuery prop cover r←(sel JQuery'prop')args ∇ ∇ r←sel Attr args ⍝ JQuery attr cover r←(sel JQuery'attr')args ∇ ∇ r←sel RemoveAttr args r←(sel JQuery'removeAttr')args ∇ ∇ r←sel Html args ⍝ JQuery html cover r←(sel JQuery'html')args ∇ ∇ r←sel Show args r←(sel JQuery'show')args ∇ ∇ r←sel Hide args r←(sel JQuery'hide')args ∇ ∇ r←sel Toggle args r←(sel JQuery'toggle')args ∇ ∇ r←sel Trigger args r←(sel JQuery'trigger')args ∇ ∇ r←Submit sel r←(sel JQuery'submit')'' ∇ ∇ r←sel Position args;Position;inds;parameters;q;mask parameters←'my' 'at' 'of' 'collision' 'within' q←{1⌽'''''',{⍵/⍨1+''''=⍵}⍕⍵} Position←⎕NS ⍬ :If 2=⍴⍴args ⍝ matrix args←,args :ElseIf 3=≡args args←⊃,/args :EndIf args←eis args inds←parameters⍳args :If ∨/mask←inds≤⍴parameters :If mask≡(2×+/mask)⍴1 0 parameters←mask/args args←(1⌽mask)/args :EndIf :Else parameters←(⍴args)↑parameters :EndIf mask←⍬∘≢¨args args←mask/args parameters←mask/parameters parameters({⍎'Position.',⍺,'←',q ⍵})¨args :If ~0∊⍴Position.⎕NL-2 r←0 #.JQ.JQueryfn'position'sel Position :EndIf ∇ ∇ r←{eval}JSDate date ⍝ snippet to create a JS date (JavaScript months are 0-11!!!) ⍝ date is in 6↑⎕TS form ⍝ eval is optional Boolean to indicate whether to prepend '⍎' to the snippet (default is 0=do not prepend) ⍝ prepending ⍎ tells MiServer that this is an executable phrase and not simply a string :If 0=⎕NC'eval' ⋄ eval←0 ⋄ :EndIf :If 0 2∊⍨10|⎕DR date ⍝ char? date←'"',date,'"' :Else date←1↓∊','∘,∘⍕¨0 ¯1 0 0 0 0+6↑date :EndIf r←(~eval)↓'⍎new Date(',date,')' ∇ ∇ r←{varname}JSData data ⍝ return var definition to build a JavaScript object based on data ⍝ varname is the name of the variable ⍝ data is either a matrix of [1;] column names, (1↓) data ⍝ or a vector of namespaces :If 0=⎕NC'varname' ⋄ varname←'' ⋄ :EndIf :If 2=⍴⍴data data←#.JSON.fromTable data :EndIf r←(((~0∊⍴varname)/'var ',varname,' = '),0 0 1 #.JSON.fromAPL data),';' ∇ ∇ r←{val}(sel JQuery fn)args;opt ⍝ construct JavaScript to call a jQuery function - eg val(), html(), css(), prop(), or attr() ⍝ optionally setting a value for ⍝ Get a jQuery parameter: ⍝ ('"#id"' JQuery 'attr') '"data-role"' ⍝ Set a jQuery parameter: ⍝ '"blue"' ('#id' JQuery 'css') 'background-color' ⍝ args←eis args :If 0=⎕NC'val' (opt val)←2↑args,(⍴args)↓''⎕NULL :Else opt←⊃args :EndIf :If val≡⎕NULL r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'(',(quote opt),',',(fmtData val),');' :EndIf ∇ ∇ r←{val}(fn JQueryOpt sel)opt :If 0=⎕NC'val' r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),');' :Else r←'$(',(fmtSelector sel),').',fn,'("option",',(quote opt),',',(fmtData val),');' :EndIf ∇ :Class StorageObject ⍝ !!!Prototype!!! ∇ r←{what}Set(type value);name;w;v :Access public shared ⍝ value may be :Access public shared r←'' :If 9.1=⎕NC⊂'value' ⍝ namespace? :For name :In value.⎕NL-2 r,←formatSet(type name(value⍎name)) :EndFor :Else value←eis value :If 2=⎕NC'what' ⍝ value is list of name value pairs what←eis what :Else (what value)←↓[1]((⌊0.5×⍴value),2)⍴value :EndIf :For (w v) :InEach (what value) r,←formatSet(type w v) :EndFor :EndIf ∇ ∇ r←formatSet(type what value) :Access public shared r←type,'.setItem("',what,'",JSON.stringify(',(#.JSON.fromAPL value),');' ∇ ∇ r←type Remove what;w;ww :Access public shared what←eis what r←'' :For w :In what :If ' '∊w←#.Strings.deb w :For ww :In ' '#.Utils.penclose w r,←type,'.removeItem("',w,'");' :EndFor :Else r,←type,'.removeItem("',w,'");' :EndIf :EndFor ∇ ∇ r←type Get what :Access public shared r←'' r,←'<input type="hidden" name="',w,'" value="',JSON ∇ :endclass :class localStorage : StorageObject ∇ r←{what}Set value :If 0=⎕NC'what' r←⎕BASE.Set('localStorage'value) :Else r←what ⎕BASE.Set('localStorage'value) :EndIf ∇ ∇ r←Remove what :Access public shared r← ∇ ∇ r←{name}Get what :Access public shared ∇ :EndClass :Class sessionStorage ∇ r←{what}Set value :Access public shared ∇ :endclass :class sessionStorage :endclass :EndNamespace
use JSON.fromAPL to format data
use JSON.fromAPL to format data
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
fc758245af385dc48ace85f6a16369958ee7f8ae
Utils/dates.dyalog
Utils/dates.dyalog
:Namespace Dates (⎕ML ⎕IO)←1 ∇ r←CookieFmt date;day;date;mon ⍝ Format date for cookie expiry ⍝ "expires Mon, 09-Dec-2002 13:46:00 GMT" day←(7 3⍴'MonTueWedThuFriSatSun')[WeekDay date;] mon←(12 3⍴'janfebmaraprmayjunjulaugsepoctnovdec')[2⊃date;] r←,('<',day,', >,ZI2,<-',mon,'->,ZI4,< >,ZI2,<:>,ZI2,<:>,ZI2,< GMT>')⎕FMT 1 5⍴(6↑date)[3 1 4 5 6] ∇ ∇ SetUtcOffset;ver;⎕USING :If 0=⎕NC'_UtcOffset' :If 'Win'≡ver←3↑1⊃'.'⎕WG'APLVersion' :Hold '_UtcOffset' ⎕USING←,⊂'' _UtcOffset←¯60×(System.TimeZone.CurrentTimeZone.GetUtcOffset ⎕NEW System.DateTime(⎕TS)).Hours :EndHold :Else :If (⊂ver)∊'Lin' 'AIX' 'Sol' 'Mac' _UtcOffset←¯60×⍎¯2↓{⍵↑⍨-' '⍳⍨⌽⍵}⊃⎕SH'date -R' :Else _UtcOffset←0 ⍝ otherwise, assume GMT :EndIf :EndIf :EndIf ∇ ∇ r←{minOffset}HTTPDate ts;sign;day;mon;ver;⎕USING;t ⍝ return RCF 1123/822 compliant date ⍝ minOffset is option number of minutes to offset time with (used for HTTP caching expirations) minOffset←{0::0 ⋄ minOffset}'' ts←6↑ts SetUtcOffset ts←IDNToDate((_UtcOffset+minOffset)÷24×60)+t←DateToIDN ts day←(7 3⍴'MonTueWedThuFriSatSun')[1+7|(⌊t)-1;] mon←(12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec')[2⊃ts;] r←,('<',day,', >,ZI2,< ',mon,' >,ZI4,< >,ZI2,<:>,ZI2,<:>,ZI2,< GMT>')⎕FMT 1 5⍴ts[3 1 4 5 6] ∇ ∇ SM←DateToIDN TS ⍝ Convert date format SM←2 ⎕NQ'.' 'DateToIDN'(3↑TS) :If 3<⍴TS SM+←(24 60 60 1000⊥4↑3↓TS)÷86400000 :EndIf ∇ ∇ TS←IDNToDate SM ⍝ Convert IDN to date format : 3↑⎕TS ← IDN (akd TS_SM) TS←3↑2 ⎕NQ'.' 'IDNToDate'(⌊SM) TS,←⌊0.5+24 60 60 1000⊤86400000×1|SM ∇ ∇ new←ts IdnAdd t ⍝ T is D HH MM SS new←ts+(0 24 60 60 1000⊥¯5↑t,0)÷86400000 ∇ ∇ r←Now r←DateToIDN ⎕TS ∇ ∇ r←TSFmt ts r←,'ZI4,<->,ZI2,<->,ZI2,< >,ZI2,<:>,ZI2,<:>,ZI2'⎕FMT 1 6⍴6↑ts ∇ ∇ r←TSFmtNice ts;now;yday;today;z;i;m;idn;s ⍝ Format a vector of IDN's nicely s←⍴ts yday←¯1+today←⌊now←DateToIDN ⎕TS r←↑IDNToDate¨,ts←,ts ⍝ Make matrix r←'ZI4,<->,ZI2,<->,ZI2,< >,ZI2,<:>,ZI2'⎕FMT 5↑[2]r :If 0≠⍴i←((ts≥yday)∧~m←ts≥today)/⍳⍴ts r[i;]←r[i;11+⍳5],' ',((⍴i),10)⍴10↑'Yesterday' :EndIf :If 0≠⍴i←m/⍳⍴ts r[i;]←r[i;11+⍳5],' ',((⍴i),10)⍴10↑'Today' :EndIf :If 0≠⍴i←(100>z←⌊(now-ts)×24×60)/⍳⍴ts r[i;]←16↑[2]↑(⍕¨⌊z[i]),¨(' minutes ago' ' minute ago')[1+1=z[i]] :EndIf :If 0≠⍴i←(z<1)/⍳⍴ts r[i;]←((⍴i),16)⍴16↑'Now' :EndIf r←(s,¯1↑⍴r)⍴r ∇ ∇ r←WeekDay Date ⍝ Return weekday (Monday=1, Sunday=7) r←1+7|(DateToIDN 3↑Date)-1 ∇ ∇ r←{opt}DateFormat ymd ⍝ opt - 0 dd MMM yyyy ⍝ 1 dd Month yyyy :If 0=⎕NC'opt' ⋄ opt←0 ⋄ :EndIf :Select ⊃opt :Case 0 r←(⍕ymd[3]),(1⌽' ',3↑(3ׯ1+ymd[2])↓'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'),⍕ymd[1] :Case 1 r←(⍕ymd[3]),(1⌽' ',ymd[2]⊃'January' 'February' 'March' 'April' 'May' 'June' 'July' 'August' 'September' 'October' 'November' 'December'),⍕ymd[1] :Else r←⍕ymd :EndSelect ∇ ∇ r←LogFmtNow;ver ⍝ returns now UTC adjusted, and formatted for log files (Common Log Format) :If 'Win'≡ver←3↑1⊃'.'⎕WG'APLVersion' r←((⍎⎕NA'kernel32|GetSystemTime >{U2 U2 U2 U2 U2 U2 U2 U2}')⊂8⍴0)[4 2 1 5 6 7] r[2]←⊂(12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec')[,2⊃r;] r←,'< [>,ZI2,</>,3A1,</>,ZI4,<:>,ZI2,<:>,ZI2,<:>,ZI2,< +0000] >'⎕FMT r :Else r←1⊃⎕SH'date +" [%d/%b/%Y:%T %z] "' :EndIf ∇ ∇ r←LogFmt ymdhms r←ymdhms[3 2 1 4 5 6] r[2]←⊂(12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec')[,2⊃r;] r←,'< [>,ZI2,</>,3A1,</>,ZI4,<:>,ZI2,<:>,ZI2,<:>,ZI2,< +0000] >'⎕FMT r ∇ ∇ ts←FTT fts;md;shape;tmp;yr;z;⎕IO ⍝ *** convert ⎕FRDCI/⎕FHIST timestamp(s) to ⎕ts-format for Dyalog/W *** ⍝ right argument: ⎕FRDCI-type timestamp(s) of any shape ⍝ result: ⎕ts-type timestamp(s) with shape <(⍴argument),7> ⎕IO←0 ⋄ shape←⍴fts ⋄ ts←,fts+18626112000 md←365.2501|1+1461|yr←⌊ts÷5184000 tmp←31 61 92 122 153 184 214 245 275 306 337 366 z←(,⍉<⍀tmp∘.≥md)/,((⍴md),12)⍴⍳12 md←(1+12|z+2),[0.1]⌈md-(0,tmp)[z] ts←(1960+⌊(yr+60)÷365.25),md,⍉24 60 60 60⊤ts ts[;6]←⌊0.5+ts[;6]×100÷6 ts←(shape,7)⍴ts ∇ ∇ r←TTF ts;l;h;d;m;y ⍝ convert a ⎕TS style timestamp into 60ths of a second since 1st January 1970 a la ⎕FRDCI l←⌈60×ts[7]÷1000 ⍝ convert milliseconds to 60ths h←3600 60 60⊥ts[4 5 6] ⍝ hours minutes seconds to to the nearest seconds total d←ts[3]-1 ⍝ days since start of month m←(2⊃ts)⊃++\0 31,(28+0=4|⊃ts),31 30 31 30 31 31 30 31 30 ⍝ days in completed months y←{{(365×⍵)+⌈4÷⍨⍵-2}⍵-1970}⊃ts ⍝ days in years since 1970, leap years since 1972 r←l+60×h+86400×y+m+d ⍝ sum, convert to seconds, add seconds in the day convert to 60ths, add on 60ths ∇ tonum←{(b v)←⎕vfi ⍵ ⋄ b/v} ∇ dt←ParseDate str;pos;mon;t;ymd ⍝ str is of the genre "Wed Aug 05 2015 07:30:21 GMT-0400 (Eastern Daylight Time)" ⍝ We need to weed out the day of the week and the time str←(+/∧\' '=str)↓str ⍝ remove the leading spaces ⍝ What kind of string is this? :If ~∧/1⊃(dt dt)←{b←~⍵∊'/-:' ⋄ ⎕VFI b\b/⍵}str ⍝ yyyy/mm/dd hh:mm:ss ? :If 0∊⍴t←'Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec'⎕S 0 3⊢str ⍝ look for the month as a string. If not found ymd←3↑tonum str ⍝ grab the 1st 3 numbers found ymd←ymd[⍒(2×31<ymd)+ymd<12] ⍝ put in correct order :Else ⍝ otherwise (if found) (pos mon)←0 1+1⊃t :If ~0∊⍴t←tonum pos↑str ⍝ any number before the month? (e.g. 2 May 2021) ymd←⌽⍣(31<⍬⍴t)⊢(1↑tonum pos↓str),mon,t :Else ymd←¯1⌽mon,2↑tonum pos↓str :EndIf :EndIf ⍝ Now grab the time dt←ymd,tonum⍕'(\d+):(\d+):(\d+)'⎕S'\1 \2 \3'⊢str :EndIf ∇ ∇ ts←ParseISODate str SetUtcOffset ts←IDNToDate(-_UtcOffset÷24×60)+DateToIDN 7↑str{⊃(//)⎕VFI ⍵\⍵/⍺}str∊⎕D ∇ ∇ r←{unit}ParseTime string;chunks;units;factors ⍝ Parse time string into units (default is ms) ⍝ String is a string like '5d4h47m6s266ms' :If 0=⎕NC'unit' ⋄ unit←'ms' ⋄ :EndIf units←(1 1 1 1 1 0⊂'dhmsms'),⊂'' factors←86400000 3600000 60000 1000 1 1 chunks←{⎕ML←3 ⋄ (1+⍵∊⎕D)⊂⍵}string :Trap 0/0 r←(⍎¨{⍵∩⎕D}¨chunks)+.×factors[units⍳{#.Strings.lc ⍵~⎕D}¨chunks] :Else 'Invalid time string'⎕SIGNAL 11 :EndTrap r←r÷factors[units⍳⊂,unit] ∇ :EndNamespace
:Namespace Dates (⎕ML ⎕IO)←1 ∇ r←CookieFmt date;day;date;mon ⍝ Format date for cookie expiry ⍝ "expires Mon, 09-Dec-2002 13:46:00 GMT" day←(7 3⍴'MonTueWedThuFriSatSun')[WeekDay date;] mon←(12 3⍴'janfebmaraprmayjunjulaugsepoctnovdec')[2⊃date;] r←,('<',day,', >,ZI2,<-',mon,'->,ZI4,< >,ZI2,<:>,ZI2,<:>,ZI2,< GMT>')⎕FMT 1 5⍴(6↑date)[3 1 4 5 6] ∇ ∇ SetUtcOffset;ver;⎕USING :If 0=⎕NC'_UtcOffset' :If 'Win'≡ver←3↑1⊃'.'⎕WG'APLVersion' :Hold '_UtcOffset' ⎕USING←,⊂'' _UtcOffset←¯60×(System.TimeZone.CurrentTimeZone.GetUtcOffset ⎕NEW System.DateTime(⎕TS)).Hours :EndHold :Else :If (⊂ver)∊'Lin' 'AIX' 'Sol' 'Mac' _UtcOffset←¯60×.01×⍎⊃⎕SH'date +%z' :Else _UtcOffset←0 ⍝ otherwise, assume GMT :EndIf :EndIf :EndIf ∇ ∇ r←{minOffset}HTTPDate ts;sign;day;mon;ver;⎕USING;t ⍝ return RCF 1123/822 compliant date ⍝ minOffset is option number of minutes to offset time with (used for HTTP caching expirations) minOffset←{0::0 ⋄ minOffset}'' ts←6↑ts SetUtcOffset ts←IDNToDate((_UtcOffset+minOffset)÷24×60)+t←DateToIDN ts day←(7 3⍴'MonTueWedThuFriSatSun')[1+7|(⌊t)-1;] mon←(12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec')[2⊃ts;] r←,('<',day,', >,ZI2,< ',mon,' >,ZI4,< >,ZI2,<:>,ZI2,<:>,ZI2,< GMT>')⎕FMT 1 5⍴ts[3 1 4 5 6] ∇ ∇ SM←DateToIDN TS ⍝ Convert date format SM←2 ⎕NQ'.' 'DateToIDN'(3↑TS) :If 3<⍴TS SM+←(24 60 60 1000⊥4↑3↓TS)÷86400000 :EndIf ∇ ∇ TS←IDNToDate SM ⍝ Convert IDN to date format : 3↑⎕TS ← IDN (akd TS_SM) TS←3↑2 ⎕NQ'.' 'IDNToDate'(⌊SM) TS,←⌊0.5+24 60 60 1000⊤86400000×1|SM ∇ ∇ new←ts IdnAdd t ⍝ T is D HH MM SS new←ts+(0 24 60 60 1000⊥¯5↑t,0)÷86400000 ∇ ∇ r←Now r←DateToIDN ⎕TS ∇ ∇ r←TSFmt ts r←,'ZI4,<->,ZI2,<->,ZI2,< >,ZI2,<:>,ZI2,<:>,ZI2'⎕FMT 1 6⍴6↑ts ∇ ∇ r←TSFmtNice ts;now;yday;today;z;i;m;idn;s ⍝ Format a vector of IDN's nicely s←⍴ts yday←¯1+today←⌊now←DateToIDN ⎕TS r←↑IDNToDate¨,ts←,ts ⍝ Make matrix r←'ZI4,<->,ZI2,<->,ZI2,< >,ZI2,<:>,ZI2'⎕FMT 5↑[2]r :If 0≠⍴i←((ts≥yday)∧~m←ts≥today)/⍳⍴ts r[i;]←r[i;11+⍳5],' ',((⍴i),10)⍴10↑'Yesterday' :EndIf :If 0≠⍴i←m/⍳⍴ts r[i;]←r[i;11+⍳5],' ',((⍴i),10)⍴10↑'Today' :EndIf :If 0≠⍴i←(100>z←⌊(now-ts)×24×60)/⍳⍴ts r[i;]←16↑[2]↑(⍕¨⌊z[i]),¨(' minutes ago' ' minute ago')[1+1=z[i]] :EndIf :If 0≠⍴i←(z<1)/⍳⍴ts r[i;]←((⍴i),16)⍴16↑'Now' :EndIf r←(s,¯1↑⍴r)⍴r ∇ ∇ r←WeekDay Date ⍝ Return weekday (Monday=1, Sunday=7) r←1+7|(DateToIDN 3↑Date)-1 ∇ ∇ r←{opt}DateFormat ymd ⍝ opt - 0 dd MMM yyyy ⍝ 1 dd Month yyyy :If 0=⎕NC'opt' ⋄ opt←0 ⋄ :EndIf :Select ⊃opt :Case 0 r←(⍕ymd[3]),(1⌽' ',3↑(3ׯ1+ymd[2])↓'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'),⍕ymd[1] :Case 1 r←(⍕ymd[3]),(1⌽' ',ymd[2]⊃'January' 'February' 'March' 'April' 'May' 'June' 'July' 'August' 'September' 'October' 'November' 'December'),⍕ymd[1] :Else r←⍕ymd :EndSelect ∇ ∇ r←LogFmtNow;ver ⍝ returns now UTC adjusted, and formatted for log files (Common Log Format) :If 'Win'≡ver←3↑1⊃'.'⎕WG'APLVersion' r←((⍎⎕NA'kernel32|GetSystemTime >{U2 U2 U2 U2 U2 U2 U2 U2}')⊂8⍴0)[4 2 1 5 6 7] r[2]←⊂(12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec')[,2⊃r;] r←,'< [>,ZI2,</>,3A1,</>,ZI4,<:>,ZI2,<:>,ZI2,<:>,ZI2,< +0000] >'⎕FMT r :Else r←1⊃⎕SH'date +" [%d/%b/%Y:%T %z] "' :EndIf ∇ ∇ r←LogFmt ymdhms r←ymdhms[3 2 1 4 5 6] r[2]←⊂(12 3⍴'JanFebMarAprMayJunJulAugSepOctNovDec')[,2⊃r;] r←,'< [>,ZI2,</>,3A1,</>,ZI4,<:>,ZI2,<:>,ZI2,<:>,ZI2,< +0000] >'⎕FMT r ∇ ∇ ts←FTT fts;md;shape;tmp;yr;z;⎕IO ⍝ *** convert ⎕FRDCI/⎕FHIST timestamp(s) to ⎕ts-format for Dyalog/W *** ⍝ right argument: ⎕FRDCI-type timestamp(s) of any shape ⍝ result: ⎕ts-type timestamp(s) with shape <(⍴argument),7> ⎕IO←0 ⋄ shape←⍴fts ⋄ ts←,fts+18626112000 md←365.2501|1+1461|yr←⌊ts÷5184000 tmp←31 61 92 122 153 184 214 245 275 306 337 366 z←(,⍉<⍀tmp∘.≥md)/,((⍴md),12)⍴⍳12 md←(1+12|z+2),[0.1]⌈md-(0,tmp)[z] ts←(1960+⌊(yr+60)÷365.25),md,⍉24 60 60 60⊤ts ts[;6]←⌊0.5+ts[;6]×100÷6 ts←(shape,7)⍴ts ∇ ∇ r←TTF ts;l;h;d;m;y ⍝ convert a ⎕TS style timestamp into 60ths of a second since 1st January 1970 a la ⎕FRDCI l←⌈60×ts[7]÷1000 ⍝ convert milliseconds to 60ths h←3600 60 60⊥ts[4 5 6] ⍝ hours minutes seconds to to the nearest seconds total d←ts[3]-1 ⍝ days since start of month m←(2⊃ts)⊃++\0 31,(28+0=4|⊃ts),31 30 31 30 31 31 30 31 30 ⍝ days in completed months y←{{(365×⍵)+⌈4÷⍨⍵-2}⍵-1970}⊃ts ⍝ days in years since 1970, leap years since 1972 r←l+60×h+86400×y+m+d ⍝ sum, convert to seconds, add seconds in the day convert to 60ths, add on 60ths ∇ tonum←{(b v)←⎕vfi ⍵ ⋄ b/v} ∇ dt←ParseDate str;pos;mon;t;ymd ⍝ str is of the genre "Wed Aug 05 2015 07:30:21 GMT-0400 (Eastern Daylight Time)" ⍝ We need to weed out the day of the week and the time str←(+/∧\' '=str)↓str ⍝ remove the leading spaces ⍝ What kind of string is this? :If ~∧/1⊃(dt dt)←{b←~⍵∊'/-:' ⋄ ⎕VFI b\b/⍵}str ⍝ yyyy/mm/dd hh:mm:ss ? :If 0∊⍴t←'Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec'⎕S 0 3⊢str ⍝ look for the month as a string. If not found ymd←3↑tonum str ⍝ grab the 1st 3 numbers found ymd←ymd[⍒(2×31<ymd)+ymd<12] ⍝ put in correct order :Else ⍝ otherwise (if found) (pos mon)←0 1+1⊃t :If ~0∊⍴t←tonum pos↑str ⍝ any number before the month? (e.g. 2 May 2021) ymd←⌽⍣(31<⍬⍴t)⊢(1↑tonum pos↓str),mon,t :Else ymd←¯1⌽mon,2↑tonum pos↓str :EndIf :EndIf ⍝ Now grab the time dt←ymd,tonum⍕'(\d+):(\d+):(\d+)'⎕S'\1 \2 \3'⊢str :EndIf ∇ ∇ ts←ParseISODate str SetUtcOffset ts←IDNToDate(-_UtcOffset÷24×60)+DateToIDN 7↑str{⊃(//)⎕VFI ⍵\⍵/⍺}str∊⎕D ∇ ∇ r←{unit}ParseTime string;chunks;units;factors ⍝ Parse time string into units (default is ms) ⍝ String is a string like '5d4h47m6s266ms' :If 0=⎕NC'unit' ⋄ unit←'ms' ⋄ :EndIf units←(1 1 1 1 1 0⊂'dhmsms'),⊂'' factors←86400000 3600000 60000 1000 1 1 chunks←{⎕ML←3 ⋄ (1+⍵∊⎕D)⊂⍵}string :Trap 0/0 r←(⍎¨{⍵∩⎕D}¨chunks)+.×factors[units⍳{#.Strings.lc ⍵~⎕D}¨chunks] :Else 'Invalid time string'⎕SIGNAL 11 :EndTrap r←r÷factors[units⍳⊂,unit] ∇ :EndNamespace
Fix to Dates.SetUTCOffset for Mac
Fix to Dates.SetUTCOffset for Mac
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
fad9898a06929bf7e9b1a79679656280708db1fa
Utils/HtmlUtils.dyalog
Utils/HtmlUtils.dyalog
:Namespace HtmlUtils (⎕IO ⎕ML)←1 ⎕FX 'r←CRLF' 'r←⎕UCS 13 10' ⍝ So it will be :Included enlist←{⎕ML←1 ⋄ ∊⍵} ⍝ APL2 enlist eis←{(,∘⊂)⍣((326∊⎕DR ⍵)<2>|≡⍵),⍵} ⍝ Enclose if simple ine←{0∊⍴⍺:'' ⋄ ⍵} ⍝ if not empty ischar←{0 2∊⍨10|⎕DR⍵} quote←{0∊⍴⍵:'' ⋄ '"',({w←⍵⋄((w='"')/w)←⊂'\"'⋄enlist w}⍵),'"'} iotaz←{(⍴⍺){⍵×⍺≥⍵}⍺⍳⍵} innerhtml←{⊃↓/(⍵ iotaz'>')(-(⌽⍵)iotaz'<') ⍵} dtlb←{⍵{((∨\⍵)∧⌽∨\⌽⍵)/⍺}' '≠⍵} ⍝ tonum←{0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w} ∇ r←atts Enclose innerhtml;i ⍝ Put an HTML tag around some HTML :If 1<|≡innerhtml ⋄ innerhtml←CRLF,enlist innerhtml,¨⊂CRLF ⋄ :EndIf :If 0∊⍴atts r←innerhtml :Else i←¯1+(atts←,atts)⍳' ' r←'<',atts,'>',innerhtml,'</',(i↑atts),'>',CRLF :EndIf ∇ ∇ r←{nl}Tag tag ⍝ Make a self-closing tag nl←{6::1 ⋄ nl}⍬ r←'<',tag,' />',nl/CRLF ∇ FormatAttrs←{ ⍝ format name/value pairs as tag attributes ⍝ ⍵ - name/value pairs, valid forms: ⍝ 'name="value"' ⍝ [n,2⍴] 'name1' 'value1' ['name2' 'value2'...] ⍝ ('name1' 'value1') [('name2' 'value2')] 0∊⍴⍵:'' { enlist{(×⍴⍺)/' ',⍺,(×⍴⍵)/'=',quote ⍵}/,∘⍕¨⊃⍵ }_pifn¨,2 _box _pifn{ 1=|≡⍵:⍵ 2=|≡⍵:{1=⍴⍴⍵:(⌽2,0.5×⍴⍵)⍴⍵ ⋄ ⍵}⍵ ↑⍵}⍵ } ∇ r←tag GetAttr attr;attrs r←'' :Trap 6 →0⍴⍨0∊⍴tag←⎕XML tag :EndTrap attrs←(⊂1 4)⊃tag r←(attrs[;1]⍳⊂attr)⊃attrs[;2],⊂'' ∇ Styles←{ ⍝ format name/value pairs as CSS style attributes ⍝ ⍵ - name/value pairs, valid forms: ⍝ 'name: value' ⍝ [n,2⍴] 'name1' 'value1' ['name2' 'value2'...] ⍝ ('name1' 'value1') [('name2' 'value2')] ⍺←'' 0∊⍴⍵:⍺,'{}' (0∊⍴⍺)↓⍺,{'{',({';'=¯1↑⍵:⍵ ⋄ ⍵,';'}⍵),'}'}{ enlist{(×⍴⍺)/⍺,(×⍴⍵)/':',⍵,';'}/,∘⍕¨⊃⍵ }_pifn¨,2 _box _pifn{ 1=|≡⍵:⍵ 2=|≡⍵:{1=⍴⍴⍵:(⌽2,0.5×⍴⍵)⍴⍵ ⋄ ⍵}⍵ ↑⍵}⍵ } _box←{⍺←1 ⋄ (⊂⍣(⍺=|≡⍵))⍵} _pifn←{({⍵''}⍣(1=|≡⍵))⍵} ∇ r←ScriptFollows;lines;pgm;from ⍝ Treat following commented lines in caller as a script, lines beginning with ⍝⍝ are stripped out :If 0∊⍴lines←(from←⎕IO⊃⎕RSI).⎕NR pgm←2⊃⎕SI lines←↓from.(180⌶)pgm :EndIf r←2↓∊CRLF∘,¨{⍵/⍨'⍝'≠⊃¨⍵}{1↓¨⍵/⍨∧\'⍝'=⊃¨⍵}dtlb¨(1+2⊃⎕LC)↓lines ∇ ∇ html←TextToHTML html;mask;CR ⍝ Add/insert <br/>, replaces CR with <br/>,CR :If ~0∊⍴html :If ∨/mask←html=CR←''⍴CRLF (mask/html)←⊂'<br/>',CR html←enlist html :EndIf html,←(~∨/¯2↑mask)/'<br/>',CRLF :EndIf ∇ ∇ html←{fontsize}APLToHTML APL ⍝ returns APL code formatted for HTML fontsize←{6::'' ⋄ ';fontsize:',⍎⍵}'fontsize' :If 1<|≡APL ⋄ APL←enlist,∘CRLF¨APL ⋄ :EndIf :Trap 0 html←3↓¯4↓'whitespace' 'preserve'⎕XML 1 3⍴0 'x'APL :Else html←APL :EndTrap html←('pre style="font-family:APL385 Unicode',fontsize,'"')Enclose CRLF,⍨html ∇ ∇ html←APLToHTMLColor APL;types;colors;class;codes;apply;lines;head;tail;c;ent ⍝ returns APL code formatted for HTML with syntax coloring :Trap 0 colors←⍬ colors,←⊂'i200comment'(1 26 63) colors,←⊂'i200char'(4 29) colors,←⊂'i200num'(5 30) colors,←⊂'i200local'(10 32 35 53) colors,←⊂'i200global'(7 52 55) colors,←⊂'i200primitive'(19 44 146 To 153 214 To 221) colors,←⊂'i200idiom'(23 48) colors,←⊂'i200control'(58 155 To 179 181 To 213 222 To 248) colors,←⊂'i200space'(8 9 33 34) colors,←⊂'i200quad'(12 To 15 37 To 40) html←({(+/∨\' '≠⌽⍵)↑¨↓⍵}⍣(1≥|≡APL))APL ⍝ Make VTV if matrix lines←∊1↑¨⍨≢¨html types←0,0,⍨∊200⌶html ⍝ 200⌶ is color coding :For c ent :InEach '&<'('&amp;' '&lt;') ((c⍷∊html)/∊html)←⊂⊂ent :EndFor html←' ',' ',⍨⊃,/html :For class codes :In colors apply←1 0⍷types∊codes (apply/html)←(apply/html),¨⊂'</span>' :EndFor :For class codes :In colors apply←0 1⍷types∊codes (apply/html)←(apply/html),¨⊂'<span class="',class,'">' :EndFor head←1↓⊃html ⋄ tail←¯1↓⊃⌽html html←lines⊂1↓¯1↓html (⊃html),⍨←head ⋄ (⊃⌽html),←tail html←∊¨html html,⍨¨←,∘'</span>'¨↓↑('<span class="i200line">['∘,,∘']')¨⍕¨¯1+⍳⍴html ⍝ Prepend line numbers html←'pre'Enclose'code'Enclose html :Else html←APLToHTML APL :EndTrap ∇ MakeStyle←{ ⍺←'' 0∊⍴⍵:'' (' ',⍨¯2↓enlist(eis ⍺),¨⊂', '),Styles ⍵ } ∇ r←HtmlSafeText txt;i;m;u;ucs;s ⍝ make text HTML "safe" r←,⎕FMT txt i←'&<>"#'⍳r i-←(i=1)∧1↓(i=5),0 ⍝ mark & that aren't &# m←i∊⍳4 u←127<ucs←⎕UCS r s←' '=r (s/r)←⊂'&nbsp;' (m/r)←('&amp;' '&lt;' '&gt;' '&quot;')[m/i] (u/r)←(~∘' ')¨↓'G<&#ZZZ9;>'⎕FMT u/ucs r←enlist r ∇ :EndNamespace
:Namespace HtmlUtils (⎕IO ⎕ML)←1 ⎕FX 'r←CRLF' 'r←⎕UCS 13 10' ⍝ So it will be :Included enlist←{⎕ML←1 ⋄ ∊⍵} ⍝ APL2 enlist eis←{(,∘⊂)⍣((326∊⎕DR ⍵)<2>|≡⍵),⍵} ⍝ Enclose if simple ine←{0∊⍴⍺:'' ⋄ ⍵} ⍝ if not empty ischar←{0 2∊⍨10|⎕DR⍵} quote←{0∊⍴⍵:'' ⋄ '"',({w←⍵⋄((w='"')/w)←⊂'\"'⋄enlist w}⍵),'"'} iotaz←{(⍴⍺){⍵×⍺≥⍵}⍺⍳⍵} innerhtml←{⊃↓/(⍵ iotaz'>')(-(⌽⍵)iotaz'<') ⍵} dtlb←{⍵{((∨\⍵)∧⌽∨\⌽⍵)/⍺}' '≠⍵} ⍝ tonum←{0∊⍴⍵:⍬ ⋄ w←⍵ ⋄ ((w='-')/w)←'¯' ⋄ ⊃(//)⎕VFI w} ∇ r←atts Enclose innerhtml;i ⍝ Put an HTML tag around some HTML :If 1<|≡innerhtml ⋄ innerhtml←CRLF,enlist innerhtml,¨⊂CRLF ⋄ :EndIf :If 0∊⍴atts r←innerhtml :Else i←¯1+(atts←,atts)⍳' ' r←'<',atts,'>',innerhtml,'</',(i↑atts),'>',CRLF :EndIf ∇ ∇ r←{nl}Tag tag ⍝ Make a self-closing tag nl←{6::1 ⋄ nl}⍬ r←'<',tag,' />',nl/CRLF ∇ FormatAttrs←{ ⍝ format name/value pairs as tag attributes ⍝ ⍵ - name/value pairs, valid forms: ⍝ 'name="value"' ⍝ [n,2⍴] 'name1' 'value1' ['name2' 'value2'...] ⍝ ('name1' 'value1') [('name2' 'value2')] 0∊⍴⍵:'' { enlist{(×⍴⍺)/' ',⍺,(×⍴⍵)/'=',quote ⍵}/,∘⍕¨⊃⍵ }_pifn¨,2 _box _pifn{ 1=|≡⍵:⍵ 2=|≡⍵:{1=⍴⍴⍵:(⌽2,0.5×⍴⍵)⍴⍵ ⋄ ⍵}⍵ ↑⍵}⍵ } ∇ r←tag GetAttr attr;attrs r←'' :Trap 6 →0⍴⍨0∊⍴tag←⎕XML tag :EndTrap attrs←(⊂1 4)⊃tag r←(attrs[;1]⍳⊂attr)⊃attrs[;2],⊂'' ∇ Styles←{ ⍝ format name/value pairs as CSS style attributes ⍝ ⍵ - name/value pairs, valid forms: ⍝ 'name: value' ⍝ [n,2⍴] 'name1' 'value1' ['name2' 'value2'...] ⍝ ('name1' 'value1') [('name2' 'value2')] ⍺←'' 0∊⍴⍵:⍺,'{}' (0∊⍴⍺)↓⍺,{'{',({';'=¯1↑⍵:⍵ ⋄ ⍵,';'}⍵),'}'}{ enlist{(×⍴⍺)/⍺,(×⍴⍵)/':',⍵,';'}/,∘⍕¨⊃⍵ }_pifn¨,2 _box _pifn{ 1=|≡⍵:⍵ 2=|≡⍵:{1=⍴⍴⍵:(⌽2,0.5×⍴⍵)⍴⍵ ⋄ ⍵}⍵ ↑⍵}⍵ } _box←{⍺←1 ⋄ (⊂⍣(⍺=|≡⍵))⍵} _pifn←{({⍵''}⍣(1=|≡⍵))⍵} ∇ r←ScriptFollows;lines;pgm;from ⍝ Treat following commented lines in caller as a script, lines beginning with ⍝⍝ are stripped out :If 0∊⍴lines←(from←⎕IO⊃⎕RSI).⎕NR pgm←2⊃⎕SI lines←↓from.(180⌶)pgm :EndIf r←2↓∊CRLF∘,¨{⍵/⍨'⍝'≠⊃¨⍵}{1↓¨⍵/⍨∧\'⍝'=⊃¨⍵}dtlb¨(1+2⊃⎕LC)↓lines ∇ ∇ html←TextToHTML html;mask;CR ⍝ Add/insert <br/>, replaces CR with <br/>,CR :If ~0∊⍴html :If ∨/mask←html=CR←''⍴CRLF (mask/html)←⊂'<br/>',CR html←enlist html :EndIf html,←(~∨/¯2↑mask)/'<br/>',CRLF :EndIf ∇ ∇ html←{fontsize}APLToHTML APL ⍝ returns APL code formatted for HTML fontsize←{6::'' ⋄ ';fontsize:',⍎⍵}'fontsize' :If 1<|≡APL ⋄ APL←enlist,∘CRLF¨APL ⋄ :EndIf :Trap 0 html←3↓¯4↓'whitespace' 'preserve'⎕XML 1 3⍴0 'x'APL :Else html←APL :EndTrap html←('pre style="font-family:APL385 Unicode',fontsize,'"')Enclose CRLF,⍨html ∇ ∇ html←APLToHTMLColor APL;types;colors;class;codes;apply;lines;head;tail;c;ent;to ⍝ returns APL code formatted for HTML with syntax coloring to←{(¯1↓⍺),((¯1+⊃⌽⍺)+⍳1+(⊃⍵)-(⊃⌽⍺)),1↓⍵} :Trap 0 colors←⍬ colors,←⊂'i200comment'(1 26 63) colors,←⊂'i200char'(4 29) colors,←⊂'i200num'(5 30) colors,←⊂'i200local'(10 32 35 53) colors,←⊂'i200global'(7 52 55) colors,←⊂'i200primitive'(19 44 146 to 153 214 to 221) colors,←⊂'i200idiom'(23 48) colors,←⊂'i200control'(58 155 to 179 181 to 213 222 to 248) colors,←⊂'i200space'(8 9 33 34) colors,←⊂'i200quad'(12 to 15 37 to 40) html←({(+/∨\' '≠⌽⍵)↑¨↓⍵}⍣(1≥|≡APL))APL ⍝ Make VTV if matrix lines←∊1↑¨⍨≢¨html types←0,0,⍨∊200⌶html ⍝ 200⌶ is color coding :For c ent :InEach '&<'('&amp;' '&lt;') ((c⍷∊html)/∊html)←⊂⊂ent :EndFor html←' ',' ',⍨⊃,/html :For class codes :In colors apply←1 0⍷types∊codes (apply/html)←(apply/html),¨⊂'</span>' :EndFor :For class codes :In colors apply←0 1⍷types∊codes (apply/html)←(apply/html),¨⊂'<span class="',class,'">' :EndFor head←1↓⊃html ⋄ tail←¯1↓⊃⌽html html←lines⊂1↓¯1↓html (⊃html),⍨←head ⋄ (⊃⌽html),←tail html←∊¨html html,⍨¨←,∘'</span>'¨↓↑('<span class="i200line">['∘,,∘']')¨⍕¨¯1+⍳⍴html ⍝ Prepend line numbers html←'pre'Enclose'code'Enclose html :Else html←APLToHTML APL :EndTrap ∇ MakeStyle←{ ⍺←'' 0∊⍴⍵:'' (' ',⍨¯2↓enlist(eis ⍺),¨⊂', '),Styles ⍵ } ∇ r←HtmlSafeText txt;i;m;u;ucs;s ⍝ make text HTML "safe" r←,⎕FMT txt i←'&<>"#'⍳r i-←(i=1)∧1↓(i=5),0 ⍝ mark & that aren't &# m←i∊⍳4 u←127<ucs←⎕UCS r s←' '=r (s/r)←⊂'&nbsp;' (m/r)←('&amp;' '&lt;' '&gt;' '&quot;')[m/i] (u/r)←(~∘' ')¨↓'G<&#ZZZ9;>'⎕FMT u/ucs r←enlist r ∇ :EndNamespace
Add ∇to to APLToHTMLColor
Add ∇to to APLToHTMLColor
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
453dc992d4a7b06336f53d6edb26b90a5d2ef04e
MS3/mortgage.dyalog
MS3/mortgage.dyalog
:Class mortgage : MiPageSample ⍝ define the fields that MiServer will keep up-to-date using form data :Field Public prin←'100000' ⍝ principal field :Field Public rate←'4.5' ⍝ rate :Field Public term←'30' ⍝ term (years) :Field Public pmt←'' ⍝ payment tonum←{{(,1)≡1⊃⍵:2⊃⍵ ⋄ ''}⎕VFI ⍵} ⍝ very simple check for a single number ⍝ ↓ calculate payment based on principal, rate, and term calcpmt←{0::'Error' ⋄ p r n←⍵÷1 1200 (÷12) ⋄ .01×⌈100×p×r÷1-(1+r)*-n} ⍝ ↓ calculate how much you can borrow based on rate, term, and payment calcprin←{0::'Error' ⋄ r n m←⍵÷1200 (÷12) 1 ⋄ .01×⌈100×m÷r÷1-(1+r)*-n} ∇ Render;f;inputs;labels;h ⍝ render the initial page :Access Public :If 0=⍴pmt ⋄ pmt←calcpmt tonum¨prin rate term ⋄ :EndIf ⍝ First calculation Add h2'Mortgage Calculator' Add'Modify principal, rate or term to recalculate payment.' Add¨br,(⊂'Change payment to recalculate the principal'),2⍴br (frm←Add Form).id←'mtg' (ig←frm.Add InputGrid).Border←0 ig.Labels←'Principal' 'Interest Rate' 'Term (years)' 'Payment' ig.Inputs←EditField,¨{⊂⍵ (⍎⍵)}¨'prin' 'rate' 'term' 'pmt' h←Add _JQ.Handler ⍝ add an event handler h.Callback←'Calc' ⍝ specify the callback function to run h.Events←'change' ⍝ listen for the "change" event h.Selectors←'#mtg input' ⍝ on the input elements within the form with id "mtg" h.ClientData←'formdata' '#mtg' 'serialize' ⍝ ↑ Return serialized data for form #mtg as "formdata" ⍝ ↑ MiServer maps named data in serialized form data to public fields in the page object ∇ ∇ resp←Calc;p;r;n;m ⍝ callback function for the handler defined in Render :Access public p r n m←tonum¨prin rate term pmt ⍝ convert input fields to numbers resp←'' :Select _what ⍝ what field changed? :CaseList 'prin' 'rate' 'term' ⍝ one of prin rate or term changed, calculate payment :If ~∨/{0∊⍴⍵}¨p r n ⍝ if we have values for all inputs... ⍝ ... calculate the payment and replace the value attribute in the input element resp←Execute'#pmt'_JSS.Val calcpmt p r n :EndIf :Case 'pmt' ⍝ payment changed, calculate principal :If ~∨/{0∊⍴⍵}¨r n m ⍝ if we have values for all inputs... ⍝ ... calculate the principal and replace the value attribute in the input element resp←Execute'#prin'_JSS.Val calcprin r n m :EndIf :EndSelect resp,←Execute 'alert("hello")' ∇ :EndClass
:Class mortgage : MiPageSample ⍝ define the fields that MiServer will keep up-to-date using form data :Field Public prin←'100000' ⍝ principal field :Field Public rate←'4.5' ⍝ rate :Field Public term←'30' ⍝ term (years) :Field Public pmt←'' ⍝ payment tonum←{{(,1)≡1⊃⍵:2⊃⍵ ⋄ ''}⎕VFI ⍵} ⍝ very simple check for a single number ⍝ ↓ calculate payment based on principal, rate, and term calcpmt←{0::'Error' ⋄ p r n←⍵÷1 1200 (÷12) ⋄ .01×⌈100×p×r÷1-(1+r)*-n} ⍝ ↓ calculate how much you can borrow based on rate, term, and payment calcprin←{0::'Error' ⋄ r n m←⍵÷1200 (÷12) 1 ⋄ .01×⌈100×m÷r÷1-(1+r)*-n} ∇ Render;f;inputs;labels;h ⍝ render the initial page :Access Public :If 0=⍴pmt ⋄ pmt←calcpmt tonum¨prin rate term ⋄ :EndIf ⍝ First calculation Add h2'Mortgage Calculator' Add'Modify principal, rate or term to recalculate payment.' Add¨br,(⊂'Change payment to recalculate the principal'),2⍴br (frm←Add Form).id←'mtg' (ig←frm.Add InputGrid).Border←0 ig.Labels←'Principal' 'Interest Rate' 'Term (years)' 'Payment' ig.Inputs←EditField,¨{⊂⍵ (⍎⍵)}¨'prin' 'rate' 'term' 'pmt' h←Add _JQ.Handler ⍝ add an event handler h.Callback←'Calc' ⍝ specify the callback function to run h.Events←'change' ⍝ listen for the "change" event h.Selectors←'#mtg input' ⍝ on the input elements within the form with id "mtg" h.ClientData←'formdata' '#mtg' 'serialize' ⍝ ↑ Return serialized data for form #mtg as "formdata" ⍝ ↑ MiServer maps named data in serialized form data to public fields in the page object ∇ ∇ resp←Calc;p;r;n;m ⍝ callback function for the handler defined in Render :Access public p r n m←tonum¨prin rate term pmt ⍝ convert input fields to numbers resp←'' :Select _what ⍝ what field changed? :CaseList 'prin' 'rate' 'term' ⍝ one of prin rate or term changed, calculate payment :If ~∨/{0∊⍴⍵}¨p r n ⍝ if we have values for all inputs... ⍝ ... calculate the payment and replace the value attribute in the input element resp←Execute'#pmt'_JSS.Val calcpmt p r n :EndIf :Case 'pmt' ⍝ payment changed, calculate principal :If ~∨/{0∊⍴⍵}¨r n m ⍝ if we have values for all inputs... ⍝ ... calculate the principal and replace the value attribute in the input element resp←Execute'#prin'_JSS.Val calcprin r n m :EndIf :EndSelect ∇ :EndClass
Remove test message from mortgage.dyalog
Remove test message from mortgage.dyalog
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
5d1b6d9e954cfa8c5e1690fd96d69057cea5afcd
HTML/_JS/jBox.dyalog
HTML/_JS/jBox.dyalog
:Class jBox : #._JQ._jqWidget ⍝ Description:: jBox widget ⍝ ⍝ Constructor:: [type [message [content]]] ⍝ type - one of 'Tooltip', 'Mouse', 'Modal', 'Confirm', 'Notice', 'Image' ⍝ message - the text that will appear in the popup ⍝ content - the content for the target element ⍝ ⍝ Public Fields:: ⍝ Type - one of 'Tooltip', 'Mouse', 'Modal', 'Confirm', 'Notice', 'Image' ⍝ Message - the text that will appear in the popup ⍝ Content - the content for the target element ⍝ ⍝ Notes:: ⍝ For more information see https://github.com/StephanWagner/jBox ⍝ Type is a public field in the base class :field public shared readonly DocBase←'http://stephanwagner.me/jBox/documentation' :field public shared readonly ApiLevel←3 :field public shared readonly Types←'Tooltip' 'Mouse' 'Modal' 'Confirm' 'Notice' 'Image' :field public Content←'' :field public Message←'' ∇ make :Access public JQueryFn←Uses←'jBox' :Implements constructor Type←'Tooltip' ContainerTag←'span' ∇ ∇ make1 args :Access public JQueryFn←Uses←'jBox' :Implements constructor args←eis args (Type Message Content)←args defaultArgs'Tooltip'Message Content ContainerTag←'span' ∇ ∇ r←Render;ind :Access public ind←Types⍳⊂#.Strings.firstCap Type 'Invalid jBox Type'⎕SIGNAL(ind>⍴Types)/11 Type←ind⊃Types Container.Content←Content 'content'Set renderIt Message BuildHTML←~0∊⍴Content r←⎕BASE.Render ∇ :EndClass
:Class jBox : #._JQ._jqWidget ⍝ Description:: jBox widget ⍝ ⍝ Constructor:: [type [message [content]]] ⍝ type - one of 'Tooltip', 'Mouse', 'Modal', 'Confirm', 'Notice', 'Image' ⍝ message - the text that will appear in the popup ⍝ content - the content for the target element ⍝ ⍝ Public Fields:: ⍝ Type - one of 'Tooltip', 'Mouse', 'Modal', 'Confirm', 'Notice', 'Image' ⍝ Message - the text that will appear in the popup ⍝ Content - the content for the target element ⍝ Theme - name of a jBox-Theme (one of 'ModalBorder','NoticeBorder','TooltipBorder' or 'TooltipDark') ⍝ ⍝ Notes:: ⍝ For more information see https://github.com/StephanWagner/jBox ⍝ Type is a public field in the base class :field public shared readonly DocBase←'http://stephanwagner.me/jBox/documentation' :field public shared readonly ApiLevel←3 :field public shared readonly Types←'Tooltip' 'Mouse' 'Modal' 'Confirm' 'Notice' 'Image' :field public Content←'' :field public Message←'' :field public Theme←'' ∇ make :Access public JQueryFn←Uses←'jBox' :Implements constructor Type←'Tooltip' ContainerTag←'span' ∇ ∇ make1 args :Access public JQueryFn←Uses←'jBox' :Implements constructor args←eis args (Type Message Content)←args defaultArgs'Tooltip'Message Content ContainerTag←'span' ∇ ∇ r←Render;ind :Access public ind←Types⍳⊂#.Strings.firstCap Type 'Invalid jBox Type'⎕SIGNAL(ind>⍴Types)/11 Type←ind⊃Types Container.Content←Content 'content'Set renderIt Message BuildHTML←~0∊⍴Content :If 0<⍴Theme 'theme'Set Theme Use'⍕/jBox/themes/',Theme,'.css' :EndIf r←⎕BASE.Render ∇ :EndClass
Update jBox.dyalog
Update jBox.dyalog Added public field Theme, reformatted file.
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer
19ce64c6c16eea7b9f37bf58133fe674d4135883
Core/HtmlPage.dyalog
Core/HtmlPage.dyalog
:class HtmlPage : #.HtmlElement ⍝∇:require =\HtmlElement.dyalog :field public Head :field public Body :field public Scripts :field public StylesLinks ∇ make :Access public :Implements constructor _init Tag←'html' ∇ ∇ r←RenderBody;scr;mask ⍝ Called by MiPage because rendering can add scripts to the head element :Access public :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{~0∊⍴⍵}¨scr.Content Body.Add¨mask/scr :EndIf r←Body.Render ∇ ∇ r←RenderPage b;scr;mask;content :Access public content←Content :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{0∊⍴⍵}¨scr.Content Head.Add¨mask/scr :EndIf :If ~0∊⍴StylesLinks Head.Add¨StylesLinks :EndIf Content←(Head.Render),b r←'<!DOCTYPE html>',∊⎕BASE.Render Content←content ∇ ∇ r←Render;s;b;mask;scr;sty;content;headContent :Access public content←Content headContent←Head.Content :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{~0∊⍴⍵}¨scr.Content Body.Add¨mask/scr :EndIf b←Body.Render :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{0∊⍴⍵}¨scr.Content Head.Add¨mask/scr :EndIf :If ~0∊⍴sty←∪⌽StylesLinks Head.Add¨StylesLinks :EndIf Content←(Head.Render),b r←'<!DOCTYPE html>',∊⎕BASE.Render Content←content Head.Content←headContent ∇ ∇ _init :Access public Body←⎕NEW #.HtmlElement'body' Head←⎕NEW #.HtmlElement'head' (Body Head)._PageRef←⎕THIS Scripts←'' StylesLinks←'' Handlers←'' Content←Head,Body ∇ ∇ {r}←{attr}Add what;c :Access public :If 0=⎕NC'attr' ⋄ attr←'' ⋄ :EndIf :If isClass⊃what ⍝ :If #._html.script∊c←∊⎕CLASS⊃what ⍝ r←Scripts,←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :If #._JQ.Handler∊c←∊⎕CLASS⊃what r←Body.Handlers,←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :If 0∊⍴r.Selector ⋄ r.Selector←'html' ⋄ :EndIf ⍝ if no selector specified, use page level :ElseIf ⊃∨/c∊¨⊂#._html.(style link) r←StylesLinks,←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :ElseIf ⊃∨/c∊¨⊂#._html.(title meta noscript base) ⍝ elements that belong exclusively or primarily in the <head> element r←attr Head.Add what :Else r←attr Body.Add what :EndIf r._PageRef←⎕THIS :Else r←attr Body.Add what :EndIf ∇ ∇ {r}←{attr}Insert what;c :Access public :If 0=⎕NC'attr' ⋄ attr←'' ⋄ :EndIf :If isClass⊃what :If #._html.script∊c←∊⎕CLASS⊃what r←Scripts,⍨←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :ElseIf #._JQ.Handler∊c r←Body.Handlers,⍨←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :If 0∊⍴r.Selector ⋄ r.Selector←'html' ⋄ :EndIf ⍝ if no selector specified, use page level :ElseIf ⊃∨/c∊¨⊂#._html.(style link) r←StylesLinks,⍨←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :ElseIf ⊃∨/c∊¨⊂#._html.(title meta noscript base) ⍝ elements that belong exclusively or primarily in the <head> element r←attr Head.Insert what :Else r←attr Body.Insert what :EndIf r._PageRef←⎕THIS :Else r←attr Body.Insert what :EndIf ∇ ∇ {r}←On args :Access public r←Body.On args r.Selector←'⍎document' ∇ ∇ {r}←{attr}New what :Access public :If 0=⎕NC'attr' ⋄ attr←'' ⋄ :EndIf r←attr ⎕BASE.New what r._PageRef←⎕THIS ∇ dtlb←{⍵{((∨\⍵)∧⌽∨\⌽⍵)/⍺}' '≠⍵} ∇ r←Style style :Access public r←{(⎕NEW #._html.link).Set(('href'⍵)('rel' 'stylesheet')('type' 'text/css'))}style ∇ :endclass
:class HtmlPage : #.HtmlElement ⍝∇:require =\HtmlElement.dyalog :field public Head :field public Body :field public Scripts :field public StylesLinks ∇ make :Access public :Implements constructor _init Tag←'html' ∇ ∇ r←RenderBody;scr;mask ⍝ Called by MiPage because rendering can add scripts to the head element :Access public :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{~0∊⍴⍵}¨scr.Content Body.Add¨mask/scr :EndIf r←Body.Render ∇ ∇ r←RenderPage b;scr;mask;content :Access public content←Content :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{0∊⍴⍵}¨scr.Content Head.Add¨mask/scr :EndIf :If ~0∊⍴StylesLinks Head.Add¨StylesLinks :EndIf Content←(Head.Render),b r←'<!DOCTYPE html>',∊⎕BASE.Render Content←content ∇ ∇ r←Render;s;b;mask;scr;sty;content;headContent :Access public content←Content headContent←Head.Content :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{~0∊⍴⍵}¨scr.Content Body.Add¨mask/scr :EndIf b←Body.Render :If ~0∊⍴scr←∪Scripts :AndIf ∨/mask←{0∊⍴⍵}¨scr.Content Head.Add¨mask/scr :EndIf :If ~0∊⍴sty←∪⌽StylesLinks Head.Add¨StylesLinks :EndIf Content←(Head.Render),b r←'<!DOCTYPE html>',∊⎕BASE.Render Content←content Head.Content←headContent ∇ ∇ _init :Access public Body←⎕NEW #.HtmlElement'body' Head←⎕NEW #.HtmlElement'head' (Body Head)._PageRef←⎕THIS Scripts←'' StylesLinks←'' Handlers←'' Content←Head,Body ∇ ∇ {r}←{attr}Add what;c :Access public :If 0=⎕NC'attr' ⋄ attr←'' ⋄ :EndIf :If isClass⊃what ⍝ :If #._html.script∊c←∊⎕CLASS⊃what ⍝ r←Scripts,←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :If #._JQ.Handler∊c←∊⎕CLASS⊃what r←Body.Handlers,←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :If 0∊⍴r.Selector ⋄ r.Selector←'html' ⋄ :EndIf ⍝ if no selector specified, use page level :ElseIf ⊃∨/c∊¨⊂#._html.(style link) r←StylesLinks,←attr New what :ElseIf ⊃∨/c∊¨⊂#._html.(title meta noscript base) ⍝ elements that belong exclusively or primarily in the <head> element r←attr Head.Add what :Else r←attr Body.Add what :EndIf r._PageRef←⎕THIS :Else r←attr Body.Add what :EndIf ∇ ∇ {r}←{attr}Insert what;c :Access public :If 0=⎕NC'attr' ⋄ attr←'' ⋄ :EndIf :If isClass⊃what :If #._html.script∊c←∊⎕CLASS⊃what r←Scripts,⍨←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :ElseIf #._JQ.Handler∊c r←Body.Handlers,⍨←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :If 0∊⍴r.Selector ⋄ r.Selector←'html' ⋄ :EndIf ⍝ if no selector specified, use page level :ElseIf ⊃∨/c∊¨⊂#._html.(style link) r←StylesLinks,⍨←{(⎕NEW(⊃⍵)((⊃⍣(2=⊃⍴⍵))1↓⍵))}what :ElseIf ⊃∨/c∊¨⊂#._html.(title meta noscript base) ⍝ elements that belong exclusively or primarily in the <head> element r←attr Head.Insert what :Else r←attr Body.Insert what :EndIf r._PageRef←⎕THIS :Else r←attr Body.Insert what :EndIf ∇ ∇ {r}←On args :Access public r←Body.On args r.Selector←'⍎document' ∇ ∇ {r}←{attr}New what :Access public :If 0=⎕NC'attr' ⋄ attr←'' ⋄ :EndIf r←attr ⎕BASE.New what r._PageRef←⎕THIS ∇ dtlb←{⍵{((∨\⍵)∧⌽∨\⌽⍵)/⍺}' '≠⍵} ∇ r←Style style :Access public r←{(⎕NEW #._html.link).Set(('href'⍵)('rel' 'stylesheet')('type' 'text/css'))}style ∇ :endclass
Fix to make sure attributes render properly for style and link elements
Fix to make sure attributes render properly for style and link elements
APL
mit
Dyalog/MiServer,Dyalog/MiServer,Dyalog/MiServer