error while importing curl request in Postman - rest

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"
}

Related

Kubernetes/OpenShift: Can I patch a node condition status?

I am trying to patch the node condition type status, for example can I turn/replace the Whatever Node Condition type status from false to true and vice versa?
Edit: When I try to patch I am not getting any errors by yet not being updated.
Using Curl - I was able to update:
curl -k -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json-patch+json" -X PATCH APIserver:6443/api/v1/nodes/<node-name>/status --data '[{ "op": "replace", "path": "/status/conditions/-","value": { "type": "WhateverName", "status": "False" }}]'
Patch Example (not working):
oc patch node/<Node-Name> --type='json' -p '[{ "op": "replace", "path": "/status/conditions/0","value": { "type": "QuayState", "status": "True" }}]'
It's not giving errors but it's not changing anything, I am getting this output:
node/<nodeName> patched (no change)

IBM Cloud Secrets Manager: Unable to create an arbitrary secret

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 get Bad Authentication data when I try to send a DM via REST request

After running
curl --request POST
--url https://api.twitter.com/1.1/direct_messages/events/new.json
--header 'authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY", oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE", oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP", oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"'
--header 'content-type: application/json'
--data '{"event": {"type": "message_create", "message_create": {"target": {"recipient_id": "RECIPIENT_USER_ID"}, "message_data": {"text": "Hello World!"}}}}'
I got this error:
{"errors":[{"code":215,"message":"Bad Authentication data."}]} back.
Where do you set your access token & access token secret? And how do you add Quick Replies?
Oh got it! YES!
curl --request POST \
--url https://api.twitter.com/1.1/direct_messages/events/new.json \
--header 'authorization: OAuth oauth_callback="CALLBACK_URL", oauth_consumer_key="KEY", oauth_nonce="auto generated", oauth_signature="autogenerated", oauth_signature_method="HMAC-SHA1", oauth_timestamp="current time stamp", oauth_token="TOKEN", oauth_version="1.0"' \
--header 'content-type: application/json' \
--cookie 'personalization_id=SOME COOKIE; guest_id=SOME ID; lang=en' \
--data '{
"event": {
"type": "message_create",
"message_create": {
"target": {
"recipient_id": "ID"
},
"message_data": {
"text": "What'\''s your favorite type of bird?",
"quick_reply": {
"type": "options",
"options": [
{
"label": "Red Bird",
"description": "A description about the red bird.",
"metadata": "external_id_1"
},
{
"label": "Blue Bird",
"description": "A description about the blue bird.",
"metadata": "external_id_2"
},
{
"label": "Black Bird",
"description": "A description about the black bird.",
"metadata": "external_id_3"
},
{
"label": "White Bird",
"description": "A description about the white bird.",
"metadata": "external_id_4"
}
]
}
}
}
}
}'```

Yahoo Gemini sandbox creation "INVALID_EMAIL_ADDRESS"

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?

Ride wasn't canceled

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?