I have two clusters A and B in project C.
A uses legacy backup and B uses cloud backup.
I am trying to use mongodb atlas API to create a restore job for A to restore to B.
My cli command look like this:
curl --user "<public key>:<private key>" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/< C 's project id>/clusters/<A's cluster name>/restoreJobs?pretty=true" \
--data '
{
"delivery" : {
"methodName" : "AUTOMATED_RESTORE",
"targetGroupId" : "< C 's project id>",
"targetClusterId" : "<B's cluster name>"
},
"snapshotId": "XXXXX"
}'
I got error like this:
{
"detail" : "Received JSON for the delivery attribute does not match expected format.",
"error" : 400,
"errorCode" : "INVALID_JSON_ATTRIBUTE",
"parameters" : [ "delivery" ],
"reason" : "Bad Request"
}%
this is the reference: https://docs.atlas.mongodb.com/reference/api/legacy-backup/restore/create-one-restore-job/
can anyone help with this command? what is incorrect in it?
more details:
I run from UI that A can restore to B. it doesn't matter they have different backup settings.
from reference example, it said using , its incorrect and output error can't recognize id so I used instead.
someone else also has a similar error I had because of syntax error: https://jira.mongodb.org/browse/DOCS-12396, but I cant find there is an error in my command.
Hi I think you are using wrong syntax.
Refer: https://docs.atlas.mongodb.com/reference/api/cloud-backup/restore/create-one-restore-job/
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest --include \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/clusters/{SOURCE-CLUSTER-NAME}/backup/restoreJobs" \
--data '{
"snapshotId" : "{SNAPSHOT-ID}",
"deliveryType" : "automated",
"targetClusterName" : "{TARGET-CLUSTER-NAME}",
"targetGroupId" : "{TARGET-PROJECT-ID}"
}'
Related
We are researching about the Orion Context Broker technology using local Docker containers and trying to integrate the local Context Broker with an external Context Provider.
Specifically, we are trying to retrieve data from this Context provider:
https://streams.lab.fiware.org/v2/entities?type=AirQualityObserved&options=keyValues
Using the headers:
fiware-service: environment
fiware-servicePath: /Madrid
Concretely, our objective is to achieve a registration from our Context Broker to this node of the provider, in order to get some attributes that we don't have in local (in that example, the attribute is called "NO").
The request we are sending for the registration is the following one:
curl -iX POST \
'http://localhost:1026/v2/registrations' \
-H 'Content-Type: application/json' \
-d '{
"description": "Air Quality Madrid",
"dataProvided": {
"entities": [
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}
],
"attrs": [
"NO"
]
},
"provider": {
"http": {
"url": "https://streams.lab.fiware.org"
}
}
}'
Additionally, we have created a local entity with the same id as in the request: Madrid-AirQualityObserved-28079059-latest
After that information, the question is:
Is it possible to include the specific fiware-service and fiware-servicePath headers into the registration request? What is the way to include them?
Thanks in advance.
EDIT:
I've been doing more tests with the following commands:
For registering to the context provider, using the specific headers for the desired service. For now, the local entity is not created in the local context broker.
curl -iX POST \
'http://localhost:1026/v2/registrations' \
-H 'Content-Type: application/json' \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid' \
-d '{
"description": "Air Quality Madrid",
"dataProvided": {
"entities": [
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}
],
"attrs": [
"NO"
]
},
"provider": {
"http": {
"url": "https://streams.lab.fiware.org"
}
}
}'
Then, I've check if the registration has been correctly registered:
curl -X GET http://localhost:1026/v2/registrations \
-H 'fiware-service: environment'
-H 'fiware-servicepath: /Madrid'
Finally, I've tried to retrieve the entity from the provider:
curl -X GET http://localhost:1026/v2/entities/Madrid-AirQualityObserved-28079059-latest \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid'
But the response indicates that there is not any entity for that request. Because of that, I've created the entity in the local context broker, excluding the field that I'm trying to obtain from the provider "NO".
curl -iX POST \
'http://localhost:1026/v2/entities' \
-H 'Content-Type: application/json' \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid' \
-d '
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}'
However, if I consult the entity with the ID Madrid-AirQualityObserved-28079059-latest, I'm receiving the local data, and the field "NO" is not being retrieved from the provider. That is the response (missing the NO field):
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}
What I am doing wrong?
Yes, it's possible.
They are included as regular headers. For instance, if you are using curl, it would be something like -H 'fiware-service: environment' -H 'fiware-servicepath: /Madrid'.
EDIT:
Looking to the query request you are using:
curl -X GET http://localhost:1026/v2/entities/Madrid-AirQualityObserved-28079059-latest \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid'
I see are not incluing the entity type in the query, contrary to the recomendation in the context providers and request forwarding documentantation:
On forwarding, any type of entity in the NGSIv2 update/query matches registrations without entity type. However, the opposite doesn't work, so if you have registrations with types, then you must use ?type in NGSIv2 update/query in order to obtain a match. Otherwise you may encounter problems, like the one described in this post at StackOverflow.
So maybe you should use:
curl -X GET http://localhost:1026/v2/entities/Madrid-AirQualityObserved-28079059-latest?type=AirQualityObserved \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid'
I want to send data in the format json a elasticsearch but I can not do it
I'm using elasticsearch version 7.0.1 and curl 7.64, I'm on windows 10
curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
"name": "John Doe"
}
'
i have this error messages :
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported", "status" : 406
}
curl: (6) Could not resolve host: application
curl: (3) URL using bad/illegal format or missing URL
On Windows, you need to use double quotes everywhere, not single quotes:
curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" -d "{ \"name\": \"John Doe\" }"
I'm trying to run this request
curl -X POST \
'https://*****.visualstudio.com/DefaultCollection/_apis/wit/wiql?=&api-version=1.0' \
-H 'authorization: Basic *****' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: *****' \
-d '{
"query": "SELECT [System.Id] FROM WorkItems"
}'
but I keep getting this error
{"count":1,"value":{"Message":"A value is required but was not present in the request.\r\n"}}
It works as expected on Postman, so I think the request and the server are OK.
I'm trying to follow the first example shown here: https://www.visualstudio.com/en-us/docs/integrate/api/wit/wiql
Am I missing something?
The URL is wrong, remove =& from the REST API url and the url will be like this:
https://*****.visualstudio.com/DefaultCollection/_apis/wit/wiql?api-version=1.
i try to get servers status of distributed version of OrientDB via http rest :
curl --user admin:admin --header "Accept: text/csv" -d "list servers " "http://localhost:2480/command/GratefulDeadConcerts/sql"
doesnt works :
{
"errors": [
{
"code": 500,
"reason": 500,
"content": "com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.list servers\u000d\u000a\u0009DB name=\"GratefulDeadConcerts\""
}
you're sending a list servers command to the sql interpreter while that's not a sql command but a console one.
UPDATE
you can use this
curl --user root:root --header "Accept: text/csv" -d "HA STATUS -servers -output=text" "http://localhost:2480/command/GratefulDeadConcerts/sql"
Run this command to get the results as JSON that contains all servers (nodes) with detailed status and info per server:
curl -X POST --user {{user}}:{{password}} --header "Accept: application/json" \
-d "HA STATUS -servers -db" "{{orientdb-url}}:2480/command/{{database-name}}/sql"
I'm very new to Wildfly but I need to set up automated monitoring of individual deployment status via the API.
In the same way that I can view the server state with curl, eg:
curl --insecure --digest 'https://admin:password#localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","name":"server-state","json.pretty":1}'
Will return:
{
"outcome" => "success",
"result" => "running"
}
In the same way the from the jboss-cli, I issue:
:read-attribute(name=server-state)
And get the same result.
So, from the CLI, if I issue the following command to get the status of a specific deployment:
/deployment=bob :read-attribute(name=status)
I get the following result:
{
"outcome" => "success",
"result" => "OK"
}
But I can't work out what curl command will give me that result. I've read through a tonne of documentation and either it doesn't exist or I'm looking in the wrong spot. I've tried:
curl --insecure --digest 'https://password#localhost:9993/management' --header "Content-Type: application/json" -d '{"deployment":"bob","operation":"read-attribute","name":"status","json.pretty":1}'
but that didn't work. Any ideas?
Thanks,
Mark J.
You need to add an array for the address attribute and move the "deployment":"bob" in the array.
curl --insecure --digest 'https://password#localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute", "address":[{"deployment":"bob"}],"name":"status","json.pretty":1}'
The address is a name/value pair object for the path the attribute you want to read. For example if you wanted to see the all the handlers associated with the root logger you could execute the following.
curl --insecure --digest 'https://password#localhost:9993/management' --header "Content-Type: application/json" -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"root-logger":"ROOT"}],"name":"handlers","json.pretty":1}