Sending push using countly API - api

I am trying to send a notification using the countly API ,
I found this in the documentation :
curl --request POST \ --url 'https://try.count.ly/i/pushes/prepare?args.apps=args.apps&args.platforms=args.platforms&args=args&api_key=api_key'
It says that i have to provide args which is a JSON object as string with future message data.
They don't provide any clear documentation about how should this arguments be
Any help would be appreciated

Throughout the system Countly expects a stringified JSON object in args parameter. You can look at how it works by sending a message from dashboard and looking at requests in Chrome developer tools, for example. But here we go:
curl --form 'args={"apps":["57fb679323b5388e28e2c37e"],"platforms":["a"],"tz":false,"test":false}' http://HOST/i/pushes/prepare?api_key=API_KEY
and then
curl --form 'args={"apps":["57fb679323b5388e28e2c37e"],"platforms":["a"],"tz":false,"test":false,"_id":"58cb862e2a16277d4501d787","type":"message","messagePerLocale":{"default":"Message text"},"locales":[{"value":"default","title":"Default","count":1062,"percent":100},{"value":"en","title":"English","count":296,"percent":28},{"value":"ja","title":"Japanese","count":166,"percent":16},{"value":"it","title":"Italian","count":152,"percent":14},{"value":"fr","title":"French","count":152,"percent":14},{"value":"de","title":"German","count":149,"percent":14},{"value":"ko","title":"Korean","count":147,"percent":14}],"sound":"default","source":"dash","date":"2017-03-24T07:00:00.000Z"}' http://HOST/i/pushes/create?api_key=API_KEY
You can also omit first request as described in documentation.

Related

How to compose a curl request correctly for wso2 api manager

Description:
I have configured an API (http://localhost:8280/GPNAPI2/1.0.0) that has Production and Sandbox endpoints (http://sparkgatetest.interfax.ru/iFaxWebService/iFaxWebService.asmx). All I need is to send a curl request to http://localhost: 8280/GPNAPI2/1.0.0, but receive a response from http://sparkgatetest.interfax.ru/iFaxWebService/iFaxWebService.asmx. As I understand it, wso2 am is needed for this, so that several external APIs can be connected to one gateway. I also created a subscription for http://localhost:8280/GPNAPI2/1.0.0.
Steps to reproduce:
I pass a GET request to http://localhost:8280/GPNAPI2/1.0.0 and pass a security token in the request, for example:
curl -X GET "http://localhost:8280/GPNAPI2/1.0.0" -H "accept: */ *" -H "Authorization: Bearer eyJ4NXQiOiJNell4TW1Ga09HWXdNV0kwWldObU5EY3hOR1l3WW1NNBelpUQTR"
Everything is going well. But I don't know how to transfer data to the endpoint in one request: http://sparkgatetest.interfax.ru/iFaxWebService/iFaxWebService.asmx
A request of this type:
curl -c cookies.txt -i -X ​​--location --request POST 'http://sparkgatetest.interfax.ru/iFaxWebService/iFaxWebService.asmx'
--header 'Content-Type: text / xml'
--header 'SOAPAction: http://interfax.ru/ifax/Authmethod'
--data '
<soap: Envelope xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: soap = "http : //schemas.xmlsoap.org/soap/envelope/ ">
<soap: Body>
******
*****
</ soap: Body>
</ soap: Envelope> '
I want to understand how to combine these two requests into one, and whether it needs to be done. After all, my task, when accessing http://localhost: 8280/GPNAPI2/1.0.0, is actually working with http://sparkgatetest.interfax.ru/iFaxWebService/iFaxWebService.asmx
Affected Product Version:
wso2 apim 3.2.0 (We need this particular version, since the customer is using it and, for reasons I do not understand, does not want to switch to version 4.0.0).
Environment details (with versions):
windows 8
Please help me with my problem.
You can follow the documentation to expose your SOAP service as a REST API using API Manager 3.2.0.
Basically, you have to provide your WSDL url in the first step (for example, http://sparkgatetest.interfax.ru/iFaxWebService/iFaxWebService.asmx?wsdl) and then continue as mentioned in the documentation.
If you go to the Resources section in Publisher portal, you'll be able to see SOAPAction header and SOAPRequest body parameters are defined. Also, under the WSDL Definition section in the Publisher you'll be able to see the complete WSDL definition of your SOAP service. If you follow rest of the steps you'll be able to invoke the API by providing necessary header and body parameters through APIM devloper portal.

curl command in Postman

I developed POST api and tried to post via POSTMAN
I create following POST method.
But I send this data, empty data was send to server.
When I check code. the curl method was line breaked.
I guess this is the reason why the empty data was sent.
How can I fix it and send body ?
The following command send body data.
curl --data "loginId=hikaru&password=test" http://localhost:3000/user
line break is difference between them.
Thank you.
As you stated in the comment you like to have the curl generated with
--data "loginId=hikaru&password=test"
Even though this might look like form-data it is a a raw body. To change the curl command generated follow these steps:
change the the body type from form-data to raw
enter loginId=hikaru&password=test as the body then Postman will generate the curl command you like to see

Is there a Cognito SDK that uses the `amazoncognito.com/oauth2/token` endpoint?

Accoding to the following docs, I can exchange a code for an access_token using this curl:
curl -X POST \
https://mysubdomain.auth.us-east-2.amazoncognito.com/oauth2/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'authorization: Basic ...' \
-d 'grant_type=authorization_code&client_id=client_id&code=code&redirect_uri=https%3A%2F%2Fwww.somewhere.com'
https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html
I got this working no problem in Postman. Now I want to replicate this HTTP request in a dotnet core WebApi application and I'm having a very hard time finding any SDK to manage this. I could build and issue HttpRequest + deserialize the response json to models, but I find it hard time believing there isn't some AWS library that handles and maintains this much better than I ever could.
Is there an SDK for the amazoncognito.com/oauth2/token endpoint, preferably for dotnet core?
Unfortunately, not yet. You should use make a native HTTP call with POST method.
Here is the git issue for the same (for Java):
https://github.com/aws/aws-sdk-java/issues/1792

Confluence REST API Authorization Failure

I am trying to use the Confluence REST API to create a page. I am using the curl example off of the documentation found HERE. Every time I try to run a terminal command using this curl I get a response that says 'HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED'. I see that someone else had a similar issue regarding their C# code, but there was never a resolution given. Hopefully someone with experience will be able to tell me what I am doing wrong. My curl is listed below with the sensitive parts replaced in <> format.
curl -u <USER>:<PASSWORD> -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","space":{"key":"<PAGEKEY>"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' https://<SERVER>/wiki/confluence/rest/api/content/ | python -mjson.tool
I was finally able to resolve this. Through a combination of the answer here How to create new page in Confluence using their REST API? and using a login that had the appropriate permissions.

Create an ajax call

i've never used an ajax call,can anybody suggest me to create a jquery ajax call using this api (parse.com),what is H,G?:
curl -X GET \
-H "X-Parse-Application-Id: qS0KLMx5h9lFLGJIpj9qyhM9EEPiTS3VMk" \
-H "X-Parse-REST-API-Key: nh3eoUo9GF2gMhcKJIfIt1Gm" \
-G \
--data-urlencode 'username=cooldude6' \
--data-urlencode 'password=p_n7!-e8' \
https://api.parse.com/1/login
curl is a tool for sending HTTP requests. The -H flag sets a header and -G specifies that the data should be transmitted as a URL query parameter rather than content body. In this case, your command sends an HTTP GET command with the custom headers "X-Parse-Application-Id" and "X-Parse-REST-API-Key". This request was sent to https://api.parse.com/1/login?username=cooldude6&password=p_n7!-e8.
You don't need to become a CURL expert to use Parse; the REST API helps you understand how the Parse API works across the wire, but there are both first and third party APIs for just about every language you would need.
P.S. The Parse docs page helps you by pre-filling the value of X-Parse-Application-Id and X-Parse-REST-API-Key with keys from your actual app. By posting these keys online, others can write code that will look like your app to Parse. Though best practices would suggest you secure your app so that it's OK for these keys to leak (e.g. by setting class-level permissions), you may consider deleting & recreating a new app since it sounds like you are just starting development.