Curl - Make a voice call with a timeout in using sinch - sinch

How can I make a missed call or a call with a time out using sinch .
using a curl request
Before a call I should able to select a DID which I already have .
Example :
curl --user "applicationyour_app_key:your_app_secret" --data '{"message":"your_message"}' -H 'Content-Type: application/json' https://messagingapi.sinch.com/v1/sms/the_phone_number
Above shows a query for SMS . Here my question is how to make the call with a time duration of 1 sec after ring using a DID

Send the SMS with you backend from you client when you receive the calldidend event with reason noanswer. if you tell me what plattforms you are using I could give you sample code

Related

Why does my SuiteQL POST request work when I use Postman, but when I cURL the same code in VS Code terminal, it returns 'INVALID_LOGIN'

I'm trying to use SuiteQL to query a workbook for a client implementation, but I'm having trouble getting it to work in VS Code. I downloaded the Postman environment template and collections archive from the SuiteTalk tools download page and then sent a test request. It returned a successful JSON response. I then tried to send the same sample request using cURL in the VS Code terminal, then with node-fetch, and then using an npm library called netsuite-rest. All of these return 401 'INVALID_LOGIN'. Why does it work when I use Postman, but nowhere else? Here's a sample of my cURL request:
curl --location --request POST 'https://<ACCOUNT_ID>.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=5' \
--header 'prefer: transient' \
--header 'Content-Type: application/json' \
--header 'Authorization: OAuth realm="<ACCOUNT_ID>",oauth_consumer_key="<CONSUMER_KEY>",oauth_token="<TOKEN>",oauth_signature_method="HMAC-SHA256",oauth_timestamp="<TIMESTAMP>",oauth_nonce="<NONCE>",oauth_version="1.0",oauth_signature="<SIGNATURE>"' \
--header 'Cookie: NS_ROUTING_VERSION=LAGGING' \
--data-raw '{
"q": "SELECT id, companyName, email, dateCreated FROM customer WHERE dateCreated >= '\''01/01/2019'\'' AND dateCreated < '\''01/01/2020'\''"
}'
I see this is an old thread however, I myself am just getting started with NetSuite and Postman. For me, the netsuite Postman query will work fine when you get your access token and this will work for a short period of time. Eventually it will fail and at that time you need to use your refresh token to get a new access token. Then, add the fresh access token into your query authorization as a bearer token - and then the query will start working again.
Once it is actively working then there is a magic Area of postman = Code Snippet. So click on that and then notice that there is a pulldown menu of many code bases - that will display the entire code request for your query! For example you could choose nodeJS - Axios - and just copy the code and paste it in to your webpage.
The one thing you will have to remember is that the access token Will expire after a period of time and then you will have to replace the access token with a fresh one (using the refresh token).

Mailchimp API: Unable to trigger Events with umlauts in properties

I’m using the Mailchimp Events API to trigger events on the members in our Audience list. In general the API works as expected: When I send an event, I can see the event's name and properties in the member’s activity.
However, if any of the properties in the Event contain German umlauts, it doesn’t work. It records the event on the member but without the properties.
For example: When the event is triggered as follows:
curl --location --request POST 'https://us4.api.mailchimp.com/3.0/lists/1234/members/12343124/events' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'Authorization: Basic TED' \
--data-raw '{
"name": "test-event",
"properties": {
"link": "Münich"
}
}'
The event is records under the member's activity but without the properties.
Hope someone could help me out with this.
Thanks in advance.
Turns out Mailchimp Event API endpoints don't support it.
This was the response from Mailchimp API's support team:
Currently, using special characters in data passed over in relation to the Events endpoint is not supported. Our developers are aware and we're tracking feedback as a fix is in the works. I don't have a current ETA for that, unfortunately. The best option at this time is the avoid using special characters whenever possible, and please send any specific occurrences of this that you see our way so we can add them to our tracking.

How to send XML file request using Capybara, and check response for correct parameters

I am writing acceptance tests using capybara/rspec. And I want in one of my tests send request using XML file and check that it got correct parameters in response. Do you know how I can write it please?
For now I send my request using curl.
curl -X POST -H 'Content-Type: application/xml' -H 'Authorization: Basic example' http://example/example --data-binary #request.xml
But I want to automate it using Capybara/rspec
You don't do this with Capybara. Capybara is used for tests that replicate what a user would do via a browser. As such it interacts with elements in the browser and the page generates the requests a user would trigger. For what you want to test you should be looking at request specs (they don't use Capybara) which are aimed at testing APIs, etc. and allow for posts of random data to endpoints - https://relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec

how to send multipart/form-data via InvokeHttp NiFi

I have a 3rd party REST, which I am successfully able to call like this using CURL (shell). This API return JSON. I tried calling same API, by changing content type to application/x-www-form-urlencoded but it doesn't work. I think I am forced to use content-type: multipart/form-data
curl --request POST --url https://************************* --header 'Authorization: Bearer ********' --header 'content-type: multipart/form-data; ' --form cluster_id=0717-035521-puny598 --form start_time=1534357800000 --form end_time=1534444199999 --form order=ASC --form limit=500
Now I want to call same API using InvokeHTTP processor (NiFi). So I configured it as follows. But I am not able to do a successful call. (it is not a proxy issue).
Following is how I am creating POST body (by FF)
I have tried replacing "enter" by \r\n etc, or changing body as name1=val1&name2=val2&.... etc. nothing worked.
This is the response I am getting.
[
I am able to run CURL (shell, from same server where Nifi is running). Also I am able to access url via postman.
[
finally, it worked. flow is somewhat like this.
GenerateFlowFile->UpdateAttribute->AttributesToJSON->InvokeHTTP
Only change, I made to InvokeHTTP. reverted content-type back to ${mime.type}.
I was struggling with this for a few hours. I've got a backend API that has
ResponseEntity<ByteArrayResource> post (#RequestPart("file") MultipartFile file) and a NiFi processor that sends XLSX data to this. I was getting the same issue... The key for me were the bottom two properties:
FlowFile Form Data Name -> file (this is the name of the variable in the API call)
Set Flowfile Form Data File Name -> true

PARSE API Push Notifications with Embedded C

I was able to successfully follow the Embedded C guide to set up my device with the PARSE API and send a test push to it, but I'm having an issue registering the device for custom push notifications. When I go to the Push page and try to "Send a push" I get a message saying "No Registered Devices". I assume that this has to do with the fact that the device does not register to any channels using the provided sample code. The API documentation lacks severely on the ParseClient class and therefore I am left wondering how one would achieve this?
Can the parseSendRequest function be used to modify fields in the Installation class?
The goal here is to be able to send custom push notifications to the said device, any sample code would be greatly appreciated.
Thanks!
After some trial and error this seemed to work for me to send non-targetted pushes like the button on the getting started page:
curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": "embedded"
},
"data": {
"alert": "Hello World!"
}
}' https://api.parse.com/1/push
It does not quite answer your question of how to properly register the device but you can at least send custom push notifications.

Resources