Fetch Twilio inbound and outbound prices of a Twilio Phone number when calling/ receiving - twilio

I am trying to find out what are the call prices before make / Receive calls.
Let's say I have a Twilio phone number ABC and customer Phone number XYZ. I want to know the twilio pricing in below scenarios
When Calling from ABC to XYZ, what would be the outgoing price/ minute (Outbound call from Twilio Number)
When calling from XYZ to ABC, what would be the incoming price/ minute (Inbound call to Twilio Number)
I have checked this voice pricing article. There is a REST call mentioned like below.
number = client.pricing.v2 \
.voice \
.numbers('+15017122661') \
.fetch(origination_number='+15108675310')
Response:
{
"country": "United States",
"destination_number": "+15017122661",
"inbound_call_price": {
"base_price": null,
"current_price": null,
"number_type": null
},
"iso_country": "US",
"origination_number": "+15108675310",
"outbound_call_prices": [
{
"base_price": "0.013",
"current_price": "0.013",
"origination_prefixes": [
"ALL"
]
}
],
"price_unit": "USD",
"url": "https://pricing.twilio.com/v2/Voice/Numbers/+18001234567"
}
But I couldn't figure out what exactly this response means.
is the outbound_call_prices means the prices to make calls from +15108675310 to +15017122661?
inbound_call_price means the prices to receive calls from +15017122661 to +15108675310?
Can someone help to understand this.

In the response to the REST call you provided, the outbound_call_prices array shows the current and base prices per minute for making outbound calls from the origination_number (+15108675310 in this case) to the destination_number (+15017122661 in this case).
The inbound_call_price object, on the other hand, shows the current and base prices per minute for receiving inbound calls on the destination_number (+15017122661 in this case) from any phone number.
Note that the outbound_call_prices array may include multiple entries for different calling destinations or number types, depending on the Twilio phone number you are querying and the countries and number types you are calling.

Related

Twilio ratelimit implementation is not seems working

Doc: https://www.twilio.com/docs/verify/api/service-rate-limit-buckets
The doc is not well explained the bottom queries.
1.created ratelimit with the unique name as 'phone_number'
twilio api:verify:v2:services:rate-limits:create \
--service-sid VAxxxxxxxxxxxx \
--description "Limit verifications by End User phone_number" \
--unique-name "phone_number"
Note: --unique-name i have passed as 'phone_number' static string not actual user phone number.. because '+' not allowed also https://www.twilio.com/docs/verify/api/programmable-rate-limits?code-sample=code-start-a-verification-with-a-rate-limit&code-language=Node.js&code-sdk-version=3.x#selecting-properties-to-rate-limit states it is static text combinations
previously i have used my phone number without + symbol.
2.Step 2
created a bucket with max 4 and duration 60
twilio api:verify:v2:services:rate-limits:buckets:create \
--service-sid VAxxxxxxxxxxxxxxxxxxxxxxxxxx \
--rate-limit-sid RK7xxxxxxxxxxxxxxxxxxxxx \
--max 4 \
--interval 60
After this bucket creation i expect to limit the sms sending for all the user based on users phone number ( in 60 second only 4 sms will be send for a user).
But what i can experience that i am receiving all sms which i created message.create().. ratelimit is not seems working..
Q1.is there any issue with the unique name as static text 'phone_number' what i can see is there is no combination of 'phone_number' and
'phone_number_country_code' ?
Ex:--unique-name "phone_number_country_code_and_phone_number"
or unique-name is a parameter that we need to send actual mobile of user?
Q2.if created one bucket with max: 4 duration: 60
second, then in 60 second only 4 sms will be send per user ?
Q3.one bucket and one rate limit enough for an application to handle all
users ?
Q4.if the above step is wrong what is the flow of implementation of this apis?
Q5.3rd api is showing in the doc is send verifications api, is this api is necessary when implementing ratelimits (i assume only create rate-limit and bucket create api are sufficient to enable ratelimit) ?
Q6.if i set bucket max: 4 and duration: 60 , what happen to the 5th sms is scheduled for that user (ex: 5th otp ) is that will deliver in same interval or the next intervel or it will discarded ?
or
let me know the actual sequential flow of ratelimit apis to accomplish the ratelimit to apply to all users. limit: 4 sms per user for specific 60 second interval.
Did you implement the send verification API with the ratelimit option using the unique-name property of the ratelimit?
twilio api:verify:v2:services:verifications:create \
--service-sid VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--rate-limits "{\"phone_number\": \"1234567890\"}" \
--to to \
--channel channel
As I understand it, the purpose of the rate limit is to limit the verification messages. I think the idea is that you create a rate limit and then apply it to a bucket, like you demonstrated. THEN you apply that limit to the verification service using the unique uniqueName and the phone number.

Graph "beta" filtering for date time from audit logs not working (returns all data)

Using the graph explorer, I'm trying to limit (time box) the number of entries being returned. This is so I can extract the data from Azure to upload into our SIEM portal. I am getting the data back (10's of thousands of datapoints) - but I need to time box them.
This works as a query (both in graph explorer and from powershell) - but the results are not in the time frame requested. I've tried different time formats (including down to the second) and they don't limit the results.
It seems like it isn't going deeper into the data structure for the filter to operate on.
Any suggestions on the filter or a different approach (without accepting all the data each query and doing a post-results filter)?
Note: I also tried the activityDateTime prefix with value/ and value\ (reading from a different article I found) - so value/activityDateTime and value\activityDateTime - no different results (no errors either)
This is the 'get' from graph explorer (beta selected)
https://graph.microsoft.com/beta/auditLogs/directoryAudits?=activityDateTime ge 2018-07-16T15:48:00 and activityDateTime lt 2018-07-16T15:58:00
returned this (only partially results, guid/hex strings were removed) - you'll notice that the activityDateTime returned below is not >= and < the date/time passed in the query
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#auditLogs/directoryAudits",
"#odata.nextLink": "https://graph.microsoft.com/beta/auditLogs/directoryAudits?=value%2factivityDateTime+ge+2018-07-16T15%3a48%3a00+and+value%2factivityDateTime+lt+2018-07-16T15%3a58%3a00&$skiptoken=[hex string removed]_1000",
"value": [
{
"id": "Directory_[hex string removed]",
"category": "Core Directory",
"correlationId": "[GUID removed]",
"result": "success",
"resultReason": "",
"activityDisplayName": "Update group",
**"activityDateTime": "2018-07-18T14:30:44.6046176Z"**,
"loggedByService": "AzureAD",
"initiatedBy": {
"user": null,
"app": null
},
"targetResources": [
{
"#odata.type": "#microsoft.graph.targetResourceGroup",
[rest of data returned 1000 total removed]
You need to specify the parameter name. Otherwise, the API has no way of knowing what operation you want (select, orderby, filter). In this case, you want to $filter like this: $filter=activityDateTime ge 2018-07-16T15:48:00Z and activityDateTime lt 2018-07-16T15:58:00Z.
https://graph.microsoft.com/beta/auditLogs/directoryAudits?$filter=activityDateTime ge 2018-07-16T15:48:00Z and activityDateTime lt 2018-07-16T15:58:00Z

Etsy API: Can I get a number of active listings by shop id without paginating through all listing items

I want to know the total number of active listings by shop id. Is there any such API available ?
I could find the API which returns paginated results for all the listings in a shop.
'/shops/:shop_id/listings/active'
I cannot give a limit of over 100 in this API and for fetching total count of all listings, I will have to make a lot of requests is the listings are lets say several thousands. A simple API endpoint that can get the count of total active listings would be really helpful
It's included in the standard response:
{
"count":integer,
"results": [
{ result object }
],
"params": { parameters },
"type":result type
}
Docs can be found here: https://www.etsy.com/developers/documentation/getting_started/api_basics#section_standard_response_format
Got it.
The response contains a count field which gives the exact count of the active listings.
100 is the highest limit you can set—you will need to use the "page" parameter to move to the next 100 and so on.

JIRA REST API 6.01 - listing all groups

I am trying to use JIRA REST API[1] to list all the groups in JIRA. I am currently using JIRA version 6.01 .
I tried /rest/api/2/groups/picker[2] in JIRA REST API 6.01 but could not find a way to specify the parameter "query" as the way I need.
If I use a whole group name in parameter "query", I receive the correct group like this.
Request 1:
GET /jira/rest/api/2/groups/picker?query=jira-users
Response 1
{
"header": "Showing 1 of 1 matching groups",
"total": 1,
"groups": [ {
"name": "jira-users",
"html": "<b>jira-users<\/b>"
}]
}
But if I use a part of the group name in "query" parameter, it does not give expected results.
Request 2
GET /jira/rest/api/2/groups/picker?query=j
According to the method spec [2] I hope to receive all groups that name contains "j" but I do not receive any result.
Response 2
{
"header": "Showing 0 of 0 matching groups",
"total": 0,
"groups": []
}
Can anyone please let me know the right way to give parameters?
Thank you
[1] https://developer.atlassian.com/static/rest/jira/6.0.1.html
[2] https://developer.atlassian.com/static/rest/jira/6.0.1.html#id150432
We're using JIRA 6.0.7 and can do:
/rest/api/2/groups/picker?maxResults=10000
Which will show you all groups up to a max of 10000 results. The the response is important part as it shows the total number of groups, this may require you to adjust the maxResults query parameter that you pass to it if you have too small of a value to show all results:
{
"header":"Showing 5014 of 5014 matching groups",
"total":5014,
"groups":{
...
}
}
If you omit the maxResults it just returns the first 20 out of 5014. However, for us doing:
/rest/api/2/groups/picker?query=j
Will result in all groups containing the letter j to show up. Maybe it wasn't properly implemented in your version. If you are unable to get the query part working properly, you could try and get all results and then do your own filter by analyzing the name for each group object returned.

Is there a limit on the number of followers we can access through the twitter API?

Is there a limit on the number of followers that I can get for a 'user' ( who is not me ) from the Twitter API?
I have written a python script to hit this
URL: https://api.twitter.com/1/followers/ids.json?screen_name=userid
and it returns me a maximum of 5000, for even twitter users who have more than 2,000,000 followers.
I 'm trying to build a recommendation system, so I'd require all the followers of a particular user.
there is only a limit on the number of followers you can retrieve per-page to 5000, as you have discovered.
to retrieve the next 5000 followers and so-on, you need to use the next-cursor=X parameter in your requests. the next-cursor value should be present in your first response.
response example:
{
"previous_cursor": 0,
"ids": [
143206502,
143201767,
777925
],
"previous_cursor_str": "0",
"next_cursor": 0,
"next_cursor_str": "0"
}
example taken from https://dev.twitter.com/docs/api/1/get/followers/ids
There is no limit on the number of follower you can retrieve.
But the number of request you can send to the API has limit.
You can see it on headers of the response:
Example before make 5 calls:
x-rate-limit-limit: 900
x-rate-limit-remaining: 895
Here you can check the limits for each token type (user or app) and the request:
https://dev.twitter.com/rest/public/rate-limits
Here you have information about API Rate Limits:
https://dev.twitter.com/rest/public/rate-limiting

Resources