Request parameter RefreshType is not in correct format - json

I try to process my Azure Analysis Service Cube via logic APP:
In HTTP action I have the following body:
{
"inputs": {
"method": "POST",
"uri": "https://northeurope.asazure.windows.net/servers/xxx/models/xxx/refreshes",
"body": {
"refresh": {
"objects": [
{
"database": "ModelName",
"table": "TableName"
}
],
"type": "full"
}
},
"authentication": {
"type": "ActiveDirectoryOAuth",
"authority": "https://login.windows.net",
"tenant": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"audience": "https://*.asazure.windows.net",
"clientId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"secret": "xxxxYjxx7y5xxskHxxxxxxznxxxxxxxxODX+xxxxxxxx"
}
}
}
After runningthis logic app, I get the following error:
{
"statusCode": 400,
"headers": {
"Strict-Transport-Security": "max-age=xxxxxx00; includeSubDomains",
"x-ms-root-activity-id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
"x-ms-current-utc-date": "2/7/2019 9:25:05 AM",
"x-ms-xmlaerror-extended": "Request parameter RefreshType is not in correct format.",
"Date": "Thu, 07 Feb 2019 09:25:05 GMT",
"Server": "Microsoft-HTTPAPI/2.0",
"Content-Length": "294",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"code": "BadRequest",
"subCode": 2,
"message": "Request parameter RefreshType is not in correct format.",
"timeStamp": "2019-02-07T09:25:05.4650388Z",
"httpStatusCode": 400,
"details": [
{
"code": "RootActivityId",
"message": "353ab74e-2793-4ee5-954f-819c851f4cb6"
},
{
"code": "Param1",
"message": "RefreshType"
}
]
}
}
Do you have any Idea, why I get this error message? and How can I solve this problem

Refresh Type is an ENUM which only takes values from below list, Can you make the type to Full and check if works:
Hope it helps.

Related

set-base-url is getting always reset in backend section

I am trying to follow the link below for forwarding my api request to another base url, in Azure API management service, which i had created by importing apis from one azure function app.
https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-deploy-multi-region
my policies look like
<policies>
<inbound>
<base />
<choose>
<when condition="#(context.Request.OriginalUrl.Host.Contains("centralus-01.regional"))">
<set-backend-service base-url="https://apiservtmt.trafficmanager.net/api/" />
</when>
<when condition="#(context.Request.OriginalUrl.Host.Contains("southeastasia-01.regional"))">
<set-backend-service base-url="https://apiservt.trafficmanager.net/api/" />
</when>
<otherwise>
<set-backend-service base-url="https://apiservtmt.trafficmanager.net/api/" />
</otherwise>
</choose>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
but unfortunately even though i set the inbound policy to change the base url, post inbound policy is applied, the url is again getting reset to the original azure function that I had used to associate the apis with the api management.
u can see in the trace log, even after setting it to the base url of my desired choice its getting reset.
I tried every possible policy compbination, but still issue persists, please help.
api-inspector (0.322 ms)
{
"request": {
"method": "GET",
"url": "https://apiservapimt.azure-api.net/xtxs/sds/",
"headers": [
{
"name": "Sec-Fetch-Mode",
"value": "cors"
},
{
"name": "Ocp-Apim-Subscription-Key",
"value": "*****************"
},
{
"name": "Sec-Fetch-Site",
"value": "cross-site"
},
{
"name": "X-Forwarded-For",
"value": "188888888888888"
},
{
"name": "Cache-Control",
"value": "no-cache, no-store"
},
{
"name": "Content-Type",
"value": "text/plain;charset=UTF-8"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Encoding",
"value": "gzip,deflate,br"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.9,de;q=0.8,af;q=0.7"
},
{
"name": "Host",
"value": "apiservapimt.azure-api.net"
},
{
"name": "Referer",
"value": "https://apimanagement.hosting.portal.azure.net/apimanagement/Content/1.0.574.0/apimap//apimap-apis/index.html"
}
]
}
}
api-inspector (0.003 ms)
{
"configuration": {
"api": {
"from": "/",
"to": null,
"version": null,
"revision": "1"
},
"operation": {
"method": "GET",
"uriTemplate": "/jsdhakj/{surveyId}/"
},
"user": "-",
"product": "-"
}
}
cors (0.474 ms)
"Origin header was missing or empty and the request was classified as not cross-domain. CORS policy was not applied."
choose (0.010 ms)
{
"message": "Expression was successfully evaluated.",
"expression": "context.Request.OriginalUrl.Host.Contains(\"centralus-01.regional\")",
"value": false
}
choose (0.003 ms)
{
"message": "Expression was successfully evaluated.",
"expression": "context.Request.OriginalUrl.Host.Contains(\"southeastasia-01.regional\")",
"value": false
}
set-backend-service (0.005 ms)
{
"message": "Backend service URL was changed.",
"oldBackendServiceUrl": "",
"newBackendServiceUrl": "https://apiservtmt.trafficmanager.net/api/",
"request": {
"url": "https://apiservtmt.trafficmanager.net/api/adhsakjd/sds/"
}
}
**set-backend-service (0.005 ms)
"Backend 'apiservt' set to current."**
**Backend
(668.101 ms)↑ Back to top
set-backend-service (0.030 ms)
{
"message": "Backend service URL was changed.",
"oldBackendServiceUrl": "https://apiservtmt.trafficmanager.net/api/",
"newBackendServiceUrl": "https://apiservt.azurewebsites.net/api",
"request": {
"url": "https://apiservt.azurewebsites.net/api/surveys/sds/"
}
}**
set-header (0.019 ms)
{
"message": "Specified value was assigned to the header (see below).",
"header": {
"name": "x-functions-key",
"value": "hjwjrhewj"
}
}
forward-request (0.101 ms)
{
**"message": "Request is being forwarded to the backend service. Timeout set to 300 seconds",
"request": {
"method": "GET",
"url": "https://apiservt.azurewebsites.net/api/surveys/sds/",
"headers": [**
{
"name": "Host",
"value": "apiservt.azurewebsites.net"
},
{
"name": "Request-Id",
"value": "|9ab257c67368465b904f288b38b44118.c248de116fca4824_83e3e6e7."
},
{
"name": "Sec-Fetch-Mode",
"value": "cors"
},
{
"name": "Ocp-Apim-Subscription-Key",
"value": "wrewrwer"
},
{
"name": "Sec-Fetch-Site",
"value": "cross-site"
},
{
"name": "X-Forwarded-For",
"value": "shakjdhkjsa"
},
{
"name": "Cache-Control",
"value": "no-cache, no-store"
},
{
"name": "Content-Type",
"value": "text/plain;charset=UTF-8"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Encoding",
"value": "gzip,deflate,br"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.9,de;q=0.8,af;q=0.7"
},
{
"name": "Referer",
"value": "https://apimanagement.hosting.portal.azure.net/apimanagement/Content/1.0.574.0/apimap//apimap-apis/index.html"
},
{
"name": "Request-Context",
"value": "appId=cid-v1:552f0e64-cebd-4730-b0b8-8cf0a0fa6caf"
},
{
"name": "x-functions-key",
"value": "shdsajdhskjf"
}
]
}
}
forward-request (667.950 ms)
{
"response": {
"status": {
"code": 401,
"reason": "Unauthorized"
},
"headers": [
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Request-Context",
"value": "appId=cid-v1:552f0e64-cebd-4730-b0b8-8cf0a0fa6caf"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Date",
"value": "Tue, 24 Sep 2019 17:40:07 GMT"
}
]
}
}
Outbound
(0.146 ms)↑ Back to top
transfer-response (0.050 ms)
{
"message": "Response headers have been sent to the caller."
}
transfer-response (0.096 ms)
{
"message": "Response body streaming to the caller is complete."
}
its resolved now.
there was another set base url policy getting added at each operation level while importing the apis from the azure function. by removing these, picked the parent policy.

Azure API Management latency of over 5 seconds

We're using API Management to execute an always on function app that, in turn, is calling Azure Search. The function app responds within 100 ms (usually well under), but API Management intermittently takes 3 to 8 seconds to process. I've gone through the trace and found the delay is consistently in the backend step in which API Management is processing the results (sample trace for backend below). The returned data in this case is 664 bytes. Does anyone know what may cause this and, more importantly, how to remove this latency?
The Azure API Management instance, function app, and Azure Search are all in the same region.
"backend": [
{
"source": "forward-request",
"timestamp": "2018-10-11T13:33:54.0578250Z",
"elapsed": "00:00:00.0005890",
"data": {
"message": "Request is being forwarded to the backend service. Timeout set to 300 seconds",
"request": {
"method": "GET",
"url": "https://ommitted.azurewebsites.net/api/HollanderSearch/?hollander=125-222L&websiteId=1&retrieveAllProductNames=false&onlyRetrieveProductNames=true&numRecsToRetrieve =25&code=%2Fxu1iz0EimDFnOUvhDVaM4ZejfaW7umV3somaIDCeWJYI5RMIfNnNg%3D%3D&keyword=125-222L",
"headers": [
{
"name": "Ocp-Apim-Subscription-Key",
"value": "ommitted"
},
{
"name": "Postman-Token",
"value": "9e809f11-6e63-4422-8c3f-d61962cec6ac"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Encoding",
"value": "gzip,deflate"
},
{
"name": "User-Agent",
"value": "PostmanRuntime/7.3.0"
},
{
"name": "X-Forwarded-For",
"value": "omitted"
}
]
}
}
},
{
"source": "forward-request",
"timestamp": "2018-10-11T13:33:59.6717259Z",
"elapsed": "00:00:05.6045857",
"data": {
"response": {
"status": {
"code": 200,
"reason": "OK"
},
"headers": [
{
"name": "Pragma",
"value": "no-cache"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Content-Encoding",
"value": "gzip"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Date",
"value": "Thu, 11 Oct 2018 13:33:59 GMT"
},
{
"name": "Expires",
"value": "-1"
},
{
"name": "Set-Cookie",
"value": "ARRAffinity=8065e5ea6c0774f598f30cd38416a122cd6afe1af34a15c7f6430e1a0fe9924c;Path=/;HttpOnly;Domain=omitted-dev.azurewebsites.net"
},
{
"name": "Server",
"value": "Microsoft-IIS/10.0"
},
{
"name": "X-Powered-By",
"value": "ASP.NET"
}
]
}
}
},
{
"source": "decompressor",
"timestamp": "2018-10-11T13:33:59.6717259Z",
"elapsed": "00:00:05.6045976",
"data": "Content-Encoding header with value `gzip` detected in message headers. Content re-compression may require to correctly apply content modification policies."
}
]

Microsoft Graph API Bad request while creating an event

I am trying to create an event in my calendar on Office 365 using Graph API with the following request body,
{
"subject": null,
"body": {
"contentType": "0",
"content": "Event9e890101-30eb-41e1-99ac-aebd453d27a9"
},
"start": {
"dateTime": {
"dateTime": "2018-05-19T11:17:30.2069056-04:00",
"timeZone": "Eastern Standard Time"
}
},
"_end": {
"dateTime": {
"dateTime": "2018-05-19T12:17:30.2119221-04:00",
"timeZone": "Eastern Standard Time"
}
},
"location": { "displayName": "Your office" },
"attendees": {
"type": "0",
"emailAddress": { "address": "email#calendar.onmicrosoft.com" }
}
}
But I get a 400 response,
{
"error": {
"code": "BadRequest",
"message": "Requests must contain extension changes exclusively.",
"innerError": { "request-id": "67884664-d5e8-4502-ad5b-94aa0e538341", "date": "2018-05-16T15:17:47" }
}
}
I am not using any extensions. I tried adding an extension in the request body that didnt work too. Any pointers please?
_end isn't a valid property of an event, it should be end:
},
"end": {

Ajax to retrieve jsonp doesn't work when I call an External URL

I am having an issue getting the data from the json object.
Fist I am getting an error that complain about the json format.
$.ajax({
url: "http://www.test.com&callback=?&format=json",
type: 'POST',
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
})
.done(function(response) {
console.log(response.assets);
})
.fail(function(response) {
console.log(response.assets);
});
Here is the json object. How I can get the
1. Total
2. Document ID
3. Medatadata values
{
"total": "1",
"included": "1",
"start": "0",
"status": "200",
"results": {
"assets": [{
"uri": "/document/id/1c0cf9cb6b8e529c8b1b0a91db37742e",
"context": "51216a3c6b28719c56d0665f538f8e3e",
"id": "1c0cf9cb6b8e529c8b1b0a91db37742e",
"path": "templatedata/rockwellautomation/publication/data/blog/VBTestDCRLocalizationUA_20170510-1102.xml",
"metadata": {
"TeamSite/Metadata/industry": "",
"TeamSite/Metadata/Locale": "en_US",
"TeamSite/Metadata/name_twitter-description": "Test DCR Localization UAT",
"TeamSite/Metadata/property_og-image": "/resources/images/rockwellautomation/share/MPI_IoT_Study_Executive_Summary_2016--photograph_1200w1200h.jpg",
"
}
]
}
}
Your json is wrong. metadata has numerous errors.
Here a good version to make it run.
{
"total": "1",
"included": "1",
"start": "0",
"status": "200",
"results": {
"assets": [{
"uri": "/document/id/1c0cf9cb6b8e529c8b1b0a91db37742e",
"context": "51216a3c6b28719c56d0665f538f8e3e",
"id": "1c0cf9cb6b8e529c8b1b0a91db37742e",
"path": "templatedata/rockwellautomation/publication/data/blog/VBTestDCRLocalizationUA_20170510-1102.xml",
"metadata": {
"TeamSite/Metadata/industry": "",
"TeamSite/Metadata/Locale": "en_US",
"TeamSite/Metadata/name_twitter-description": "Test DCR Localization UAT",
"TeamSite/Metadata/property_og-image": "/resources/images/rockwellautomation/share/MPI_IoT_Study_Executive_Summary_2016--photograph_1200w1200h.jpg"
}
}]
}
}

Json error while trying to use bulk document create on CouchDB(Cloudant) database

Per this https://docs.cloudant.com/document.html#bulk-operations
I am trying to insert multiple documents into my cloudant database but I get an error:
{
"error": {
"statusCode": 400,
"name": "Error",
"request": {
"method": "POST",
"headers": {
"content-type": "application/json",
"accept": "application/json"
},
"uri": "https://XXXXXX:XXXXXX#8f7fc7f0-766b-4429-b060-4ef1c01f7665-bluemix.cloudant.com/ttt/_bulk_docs",
"body": "[{\"name\":\"Nicholas\",\"_id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\"_attachments\":{},\"age\":45,\"gender\":\"male\"},{\"name\":\"Taylor\",\"_id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\"_attachments\":{},\"age\":50,\"gender\":\"male\"},{\"name\":\"Owen\",\"_id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\"_attachments\":{},\"age\":51,\"gender\":\"male\"}]"
},
"description": "couch returned 400",
"scope": "couch",
"reason": "Request body must be a JSON object",
"error": "bad_request",
"stack": "Error: Request body must be a JSON object\n at Request._callback (/nodejsAction/node_modules/cloudant-nano/lib/nano.js:247:15)\n at Request.self.callback (/nodejsAction/node_modules/request/request.js:186:22)\n at emitTwo (events.js:106:13)\n at Request.emit (events.js:191:7)\n at Request.<anonymous> (/nodejsAction/node_modules/request/request.js:1081:10)\n at emitOne (events.js:96:13)\n at Request.emit (events.js:188:7)\n at IncomingMessage.<anonymous> (/nodejsAction/node_modules/request/request.js:1001:12)\n at IncomingMessage.g (events.js:291:16)",
"message": "Request body must be a JSON object",
"errid": "non_200",
"headers": {
"statusCode": 400,
"x-couchdb-body-time": "0",
"cache-control": "must-revalidate",
"uri": "https://XXXXXX:XXXXXX#8f7fc7f0-766b-4429-b060-4ef1c01f7665-bluemix.cloudant.com/ttt/_bulk_docs",
"x-cloudant-backend": "bm-cc-dal-01",
"date": "Sat, 20 May 2017 12:11:37 GMT",
"content-type": "application/json",
"via": "1.1 lb1.bm-cc-dal-01 (Glum/1.34.0)",
"x-couch-request-id": "fed1512052",
"x-content-type-options": "nosniff",
"strict-transport-security": "max-age=31536000"
}
}
}
I took the input Json from the example docs and checked it online JSON validator it seems to be ok.
What I am doing wrong?
It appears that the request body is missing the docs property. The referenced documentation provides this example:
{
"docs": [
{
"name": "Nicholas",
"age": 45,
"gender": "female",
"_id": "96f898f0-f6ff-4a9b-aac4-503992f31b01",
"_rev": "1-54dd23d6a630d0d75c2c5d4ef894454e"
},
{
"_id": "d1f61e66-7708-4da6-aa05-7cbc33b44b7e",
"_rev": "1-a2b6e5dac4e0447e7049c8c540b309d6",
"_deleted": true
}
]
}