Skip to content

Commit 723027c

Browse files
upd: readme and minor change in batch request conditions
1 parent f17134d commit 723027c

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Any suggestions are welcome!
4545
### DynamicsWebApi as a Dynamics 365 web resource
4646
In order to use DynamicsWebApi inside Dynamics 365 you need to download a browser version of the library, it can be found in [dist](/dist/) folder.
4747

48-
Upload a script as a JavaScript Web Resource, place on the entity or refer to it in your HTML Web Resource and then initialize the main object:
48+
Upload a script as a JavaScript Web Resource, place on the entity form or refer to it in your HTML Web Resource and then initialize the main object:
4949

5050
```js
5151
//DynamicsWebApi makes calls to Web API v8.0 if a configuration not set
@@ -153,15 +153,15 @@ returnRepresentation | Boolean | Defaults Prefer header with value "return=repre
153153
webApiUrl | String | A complete URL string to Web API. Example of the URL: "https:/myorg.api.crm.dynamics.com/api/data/v8.2/". If it is specified then webApiVersion property will not be used even if it is not empty.
154154
webApiVersion | String | Version of the Web API. Default version is "8.0".
155155

156-
Configuration property `webApiVersion` is required only when DynamicsWebApi used inside of CRM.
156+
Configuration property `webApiVersion` is required only when DynamicsWebApi used inside CRM.
157157
Property `webApiUrl` is required when DynamicsWebApi used externally.
158-
If both configuration properties set `webApiUrl` will have the highest priority than `webApiVersion`, so the last one will be skipped.
158+
If both configuration properties set then `webApiUrl` will have a higher priority than `webApiVersion`, so the last one will be skipped.
159159

160160
## Request Examples
161161

162-
DynamicsWebApi supports __Basic__ and __Advanced__ calls to Web API.
162+
DynamicsWebApi supports __Basic__ and __Advanced__ calls to Web API.
163163

164-
Basic calls can be made by using functions with most commonly used input parameters. They are most convenient for simple operations as they do
164+
Basic calls can be made by using functions with the most common input parameters. They are convenient for simple operations as they do
165165
not provide all possible ways of interaction with CRM Web API (for example, [conditional retrievals](https://msdn.microsoft.com/en-us/library/mt607711.aspx#bkmk_DetectIfChanged)
166166
are not supported in basic functions).
167167

@@ -214,6 +214,9 @@ As well as multi-level expands are not implemented yet. This situation may be ch
214214

215215
For complex requests to Web API with multi-level expands use `executeFetchXml` function.
216216

217+
Starting from version 1.2.8, all requests to Web API that have long URLs (more than 2000 characters) are automatically converted to a Batch Request.
218+
This feature is very convenient if you are trying to make a call using big Fetch XMLs. No special parameters needed to do a convertation.
219+
217220
### Create a record
218221

219222
```js
@@ -861,10 +864,17 @@ dynamicsWebApi.executeUnboundAction("WinOpportunity", actionRequest).then(functi
861864

862865
### In Progress
863866

864-
- [X] get all pages requests, such as: countAll, retrieveMultipleAll, fetchXmlAll and etc. Implemented in v.1.2.5.
865-
- [ ] overloaded functions with rich request options for all Web API operations.
866-
- [ ] "formatted" values in responses. For instance: Web API splits information about lookup fields into separate properties, the config option "formatted" will enable developers to retrieve all information about such fields in a single requests and access it through DynamicsWebApi custom response objects.
867+
- [X] Overloaded functions with rich request options for all Web API operations.
868+
- [X] Get all pages requests, such as: countAll, retrieveMultipleAll, fetchXmlAll and etc. Implemented in v.1.2.5.
869+
- [X] Web API requests that have long URL (more than 2000 characters) should be automatically converted to batch requests.
870+
Feature is very convenient for big Fetch XMLs. Implemented in v.1.2.8.
871+
- [ ] Web API Authentication for On-Premise instances.
867872
- [ ] Intellisense for request objects.
873+
- [ ] "Formatted" values in responses. For instance: Web API splits information about lookup fields into separate properties,
874+
the config option "formatted" will enable developers to retrieve all information about such fields in a single requests and access it through DynamicsWebApi custom response objects.
875+
- [ ] Batch requests.
876+
- [ ] Use entity names instead of collection names. I have not done an investigation about it but if you, by any chance, know how to do that,
877+
I will be very grateful for an advice! Quick guess, does it work like in English language?
868878

869879
Many more features to come!
870880

lib/requests/helpers/parseResponse.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var dateReviver = require('./dateReviver');
22

3+
//https://github.com/emiltholin/google-api-batch-utils
34
function parseBatchResponse(response) {
45
// Not the same delimiter in the response as we specify ourselves in the request,
56
// so we have to extract it.

lib/requests/sendRequest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = function sendRequest(method, uri, config, data, additionalHeade
6565
}
6666

6767
//if the URL contains more characters than max possible limit, convert the request to a batch request
68-
if (uri.length > 2083) {
68+
if (uri.length > 2000) {
6969
var batchBoundary = 'dwa_batch_' + generateUUID();
7070

7171
var batchBody = [];

tests/common-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ describe("sendRequest", function () {
12861286
describe("when url is long, request is converted to batch", function () {
12871287
var scope;
12881288
var url = 'test';
1289-
while (url.length < 2085) {
1289+
while (url.length < 2001) {
12901290
url += 'test';
12911291
};
12921292
var rBody = mocks.data.batch.replace('{0}', mocks.webApiUrl + url);

0 commit comments

Comments
 (0)