Skip to content

Commit ff237cd

Browse files
Bugfixes after initial release
Fixing typos, updating toolbox name, adding 'tags' param to gettingStarted example and re-generating htmls.
1 parent 4b92925 commit ff237cd

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The toolbox provides easy to use MATLAB® functions that simplify the process
1313

1414
## Installation
1515

16-
1. Install the toolbox by using the Add-on explorer in MATLAB or by downloading the **matlabcentral-matlab.mltbx** file attached to the latest release on GitHub, then doubleclicking on it.
16+
1. Install the toolbox by using the Add-on explorer in MATLAB or by downloading the **MATLAB_Central_Interface_For_MATLAB.mltbx** file attached to the latest release on GitHub, then doubleclicking on it.
1717

1818
## Quick Usage
1919

toolbox/docs/SearchApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Search MATLAB Central artifacts that match a specified query. Areas you can sear
1414
Name | Type | Description | Notes
1515
------------- | ------------- | ------------- | -------------
1616
**query** | **String**| Enter keywords to search. Separate multiple keywords with space or comma. | [optional]
17-
**scope** | **String**| A comma-separated list of MATLAB Central areas to search within. | [optional] [default to all]
17+
**scope** | **String**| A comma-separated list of MATLAB Central areas to search within. All values must be a member of this set: matlab-answers, file-exchange, cody, blogs, community-contests, community-highlights. | [optional] [default is all values in the set]
1818
**tags** | **String**| A comma-separated list of tags. MATLAB Central areas that do not support tags are excluded from the result set. | [optional]
1919
**created_before** | **String**| Content that was created before this date and time, specified in ISO 8601 format. | [optional]
2020
**created_after** | **String**| Content that was created after this date and time, specified in ISO 8601 format. | [optional]

toolbox/docs/html/errorHandling.html

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

toolbox/docs/html/gettingStarted.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
.embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement { min-height: 16px;}
3535
.rightPaneElement .textElement { padding-top: 2px; padding-left: 9px;}
3636
.S9 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(33, 33, 33); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left; }
37-
.S10 { border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }</style></head><body><div class = rtcContent><h1 class = 'S0'><span>Getting Started with the MATLAB Central Interface for MATLAB</span></h1><h2 class = 'S1'><span>Description</span></h2><div class = 'S2'><span>The Community API allows developers to programmatically retrieve data from</span><span> </span><a href = "https://www.mathworks.com/matlabcentral"><span>MATLAB Central.</span></a><span> </span><span>The API offers a single resource to search across different MATLAB Central areas including MATLAB Answers, File Exchange, Blogs, Cody, Highlights and Contests. Use this toolbox for easy integration with the Community API from your MATLAB scripts and apps.</span></div><h2 class = 'S1'><span>System Requirements</span></h2><div class = 'S2'><span>Requires MATLAB® release R2017b or newer</span></div><h2 class = 'S1'><span>Functions</span></h2><ul class = 'S3'><li class = 'S4'><span style=' font-family: monospace;'>SearchApi.search </span><span>- Search MATLAB Central areas for content matching specified query. Areas you can search include MATLAB Answers, File Exchange, Blogs, Cody, Community Highlights, and Community Contests. The </span><span style=' font-style: italic;'>scope</span><span> parameter lets you restrict the request to specific MATLAB Central areas. The request accepts several other parameters to help narrow your search and create complex queries.</span></li></ul><h2 class = 'S1'><span>Usage</span></h2><div class = 'S2'><span>Download matlabcentral-matlab.mltbx</span><span> </span><span>into your workspace.</span></div><h2 class = 'S1'><span>Examples</span></h2><div class = 'S2'><span>The following example demonstrates calling the Search API to retrieve MATLAB Answers for content matching the query term 'plotting' in the last one year. The example also demonstrates the use of all optional query parameters supported by the API.</span></div><div class = 'S2'><span>Call the Search API using the </span><span style=' font-style: italic;'>search</span><span> method passing in values for all optional parameters</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S5'><span style="white-space: pre"><span >query = </span><span style="color: rgb(167, 9, 245);">"plotting"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >scope = </span><span style="color: rgb(167, 9, 245);">"file-exchange,matlab-answers"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >created_before = datetime(</span><span style="color: rgb(167, 9, 245);">'12-Mar-2023 11:00:00'</span><span >);</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >created_after = datetime(</span><span style="color: rgb(167, 9, 245);">'06-Mar-2022 11:00:00'</span><span >);</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >sort_order = </span><span style="color: rgb(167, 9, 245);">"created asc"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >page = 2;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >count = 15;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'>&nbsp;</div></div><div class="inlineWrapper outputs"><div class = 'S7'><span style="white-space: pre"><span >[searchResults, statusCode, headers] = SearchApi.search(query=query,scope=scope,created_before=created_before,created_after=created_after,sort_order=sort_order,page=page,count=count);</span></span></div><div class = 'S8'><div class="inlineElement eoOutputWrapper embeddedOutputsErrorElement" uid="1583FDAC" prevent-scroll="true" data-testid="output_0" style="width: 1145px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-errorType eoOutputContent" data-previous-available-width="1115" data-previous-scroll-height="32" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: normal; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: pre-wrap; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;">Error using SearchApi.search<br style="white-space: pre-wrap; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;">HttpError:429 TooManyRequests</div><div class="diagnosticMessage-stackPart" style="white-space: pre; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;"></div></div></div></div></div></div><div class = 'S9'><span>Extract the </span><span style=' font-style: italic;'>items</span><span> and </span><span style=' font-style: italic;'>total_found</span><span> objects from the response </span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S5'><span style="white-space: pre"><span >totalFound = searchResults.total_found;</span></span></div></div><div class="inlineWrapper"><div class = 'S10'><span style="white-space: pre"><span >items = searchResults.items</span></span></div></div></div><div class = 'S9'><span>Display the results as a table</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S5'><span style="white-space: pre"><span >disp(</span><span style="color: rgb(167, 9, 245);">"Response Status: " </span><span >+ statusCode);</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >disp(</span><span style="color: rgb(167, 9, 245);">"Found " </span><span >+ totalFound + </span><span style="color: rgb(167, 9, 245);">" total results"</span><span >)</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >totalFound &gt; 0</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span > </span><span style="color: rgb(14, 0, 255);">for </span><span >item = 1:length(items)</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span > disp(items(item))</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span > </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div class = 'S10'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div>
37+
.S10 { border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 0px none rgb(33, 33, 33); border-bottom: 1px solid rgb(217, 217, 217); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }</style></head><body><div class = rtcContent><h1 class = 'S0'><span>Getting Started with the MATLAB Central Interface for MATLAB</span></h1><h2 class = 'S1'><span>Description</span></h2><div class = 'S2'><span>The Community API allows developers to programmatically retrieve data from</span><span> </span><a href = "https://www.mathworks.com/matlabcentral"><span>MATLAB Central.</span></a><span> </span><span>The API offers a single resource to search across different MATLAB Central areas including MATLAB Answers, File Exchange, Blogs, Cody, Highlights and Contests. Use this toolbox for easy integration with the Community API from your MATLAB scripts and apps.</span></div><h2 class = 'S1'><span>System Requirements</span></h2><div class = 'S2'><span>Requires MATLAB® release R2017b or newer</span></div><h2 class = 'S1'><span>Functions</span></h2><ul class = 'S3'><li class = 'S4'><span style=' font-family: monospace;'>SearchApi.search </span><span>- Search MATLAB Central areas for content matching specified query. Areas you can search include MATLAB Answers, File Exchange, Blogs, Cody, Community Highlights, and Community Contests. The </span><span style=' font-style: italic;'>scope</span><span> parameter lets you restrict the request to specific MATLAB Central areas. The request accepts several other parameters to help narrow your search and create complex queries.</span></li></ul><h2 class = 'S1'><span>Usage</span></h2><div class = 'S2'><span>Download MATLAB_Central_Interface_For_MATLAB.mltbx </span><span>into your workspace.</span></div><h2 class = 'S1'><span>Examples</span></h2><div class = 'S2'><span>The following example demonstrates calling the Search API to retrieve MATLAB Answers for content matching the query term 'plotting' in the last one year. The example also demonstrates the use of all optional query parameters supported by the API.</span></div><div class = 'S2'><span>Call the Search API using the </span><span style=' font-style: italic;'>search</span><span> method passing in values for all optional parameters</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S5'><span style="white-space: pre"><span >query = </span><span style="color: rgb(167, 9, 245);">"plotting"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >scope = </span><span style="color: rgb(167, 9, 245);">"file-exchange,matlab-answers"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >tags = </span><span style="color: rgb(167, 9, 245);">"legend"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >created_before = datetime(</span><span style="color: rgb(167, 9, 245);">'12-Mar-2023 11:00:00'</span><span >);</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >created_after = datetime(</span><span style="color: rgb(167, 9, 245);">'06-Mar-2022 11:00:00'</span><span >);</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >sort_order = </span><span style="color: rgb(167, 9, 245);">"created asc"</span><span >;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >page = 3;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >count = 15;</span></span></div></div><div class="inlineWrapper"><div class = 'S6'>&nbsp;</div></div><div class="inlineWrapper outputs"><div class = 'S7'><span style="white-space: pre"><span >[searchResults, statusCode, headers] = SearchApi.search(query=query,scope=scope,tags=tags,created_before=created_before,created_after=created_after,sort_order=sort_order,page=page,count=count);</span></span></div><div class = 'S8'><div class="inlineElement eoOutputWrapper embeddedOutputsErrorElement" uid="CC6F96D4" prevent-scroll="true" data-testid="output_0" style="width: 1145px; white-space: normal; font-style: normal; color: rgb(33, 33, 33); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-errorType eoOutputContent" data-previous-available-width="1115" data-previous-scroll-height="32" data-hashorizontaloverflow="false" style="max-height: 261px; white-space: normal; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: pre-wrap; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;">Error using SearchApi.search<br style="white-space: pre-wrap; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;">HttpError:429 TooManyRequests</div><div class="diagnosticMessage-stackPart" style="white-space: pre; font-style: normal; color: rgb(225, 27, 20); font-size: 12px;"></div></div></div></div></div></div><div class = 'S9'><span>Extract the </span><span style=' font-style: italic;'>items</span><span> and </span><span style=' font-style: italic;'>total_found</span><span> objects from the response </span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S5'><span style="white-space: pre"><span >totalFound = searchResults.total_found;</span></span></div></div><div class="inlineWrapper"><div class = 'S10'><span style="white-space: pre"><span >items = searchResults.items</span></span></div></div></div><div class = 'S9'><span>Display the results as a table</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S5'><span style="white-space: pre"><span >disp(</span><span style="color: rgb(167, 9, 245);">"Response Status: " </span><span >+ statusCode);</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span >disp(</span><span style="color: rgb(167, 9, 245);">"Found " </span><span >+ totalFound + </span><span style="color: rgb(167, 9, 245);">" total results"</span><span >)</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >totalFound &gt; 0</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span > </span><span style="color: rgb(14, 0, 255);">for </span><span >item = 1:length(items)</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span > disp(items(item))</span></span></div></div><div class="inlineWrapper"><div class = 'S6'><span style="white-space: pre"><span > </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div class = 'S10'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div>
3838
<br>
3939
<!--
4040
##### SOURCE BEGIN #####
@@ -55,7 +55,7 @@
5555
% restrict the request to specific MATLAB Central areas. The request accepts several
5656
% other parameters to help narrow your search and create complex queries.
5757
%% Usage
58-
% Download matlabcentral-matlab.mltbx into your workspace.
58+
% Download MATLAB_Central_Interface_For_MATLAB.mltbx into your workspace.
5959
%% Examples
6060
% The following example demonstrates calling the Search API to retrieve MATLAB
6161
% Answers for content matching the query term 'plotting' in the last one year.
@@ -67,13 +67,14 @@
6767
6868
query = "plotting";
6969
scope = "file-exchange,matlab-answers";
70+
tags = "legend";
7071
created_before = datetime('12-Mar-2023 11:00:00');
7172
created_after = datetime('06-Mar-2022 11:00:00');
7273
sort_order = "created asc";
73-
page = 2;
74+
page = 3;
7475
count = 15;
7576
76-
[searchResults, statusCode, headers] = SearchApi.search(query=query,scope=scope,created_before=created_before,created_after=created_after,sort_order=sort_order,page=page,count=count);
77+
[searchResults, statusCode, headers] = SearchApi.search(query=query,scope=scope,tags=tags,created_before=created_before,created_after=created_after,sort_order=sort_order,page=page,count=count);
7778
%%
7879
% Extract the _items_ and _total_found_ objects from the response
7980

0 commit comments

Comments
 (0)