I like to use curl to fetch data from my application insights but i'm unable to get the data from customDimensions (which contains json data). A simple query would be this one:
curl "https://api.applicationinsights.io/v1/apps/my-app-id/query?query=traces%20%7C%20project%20customDimensions" -H "x-api-key: my-api-key"
Let's assume the traces table contains 10 entries then the response would look like this:
{
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "customDimensions",
"type": "dynamic"
}
],
"rows": [
[ null ],
[ null ],
[ null ],
[ null ],
[ null ],
[ null ],
[ null ],
[ null ],
[ null ],
[ null ]
]
}
]
}
Using the query editor in application insights in the azure portal, the same query works fine and returns the customDimensions.
Thanks in advance.
Could you please check the application insights you used in your curl query is the same one you did in query editor in azure portal?
I test it at my side, no problem.
Can you try this portal to query application insight from cURL-
https://dev.applicationinsights.io/apiexplorer/query.
In the Request tab choose cURL and in the query tab just write traces | project customDimensions. It worked for me.In that way you can be sure that querying from cURL will work.
Related
I tried making a GET request to this url:
https://artifactory.xxxxxx.com/artifactory/api/search/dates?dateFields=created&from=1675050197406&name=yyyyy-*.tgz/
but I ran into this error:
{
"errors": [
{
"status": 500,
"message": "Item not found for id '2649778966'"
}
]
}
Thanks in advance.
You can use the AQL (Artifactory Query Language) to search for artifacts in Artifactory by name and last modified date. Here is an example AQL query to search for artifacts with a name starting with "my-artifact" modified after Jan 1, 2022:
items.find(
{
"name": {"$match": "my-artifact*"},
"$and": [
{"modified": {"$gt": "2022-01-01T00:00:00.000Z"}}
]
}
)
In Azure CLI, I can use az deployment sub validate to get detailed output about all the resources in a subscription-level deployment template:
{
"error": null,
"id": "/subscriptions/.../providers/Microsoft.Resources/deployments/main",
"location": "westeurope",
"name": "main",
"properties": {
...
"validatedResources": [
{
"id": "/subscriptions/.../resourceGroups/my-rg"
},
{
"id": "/subscriptions/.../resourceGroups/my-rg/providers/Microsoft.Resources/deployments/logAnalyticsWorkspace",
"resourceGroup": "my-rg"
},
{
"id": "/subscriptions/.../resourceGroups/my-rg/providers/Microsoft.Resources/deployments/identity",
"resourceGroup": "my-rg"
},
...
]
},
"type": "Microsoft.Resources/deployments"
}
The Azure PowerShell equivalent of az deployment sub validate is Test-AzSubscriptionDeployment, but that returns only errors (if any), no list of resource IDs.
How can I get a similar list of resource IDs for the resources defined by a template using Azure PowerShell?
Both of those operations make the same API call to Azure and get the same response back, but as you found, Powershell only returns errors and not the actual API response content.
You can work around by manually calling the API, but it is a bit cumbersome.
$Template = Get-Content -Path template.json | ConvertFrom-Json
$payload = #{location="westus2"; properties=#{template = $Template; mode="Incremental"}} | ConvertTo-Json -Depth 20
$results = Invoke-AzRestMethod -Path "/subscriptions/$subid/providers/Microsoft.Resources/deployments/test/validate?api-version=2021-04-01" -Method POST -Payload $payload
($results.Content | ConvertFrom-Json).properties.validatedResources
I'm interested in the value of one field (Module ID) but there seems to be no way of obtaining this specifically. A complete dump of all field values would also suffice but I haven't succeeded in finding a way to do that either. I've looked at and tried the searches available within the documentation here: https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-SEARCHES
If it helps, I'm trying to query an on-premise installation of Artifactory.
More fields can be added to the AQL using the "include" element.
For example - to list all artifacts under "libs-release-local" repository, including their module names, run the following query:
items.find(
{
"repo":{"$eq":"libs-release-local"}
}
).include("artifact.module")
Response example:
{
"results": [
{
"repo": "libs-release-local",
"path": "org/jfrog/test/multi2/2.17.0",
"name": "multi2-2.17.0.jar",
"type": "file",
"size": 1022,
"created": "2021-09-11T13:51:33.878Z",
"created_by": "deployer",
"modified": "2021-09-11T13:51:33.631Z",
"modified_by": "deployer",
"updated": "2021-09-11T13:51:33.881Z",
"artifacts": [
{
"modules": [
{
"module.name": "org.jfrog.test:multi2:2.17.0"
}
]
}
]
}
]
}
You can find all of the required information under AQL documentation.
I'm using Wordpress as a backend for my Ionic application.
I get all the data I want from my GET request, however I have a "like" system on my website that I would like to implement everytime a user clicks on it, whether he is authenticated or not.
I really don't get how I can update the field based on WP API.
I've set Basic Authentication on my .htaccess, and every time I make a POST request I get rest-cannot-update error.
Here is how the JSON looks like
[
{
"metadata": {
"_edit_lock": [
"1531733011:13"
],
"_edit_last": [
"13"
],
"onesignal_meta_box_present": [
""
],
"onesignal_send_notification": [
""
],
"slider": [
"1"
],
"_post_like_count": [
"2"
],
}
]
Thank you
I've updated my project to Swift 3 from 2.3 and I'm getting an interesting object error for dictionaries. I've tried rewriting this literal in a couple different ways to no luck and looked for answers but none so far posted for 3.0...
let jsonRequest: [String: AnyObject] = [
"requests": [
"image": [
"content": imageData
],
"features": [
[
"type": "LABEL_DETECTION",
"maxResults": 10
],
[
"type":"IMAGE_PROPERTIES",
"maxResults": 1
]
]
]
]
Error displayed:
"Contextual type 'AnyObject' cannot be used with dictionary literal"
Can anyone explain to me what needs to be changed? Thanks!