Missing value ("is_coach_recommended") in API Khan response - khan-academy

I found that currently the API call corresponding to "/api/v1/user/exercises" doesn't return the value "is_coach_recommended". That says if the corresponding exercise (skill) was recommended or not by the teacher; this in contrast to the example json response example presented in the API explorer (http://api-explorer.khanacademy.org/api/v1/user/exercises) where it does appear.
Do you know how to make it appear? Maybe using a request that queries a previous version of API Khan? That information is critically important for the development of our project so I hope you can help me to make that information back.
Thanks!

It should be documented. Usually an attribute like this would be present with a value of true or false, or it would not be present. And there should be rules describing how you should interpret "not present".
"Should be documented" rarely means it is documented. You might have a look at some data; if out of 1,000 records 500 have a value "true", 500 have no value, and none have a value "false", then clearly "not present" means "false". If you have 400 true, 400 false, 200 not present, then "not present" might mean "not known".

Related

Logic App error - ActionFailed. An action failed. No dependent actions succeeded

I'm running into this error - ActionFailed. An action failed. No dependent actions succeeded - when trying to run this logic app to add an IP to be blocked.
Error
I'm not sure where to start. The input looks ok. Help? Thanks in advance!
p.s. - sorry, it won't allow me to post the pics due to not having enough points.
Tried changing some parts of the body. Not sure what to change really.
According to Microsoft's documentation on Submit or Update Indicator API the request body should be as follows:
{
"indicatorValue": "220e7d15b011d7fac48f2bd61114db1022197f7f",
"indicatorType": "FileSha1",
"title": "test",
"application": "demo-test",
"expirationTime": "2020-12-12T00:00:00Z",
"action": "AlertAndBlock",
"severity": "Informational",
"description": "test",
"recommendedActions": "nothing",
"rbacGroupNames": ["group1", "group2"]
}
Since the error you get is too generic, it isn't clear enough to know exactly.
You are not passing in recommendedActions and rbacGroupNames, they may not be required but may want to pass the column even if no value is included.
I would also validate calling this API using manual values (even the exact value from their documentation) and if that does work, use process of elimination to figure out which property is giving you the trouble.
i.e. application might not accept a space value or combining the two values for description should be done outside of the HTTP call using compose and then passed as a single value of the output.

"code": "6140" Duplicate Document Number Error

I am using QuickBooks. Somehow I am getting some weird error on creating one invoice.
{
"Fault": {
"Error": [
{
"Message": "Duplicate Document Number Error",
"Detail": "Duplicate Document Number Error : You must specify a different number. This number has already been used. DocNumber=O0010714 is assigned to TxnType=Invoice with TxnId=45823",
"code": "6140",
"element": ""
}
],
"type": "ValidationFault"
},
"time": "2020-12-15T04:54:25.476-08:00"
}
Why it is happening as there is no doc in the QuickBooks which says that doc number is a unique entity.
Short version: DocNumber should be unique in most cases. In some cases you can add include=allowduplicatedocnum arg in URL to allow that. Be aware that DocNumber can be automatically generated.
Long version: taken from DocNumber field documentation for Invoice
Reference number for the transaction. If not explicitly provided at
create time, this field is populated based on the setting of
Preferences:CustomTxnNumber as follows:
If Preferences:CustomTxnNumber is true a custom value can be provided.
If no value is supplied, the resulting DocNumber is null.
If Preferences:CustomTxnNumber is false, resulting DocNumber is system
generated by incrementing the last number by 1.
If Preferences:CustomTxnNumber is false then do not send a value as it
can lead to unwanted duplicates. If a DocNumber value is sent for an
Update operation, then it just updates that particular invoice and
does not alter the internal system DocNumber.
Note: DocNumber is an
optional field for all locales except France. For France locale if
Preferences:CustomTxnNumber is enabled it will not be automatically
generated and is a required field. If a duplicate DocNumber needs to
be supplied, add the query parameter name/value pair,
include=allowduplicatedocnum to the URI.
P.S. Late response, but may be useful for somebody in future.
UPD:
Looks like library from npm node quickbooks doesn't support that natively. Because method createBill doesn't allow to provide any params to URI. Even method module.create have just hardcoded url variable without ability to provide nothing extra.
In this case, if you still want to use include=allowduplicatedocnum, you have the following options:
monkey-patch this library;
make fork and do updates;
ask authors of that library to implement that instead of you;
find a library that will support that;
send raw requests to QBO from your code.

How to correct paging by using top and skip in Azure Search?

According to this document Total hits and Page Counts, if I want to implements paging, I should combine skip and top in my query.
The following is my POST query
{
"count": true ,
"search": "apple",
"searchFields": "content",
"select": "itemID, content",
"searchMode": "all",
"queryType":"full",
"skip": 100,
"top":100
}
It should return something like from 100 --> 200
{
"#odata.context": "https://example.search.windows.net/indexes('example-index-')/$metadata#docs(*)",
"#odata.count": 1611,
"#search.nextPageParameters": {
"count": true,
"search": "apple",
"searchFields": "content",
"select": "itemID, content",
"searchMode": "all",
"queryType": "full",
"skip": 200
},
But it just return top 100 , not paging offset to 100
"#odata.context": "https://example.search.windows.net/indexes('example-index')/$metadata#docs(*)",
"#odata.count": 1611,
Is there any thing I should setup?
The short answer of how to implement paging (from this article): Set top to your desired page size, then increment skip by that page size on every request. Here is an example of how that would look with the REST API using GET:
GET /indexes/onlineCatalog/docs?search=*$top=15&$skip=0
GET /indexes/onlineCatalog/docs?search=*$top=15&$skip=15
GET /indexes/onlineCatalog/docs?search=*$top=15&$skip=30
The REST API documentation also covers how to implement paging, as well as the true purpose of #odata.nextLink and #search.nextPageParameters (also covered in this related question).
Quoting from the API reference:
Continuation of Partial Search Responses
Sometimes Azure Search can't return all the requested results in a single Search response. This can happen for different reasons, such as when the query requests too many documents by not specifying $top or specifying a value for $top that is too large. In such cases, Azure Search will include the #odata.nextLink annotation in the response body, and also #search.nextPageParameters if it was a POST request. You can use the values of these annotations to formulate another Search request to get the next part of the search response. This is called a continuation of the original Search request, and the annotations are generally called continuation tokens. See the example in Response below for details on the syntax of these annotations and where they appear in the response body.
The reasons why Azure Search might return continuation tokens are implementation-specific and subject to change. Robust clients should always be ready to handle cases where fewer documents than expected are returned and a continuation token is included to continue retrieving documents. Also note that you must use the same HTTP method as the original request in order to continue. For example, if you sent a GET request, any continuation requests you send must also use GET (and likewise for POST).
Note
The purpose of #odata.nextLink and #search.nextPageParameters is to protect the service from queries that request too many results, not to provide a general mechanism for paging. If you want to page through results, use $top and $skip together. For example, if you want pages of size 10, your first request should have $top=10 and $skip=0, the second request should have $top=10 and $skip=10, the third request should have $top=10 and $skip=20, and so on.
The follwing example is Get method without top.
GET Method
https://example.search.windows.net/indexes('example-content-index-zh')/docs?api-version=2017-11-11&search=2018&$count=true&$skip=150&select=itemID
The Result:
{
"#odata.context": "https://example.search.windows.net/indexes('example-index-zh')/$metadata#docs(*)",
"#odata.count": 133063,
"value": [ //skip value ],
"#odata.nextLink": "https://example.search.windows.net/indexes('example-content-index-zh')/docs?api-version=2017-11-11&search=2018&$count=true&$skip=150"
}
No matter I use post or get, onces I add $top=# the #odata.nextLink will not show in result.
Finally, I figure out although #odata.nextLink or #search.nextPageParameters will not show. But the paging is working, I have to count myself.

How Do I Get Additional Results from EnvelopesAPI.ListStatusChanges

I'm trying to practice defensive programming. Following the advice from the documentation, I want to poll using the api passing in a value 3 minutes before the last time I polled. Considering, I could get a ResultSetSize less than the TotalSetSize, I'd like to ask for the next set of results starting at the next result.
So, as an example, I request the following (using the REST API explorer):
GET https://demo.docusign.net/restapi/v2/accounts/#####/envelopes?count=2&from_date=2017-01-01&from_to_status=changed HTTP/1.1
(note the count = 2)
This returns:
Object
resultSetSize: "2"
totalSetSize: "8"
startPosition: "0"
endPosition: "1"
nextUri: "/accounts/#####/envelopes?start_position=2&count=2&from_date=1%2f1%2f2017+12%3a00%3a00+AM&from_to_status=changed"
previousUri: ""
envelopes: Array [2]
Ok, great, exactly as I expect. Now, I want to get the second "page" of results. I add a start_position of 2, right? (Since the end position is 1, I'd expect to get startPosition 2 and endPosition 3 to be returned.)
GET https://demo.docusign.net/restapi/v2/accounts/#####/envelopes?count=2&from_date=2017-01-01&from_to_status=changed&start_position=2 HTTP/1.1
No dice... 400 Bad Request:
Object
errorCode: "INVALID_REQUEST_PARAMETER"
message: "The request contained at least one invalid parameter. Query parameter 'count' was not a positive integer."
The count parameter is a positive integer...
Please, someone tell me what I'm doing wrong. I would like to just request as many as they can pass at a time, and if there are more, I'd like to repeat until all envelopes have been retrieved, but that "count" error is concerning.
From documentation
start_position parameter is reserved for DocuSign use only.
Looks like pagination is not supported with the listStatusChanges api.
If you call the nextUri address, what happens? You will need to prepend your base URL.

Get usedrange of Microsoft Graph API doesn't work

I am trying to get values that are stored in Excel cells using the method Get usedrange (see the page below), but it doesn't work.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/worksheet_usedrange
The following error response is returned.
{
"error": {
"code": "InvalidArgument",
"message": "引数が正しくない、不足している、または形式が不適切です。", //The argument is incorrect, missing, or the format is inappropriate.
"innerError": {
"request-id": "dcff76b5-9bc6-4a01-b99f-853b9430ef0d",
"date": "2017-05-01T09:01:15"
}
}
}
I tried GET (as opposed to POST) with the same request URL on a trial ......it is mysterious that sometimes were time out, but sometimes all cell data was returned without timeout (result, the browser hung up).
I'd be very appreciated it if I could get any advise from anyone who encounters the same phenomenon or knows how to avoid it.
--
Additional Notes:
-Excel Data
-Execution result in Graph Explorer (original method, POST)
https://graph.microsoft.com/v1.0/me/drive/items/01PYKTZAO2B65SCU2UDJCKMKFWJEEDRNLQ/workbook/worksheets('Sheet1')/UsedRange()
-Additional Information - Result when use GET in the same URL
The author left a comment saying that they only expected metadata (such as the number of cells), but received all of the data in the range.
You can filter which information you'd like back like so:
/usedRange?$select=columnCount,rowCount,address,addressLocal,cellCount,columnIndex,rowIndex
(Doing this prevents the query from returning the actual data from the cells because it omits things like numberFormat, text, formulas, formulasLocal, formulasR1C1, valueTypes, and values.)

Resources