Remove 'accept: */*' (header) from curl commands generated by Swagger Editor? - openapi

I'm using the online Swagger Editor. When I send a request using "try it out", it generates this curl command:
curl -X 'POST' \
'https://coo.amazonaws.com/' \
-H 'accept: */*' \ # Extra one
-H 'X-Amz-Target: send by me ' \
-H 'Authorization: Bearer "token"' \
-H 'Content-Type: application.1' \
-d '{
"AuthParameters": {
"USERNAME": "John",
"PASSWORD": "James"
},
Remove-H 'accept: */*' from header in the curl command.

Related

How to you insert a confluence macro into a page created by the Confluence Rest Api? Or how to create a page with macro Attachment?

Confluence 6.15.2
I need to insert a macro into an existing page using the REST API.
curl -s -u user:pasw -X POST -H 'Content-Type: application/json'
'-d{"id":"246341155",
"type":"page",
"space":{"key":"TST"},
"body":{"value":"<ac:structured-macro ac:name="attachments"><ac:parameter ac:name="old">false</ac:parameter><ac:parameter ac:name="sortBy">name</ac:parameter><ac:parameter ac:name="upload">true</ac:parameter></ac:structured-macro>","representation":"storage"}}'
https://localhost:8080/rest/api/content/
The response:
{"statusCode":500,"message":"","reason":"Internal Server Error"}
When creating a page with a macro, the same error occurs, the page is not created:
curl -s -u user:pasw -X POST -H 'Content-Type: application/json' -H 'Accept: application/json'
'-d{"type":"page",
"ancestors":[{"id":246324831}],
"title":"New Page",
"space":{"key":"TST"},
"body":{"storage":{"value":"<ac:structured-macro ac:name="attachments"><ac:parameter ac:name="old">false</ac:parameter><ac:parameter ac:name="sortBy">name</ac:parameter><ac:parameter ac:name="upload">true</ac:parameter></ac:structured-macro>",
"representation":"storage"}}}'
'https://localhost:8080/rest/api/content/?os_authType=basic'
Create new page with macro attachment:
curl -s -u user:pasw -X POST
-H 'Content-Type: application/json' -H 'Accept: application/json'
'-d{"type":"page","ancestors":[{"id":**<parent ID>**}],
"title":"New page with macro attach","space":{"key":"TST"},
"body":{"storage":{"value":"<p><ac:structured-macro ac:name=\"attachments\" ac:schema-version=\"1\"><ac:parameter ac:name=\"old\">false</ac:parameter><ac:parameter ac:name=\"sortBy\">name</ac:parameter></ac:structured-macro></p>","representation":"storage"}}}'
'https://localhost:8080/rest/api/content/?os_authType=basic'
Insert into page marco attachment:
curl -s -u user:pasw -X PUT
-H 'Content-Type: application/json'
'-d{"version":{"number":**"2"**},
"title":"Test page for insert macro",
"type":"page",
"body":{"storage":{"value":"<p><ac:structured-macro ac:name=\"attachments\" ac:schema-version=\"1\"><ac:parameter ac:name=\"old\">false</ac:parameter><ac:parameter ac:name=\"sortBy\">name</ac:parameter></ac:structured-macro></p>","representation":"storage"}}}'
https://localhost:8080/rest/api/content/**<cuurent page ID>**

How to make a manual commit by using REST proxy

What I'm trying to do is make a manual commit using the Kafka REST proxy. I'm trying to use this code:
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" -H "Accept: application/vnd.kafka.v2+json" \
--data '{"format": "json", "auto.commit.enable": "false", "auto.offset.reset": "earliest"}' \
http://localhost:8082/consumers/test_consumer
// Subscribe
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" --data '{"topics":["test.sap.pn.add"]}' \
http://localhost:8082/consumers/test_consumer/instances/rest-consumer-587fceb2-2f2c-404f-b71d-c3eb3c678bac/subscription
// Get data
curl -X GET -H "Accept: application/vnd.kafka.json.v2+json" \
http://localhost:8082/consumers/test_consumer/instances/rest-consumer-587fceb2-2f2c-404f-b71d-c3eb3c678bac/records
// commit
curl -X POST -H "Accept: application/vnd.kafka.v1+json, application/vnd.kafka+json, application/json" \
http://localhost:8082/consumers/test_consumer/instances/rest-consumer-587fceb2-2f2c-404f-b71d-c3eb3c678bac/offsets
Which then returns: {"error_code":40403,"message":"Consumer instance not found."}
What am I doing wrong?

fiware-orion notification failure with https

I have a problem with my Fiware-Orion (2.1.0) notifications with Quantum-Leap for managing time-series datas (related to that component quantumleap ).
Both are within Docker containers and using HTTPS.
In orion I create the subscription for Quantum-Leap. It works.
And when I create or update an entity, Orion send me an 200 OK response and the notification never reach Quantum-Leap.
I have nothing in logs.
When I make a request directly to an endpoint using Curl or Postman, the request works. Requests using Orion always fail.
Here is the curl used by Postman to QuantmLeap that works.
curl -X POST \
https://ql1-dev.mydomain.com/v2/notify \
-H 'Accept: application/json' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Fiware-Service: svctestnca' \
-H 'Fiware-ServicePath: /svcpath/testnca' \
-H 'Host: ql1-dev.intranice.ville-nice.fr' \
-H 'Ngsiv2-AttrsFormat: normalized' \
-H 'Postman-Token: 76255023-47e3-44c5-8abf-d184a1dd77f0,adaa68e0-abf4-4fea-855d-39c3469ba1d4' \
-H 'User-Agent: PostmanRuntime/7.11.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'cache-control: no-cache' \
-H 'content-length: 279' \
-d '{
"subscriptionId": "5c62b47f132e5369012c4726",
"data": [
{
"id": "Testnca:testnca1",
"type": "Testnca",
"dateObserved": {
"type": "DateTime",
"value": "2019-02-04T16:19:22.00Z"
},
"mesure": {
"type": "Number",
"value": 2.0
}
}
]
}'
Thanks for help and advices
I tried to use HAProxy like in this Stack-Overfow question and it solves my problem.
Orion always add the port number to my request and I missed that element.
Thank you all and especially StephaneRouxNCA

Can't post in a specific Yammer's group

I'm doing a curl to send a POST in my group, and it doesn't works, it posts on the All Company Network even if I sent the group_id.
curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer OAUTHTOKENHERE" -X POST -d '{"activity":{"actor":{"email":"MYEMAIL"},"action":"create"}}' https://www.yammer.com/api/v1/messages.json?body=TestingfromYammersAPI&group_id=GROUPID
I'm writing the right group_id, and still not reading that argument.
Does anyone has this problem too?
Yammer's API docs:
https://developer.yammer.com/docs/messages-json-post
The problem was that I wasn't quoting the URL -___-
Working code:
curl -H 'accept: application/json' -H 'authorization: Bearer OAUTHTOKENHERE' -H 'content-type: application/json' -X POST -d ' ' 'https://www.yammer.com/api/v1/messages.json?body=MESSAGE_HERE&group_id=GROUP_ID'

Box -> View API -> Can not authenticate to create session

in this site :https://developers.box.com/view/
I do follow the instruction in the example (use Postman or curl)
curl https://view-api.box.com/1/sessions \
-H "Authorization: Token YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"document_id": "ABC123"}' \
-X POST
YOUR_API_KEY is replaced by my api key
ABC123 is replaced by a my pdf file.
But I got result: {"message": "Unsupported media type 'application/json, application/x-www-form-urlencoded' in request.", "type": "error", "request_id": "1f3d91c9489247579c78e7ceaa5e67c8"}
Please help me.
Thank you
It looks like there is an issue with the spaces after your \ characters. If you try:
curl https://view-api.box.com/1/sessions \
-H "Authorization: Token APIKEY" \
-H "Content-Type: application/json" \
-d '{"document_id": "DOCID"}' \
-X POST
It should work.