Trying to create a sandbox as described here:
https://developer.yahoo.com/gemini/guide/navigate-the-api/testing/
After trying all sorts of different things, I've ended up with the exact request from the docs:
curl -X POST \
http://sandbox-api.gemini.yahoo.com/v2/rest/advertisersignup \
-H 'Authorization: Bearer nZ8hzgmc5...' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 03e2855d-3f5f-4780-a8f5-014f16bf1fac' \
-d '{
"advertiserName": "sandbox test"
}'
But I keep getting an "invalid email" error.
{
"errors": [
{
"errIndex": -1,
"code": "E40000_INVALID_INPUT",
"message": "[INVALID_EMAIL_ADDRESS]",
"description": ""
}
],
"response": {
"advertiserName": "sandbox test"
},
"timestamp": "2018-07-30 22:08:07"
}
Am I missing something?
Related
I am trying the following API request for IBM Cloud Secrets Manager, but it fails:
curl -X POST "https://{instance_ID}.{region}.secrets-manager.appdomain.cloud/api/v1/secrets/arbitrary" -H "Authorization: Bearer $IAM_TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
"metadata": {
"collection_type": "application/vnd.ibm.secrets-manager.secret+json",
"collection_total": 1
},
"resources": [
{
"name": "example-arbitrary-secret",
"description": "Extended description for my secret.",
"secret_group_id": "432b91f1-ff6d-4b47-9f06-82debc236d90",
"payload: "secret-data",
"expiration_date": "2030-12-31T00:00:00Z",
"labels": [
"dev",
"us-south"
]
}
]
}'
There was a missing double-quote after payload...
curl -X POST "https://{instance_ID}.{region}.secrets-manager.appdomain.cloud/api/v1/secrets/arbitrary" -H "Authorization: Bearer $IAM_TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" -d '{
"metadata": {
"collection_type": "application/vnd.ibm.secrets-manager.secret+json",
"collection_total": 1
},
"resources": [
{
"name": "example-arbitrary-secret",
"description": "Extended description for my secret.",
"secret_group_id": "432b91f1-ff6d-4b47-9f06-82debc236d90",
"payload": "secret-data",
"expiration_date": "2030-12-31T00:00:00Z",
"labels": [
"dev",
"us-south"
]
}
]
}'
I am trying to test rest api as mentioned here from Postman. I followed this thread here and tried importing the curl request in Postman but it's failing with the following error:
Here is the complete curl command:
curl \
--header "X-OpenIDM-Username: openidm-admin" \
--header "X-OpenIDM-Password: openidm-admin" \
--header "Content-Type: application/json" \
--request PATCH \
--data '[
{
"operation": "add",
"field": "/members/-",
"value": {"_ref" : "managed/user/scarter"}
}
]' \
"http://localhost:8080/openidm/managed/role/cedadaed-5774-4d65-b4a2-41d455ed524a"
{
"_id": "cedadaed-5774-4d65-b4a2-41d455ed524a",
"_rev": "2",
"name": "employee",
"description": "Role granted to workers on the company payroll"
}
I have a file with a list of entities in JSON format:
[
{
"id": "IST-AFRICA-2018_Sensor6",
"type": "Device",
"TC": {
"type": "Sensor",
"value": 24.26,
"metadata": {
...
I can I add them all in one go in Orion?
I tried:
curl -v localhost:1026/v2/op/update -s -S --header 'Content-Type: application/json' --header 'Fiware-Service:waziup' -d '{ "actionType": "APPEND", "entities": `cat file.json`}"
But without success.
I found this solution:
jq -c -r '.[]' entities.json | while read i; do
echo "inserting $i"
echo $i | curl -X POST "http://localhost:1026/v2/entities" -s -S --header 'Content-Type:application/json' -d #-
done
I experienced issue in Uber rides API. Basically what happened was that the ride cancel endpoint returned 204 success response, but ride wasn't canceled.
This was first request:
curl -XDELETE -H 'Authorization: Bearer xxx' \
-H 'Accept-Language: en_US' \
-H 'Content-Type: application/json' \
'https://sandbox-api.uber.com/v1.2/requests/45546b81-cea5-4406-bde6-b574796606b8'
After that I received webhooks with ride canceled status and receipt ready:
{"event_id": "fbba171c-11b9-4081-b473-51ca19c35ceb", "resource_href": "https://sandbox-api.uber.com/v1/requests/45546b81-cea5-4406-bde6-b574796606b8/receipt", "meta": {"status": "ready", "rider_id": "xxx", "user_id": "xxx", "resource_id": "45546b81-cea5-4406-bde6-b574796606b8"}, "event_type": "requests.receipt_ready", "event_time": 1512401098}
{"event_id": "30d9efaa-f8eb-40f8-a0bd-7bf91ea4f7e3", "resource_href": "https://sandbox-api.uber.com/v1/requests/45546b81-cea5-4406-bde6-b574796606b8", "meta": {"status": "rider_canceled", "rider_id": "xxx", "user_id": "xxx", "resource_id": "45546b81-cea5-4406-bde6-b574796606b8"}, "event_type": "requests.status_changed", "event_time": 1512401098}
But when I asked about status later, returned response said that the status of ride is accepted:
curl -H 'Authorization: Bearer xxx' \
-H 'Accept-Language: en_US' \
-H 'Content-Type: application/json' \
'https://sandbox-api.uber.com/v1.2/requests/45546b81-cea5-4406-bde6-b574796606b8'
{"status":"accepted","product_id":"b8e5c464-5de2-4539-a35a-986d6e58f186","destination":{"latitude":40.783062,"eta":4,"longitude":-73.97125},"driver":{"phone_number":"(555)555-5555","rating":4.9,"picture_url":"https:\/\/d1a3f4spazzrp4.cloudfront.net\/uberex-sandbox\/images\/driver.jpg","name":"John","sms_number":null},"pickup":{"latitude":40.759068,"eta":1,"longitude":-73.98496},"request_id":"45546b81-cea5-4406-bde6-b574796606b8","location":{"latitude":40.75898,"bearing":null,"longitude":-73.98478},"vehicle":{"make":"Toyota","picture_url":"https:\/\/d1a3f4spazzrp4.cloudfront.net\/uberex-sandbox\/images\/prius.jpg","model":"Prius","license_plate":"UBER-PLATE"},"shared":false}
When I send cancel request again, it worked. What happened here?
we are testing the subscription functionality using the APIv2. We are following the guidelines described in http://telefonicaid.github.io/fiware-orion/api/v2/ . We are able to create a correct subscription but the format of the notification messages that we received is not what we expected. The format of these messages is like the APIv1 version. Is this the expected behavior?
We are using the Docker image from https://hub.docker.com/r/fiware/orion/.
Version information about the build:
{
"orion" : {
"version" : "1.0.0-next",
"uptime" : "0 d, 1 h, 28 m, 47 s",
"git_hash" : "a729812c45d2749fffbc19add17631b2fffc8797",
"compile_time" : "Fri Apr 8 10:05:55 UTC 2016",
"compiled_by" : "root",
"compiled_in" : "838a42ae8431"
}
}
Steps to reproduce:
Create an entity:
(curl -X POST http://<cb_url>:<cb_port>/v2/entities?options=keyValues -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"type":"Room",
"id": "test",
"humidity":40
}
EOF
Create a subscription:
(curl -X POST http://<cb_url>:<cb_port>/v2/subscriptions -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"description": "One subscription to rule them all",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attributes": [
"humidity"
],
"expression": {
"q": "humidity>40"
}
}
},
"notification": {
"callback": "http://192.168.99.1:5000",
"attributes": [
"humidity"
],
"throttling": 5
},
"expires": "2016-05-05T14:00:00.00Z"
}
EOF
Update attribute.:
(curl -X PUT <cb_url>:<cb_port>/v2/entities/test/attrs/humidity/value -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"value": 50
}
EOF
We get the notification with the following format:
{u'contextResponses': [
{u'contextElement': {
u'attributes': [{
u'name': u'humidity',
u'type': u'none',
u'value': {u'value': 50}
}],
u'id': u'test',
u'isPattern': u'false',
u'type': u'Room'
},
u'statusCode': {
u'code': u'200',
u'reasonPhrase': u'OK'
}}],
u'originator': u'localhost',
u'subscriptionId': u'5707b72882fc213130f4e5b9'}
NGSIv2 notification formats have not been yet implemented (at Orion 1.0.0). Note that NGSIv2 is yet in beta status and sometimes the specification (where the new notification format has been defined) is a step forward the implementation.
There is a github issue about this, to which you can subscribe in order to know when this feature gets implemented.
EDIT: NGSIv2 notification formats have been implemented in Orion 1.1.0.