Fax "from" and "callerId" parameters missing from RingCentral fax API - api

I've been trying to send fax using RingCentral API but there is no way to specify the From fax phone number to send the fax. It is only sending the fax using company fax number. I am not able to find the option to use fax from number. I am using the following end point for sending fax:
https://platform.ringcentral.com/restapi/v1.0/account/:accountId/extension/:extensionId/fax

In the RingCentral system, the From (or sending) fax number is the fax caller ID value. You can update this for your extension to use with your faxes, but the value is not available in the send fax API itself. To change this on a per send basis, you can update the caller ID value before each fax request.
You can update the Fax Caller ID using two approaches:
via API or
using the Online Account Portal (https://service.ringcentral.com), both of which are described below.
Both are described below. Let me know if this works for you.
1) Updating the Fax Caller ID
To update the fax caller ID, call the PUT extension/caller-id endpoint and update the callerId for the FaxNumber feature using the phone number ID of the number you are interested in using. You can get a list of this by calling the extension/phone-number shown in the next section.
PUT /restapi/v1.0/account/{accountId}/extension/{extensionId}/caller-id
Authorization: Bearer {accessToken}
Content-Type: application/json
{
"byFeature": [
{
"feature": "FaxNumber",
"callerId": {
"phoneInfo": {
"id": 33333333
}
}
}
]
}
See the API Reference for more: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefUpdateCallerId
1.1) Listing Your Available Caller ID Numbers
To get a list a list of numbers you can use, call the GET extension/phone-number endpoint:
GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/phone-number
Authorization: Bearer {accessToken}
In your JSON response, you will have a list of phone numbers in the records property. Numbers that you can use will have the following property values:
features property will have the CallerId value
type property will be set to VoiceFax or FaxOnly
The following is the excerpt of a JSON response showing one number. You should have more numbers and a paging object.
{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/phone-number?page=1&perPage=100",
"records":[
{
"id":33333333,
"phoneNumber":"+16505550100",
"paymentType":"Local",
"location":"Belmont, CA",
"type":"VoiceFax",
"usageType":"DirectNumber",
"status":"Normal",
"country":{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/country/1",
"id":"1",
"name":"United States"
},
"features":[
"SmsSender",
"CallerId",
"MmsSender"
]
}
]
}
See the API Reference for more: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefUserPhoneNumbers.html
1.2) Reading The Fax Caller ID Value
RingCentral supports multiple caller ID values. To read the value for your extension make the following API call to the extension/caller-id endpoint:
GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/caller-id
Authorization: Bearer {accessToken}
You will receive a response like the following with an array of caller ID values in the byFeature property. Look for the feature with the feature property set to FaxNumber. I only show the FaxNumber feature caller ID below, but the array includes the following features: CallFlip, FaxNumber, RingMe, RingOut, MobileApp, Alternate.
{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/caller-id",
"byFeature":[
{
"feature":"FaxNumber",
"callerId":{
"type":"PhoneNumber",
"phoneInfo":{
"uri":"https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/phone-number/33333333",
"id":"33333333",
"phoneNumber":"+16505550100"
}
}
}
]
}
See the API Reference for more: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetCallerId
2) Using the Online Account Portal
You can also change the Caller ID value in the Online Account Portal under:
Settings > Outbound Calls > Caller ID > By Feature > Fax Number
More is available in this Knowledgebase Article:
https://success.ringcentral.com/articles/RC_Knowledge_Article/3614

This worked for me when working with the RingCentral Java SDK.
To get the sender/caller numbers list that I can use for my Fax/call
RestClient rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER);
rc.authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);
GetExtensionPhoneNumbersResponse numbers = rc.restapi().account().extension().phonenumber().get();
To update the sender/caller number
RestClient rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER);
rc.authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);
ExtensionCallerIdInfo resp = rc.restapi().account().extension().callerid().get();
for (CallerIdByFeature e : resp.byFeature) {
if (e.callerId.phoneInfo != null) {
e.callerId.phoneInfo.phoneNumber("**********");
}
}
resp = rc.restapi().account().extension().callerid().put(resp);

Related

Can I get the field MobilePhone2 from Outlook Contacts REST API?

I'm using Outlook Contacts REST API in order to get all phone numbers saved for a given contact.
I have to call both versions of the API (v2.0 & beta) so I can get almost all values.
ie. v2.0 send me this:
HomePhones: [ '0333333333', '0444444444' ],
MobilePhone1: '0611111111',
BusinessPhones: [ '0155555555', '0166666666' ],
and beta send me this:
Phones: [
{ Type: 'Home', Number: '0333333333' },
{ Type: 'Business', Number: '0155555555' },
{ Type: 'Mobile', Number: '0611111111' },
{ Type: 'Other', Number: '0677777777' }
],
However, my contact looks like this:
As you can see, both API send me different results, and none of them is complete.
Moreover, the contact I saved in my account has one more phone number, Mobile2, and none of the APIs send it to me.
Is there a way to get it?
Thank you,
bjorge
The API doesn't expose this directly. However, you can always request it as an extended property using the correct MAPI property tag details.
I examined a contact with MFCMapi and I see that the Mobile2 number is stored in PR_CAR_TELEPHONE_NUMBER, which is a string property with the property ID of 0x3A1E. So, since you're using the Outlook REST endpoint, your request would look something like this:
GET /me/contacts?$expand=SingleValueExtendedProperties(
$filter=PropertyId eq 'String 0x3A1E')
If you were using Graph, the request would look a little different:
GET /me/contacts?$expand=singleValueExtendedProperties(
$filter=id eq 'String 0x3A1E')
Finally, I'd recommend voting up this UserVoice request: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/19861435-beef-up-contact-resource-contents-in-rest-api

Auth0 Get userId in response payload?

When a user logins using the Auth0 lock on my client side, I get an idToken, but also an idTokenPayload which looks like this:
idTokenPayload = {
audience: "AUTH0CLIENTID",
exp: 1494190538,
iat: 1494154538,
iss: "AUTH0DOMAIN"
sub: "USERNAME"
};
Would it be possible to return the userId in Auth0's database instead of the username in the sub field?
The reason I want to do this is that I want to keep Auth0's db for users, and I have on my server-side some Profile, Post, Comment etc entities which have a userId column. Right now before each request on my entities I need to populate the user by doing an extra request: let id = Profile.find("... where username === auth0.sub").getId(); (pseudo-code of course).
With the C# lock sdk, you get back an Auth0User after the call to the LoginAsync method in the Auth0 client. Let's call this variable auth0User. If I look at auth0User.Profile, a JObject (it's a JSON object if you're not using C#), it contains a JSON array named "identities". My identities variable initialization looks like:
var identities = (JArray)auth0User.Profile["identities"];
This array contains all the identity providers associated with the user. If like me you haven't attached any other sign in besides Auth0, there will be just 1 entry here. Each object in this JSON array will contain a "provider" string and a "user_id" string. If the provider says "auth0" then it's from Auth0. Since I don't use FB or other account types I'm not exactly sure what they say. Here's my C# code to get the UserID:
var identities = (JArray)auth0User.Profile["identities"];
if (identities != null)
{
foreach (var identity in identities)
{
var provider = (string)identity["provider"];
if (string.Equals(provider, "auth0"))
{
UserID = (string)identity["user_id"];
break;
}
}
}
I believe that this should all be provided standard without needing to add any rules or webhooks. This article should explain in more detail and also gives examples in javascript: auth0 normalized user profile

Twillio , connect between 2 numbers

I am trying to achieve following functionality with twillio.js on client side and ASP.NET Mvc website at the backend.
I need to connect a call between real phone number of sales person and phone number of a potential client.
For example on button click , I need to call potential client , and in a case the client answered , i need to add to the call sales person (that is not using twillio number , using regular landline)
Is it possible to achieve with twillio ?
Karen, hello!
Were you able to achieve what you were looking for with Alex's suggestion of the Click to Call tutorial?
https://www.twilio.com/docs/tutorials/walkthrough/click-to-call/csharp/mvc
The above uses a web form and ajax to send the form asynchronously. Then we handle the POST from our web form and connect the call via the REST API.
/// <summary>
/// Handle a POST from our web form and connect a call via REST API
/// </summary>
[HttpPost]
public ActionResult Call(Contact contact)
{
if (!ModelState.IsValid)
{
return Json(new { success = false, message = (ModelState.Values.First()).Errors.First().ErrorMessage, });
}
var twilioNumber = ConfigurationManager.AppSettings["TwilioNumber"];
// The following line is how you should get the absolute Uri in an internet faced
// server or a production environment
// var handlerUri = Url.Action("Connect", "Call", null, Request.Url.Scheme);
// this line allow us to get the absolute Uri in a local computer using a secure instrospectable
// service like ngrok ;)
var handlerUri = GetTestUri();
_twilioService.CallToNumber(twilioNumber, contact.Phone.Replace(" ", ""), handlerUri);
return Json(new { success = true, message = "Phone call incoming!"});
}
Please let me know if this is helpful for your use case.

Getting results from api

I am trying to do a domain availability search using an API from free domain API.
After i create an account, it shows:
**Make a REST request using this URL:**
http://freedomainapi.com/?key=11223344&domain=freedomainapi.com
And looking in the documentation page, it has only:
Request http://freedomainapi.com?key=YOUR_API_KEY&domain=DOMAIN_NAME
Result:
{
"status": "success",
"domain": "freedomainapi.com",
"available": false
}
I am very new to APIs...
What I need is to show a domain search box, and when the user enters, it should return with result.
It claims to show domain suggestions as well. I hope it will also work.
Using jquery and a jsonp proxy
http://jsfiddle.net/mp8pukbm/1/
$.ajax({
type: 'GET',
url: "https://jsonp.nodejitsu.com/?callback=?",
data: {url: 'http://freedomainapi.com?key=14ejhzc5h9&domain=freedomainapi.com'},
dataType: "jsonp",
success: myfn
});
function myfn(data) {
console.log(data);
}
you have to use the proxy because cross domain json is not permitted
EDIT:
i made an update to show the result in a div (stringified)
http://jsfiddle.net/mp8pukbm/2/
EDIT #2: i created a test key on that site, you have to use your own
EDIT #3: and there's your combo: http://jsfiddle.net/mp8pukbm/4/
Assuming that you will use java script for showing the search box, you can use AJAX feature of java script (or jQuery or Dojo) ... All you need to do is a "GET" request that like you can pasted and you will get the result back on the response object. To try out the API you can use "Postman" application in Chrome. https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en
In the response object of the AJAX call you will get a JSON object which you can parse and display the result.
Normally when we use REST we need to differentiate one REST call from another.
Assuming this url
http://freedomainapi.com/checkAvailability?key=YOUR_API_KEY&domain=DOMAIN_NAME
In Application layer we need to write an interface
#GET
#Path("/checkAvailability")
#Produces({MediaType.APPLICATION_JSON})
public ReturnObject getDomainAvailability(#QueryParam("key") String key,
#QueryParam("domain") String doaminName );
Once interface is done you need to write your implementation class.
This class will intract with business layer and perform search task and based on
result collected will create ReturnObject.
ReturnObject => will contain status, domain and availability
On screen
$.ajax({
type: "GET",
url: 'root/checkAvailability',
success: function(jsonData)
{
// read json and perform operation
}
,
error: function (error)
{
// handle error
}
});
If you are using JAVA as backend then you can use gson to parse the result, which is a json. After parsing you can read the values from result and display accordingly :)
Any API is a way to extend a given software. (Might be a website or an application)
In both ways there is a certain way to communicate with the software. In your example freedomainapi.com allows you to fetch if given domain is avaiable. There is no such thing as a suggestion tho, atleast i cannot find any suggestions at all.
Given output is a message format know as JSON. It can be easily interpreted by many major Languages such as Java, Javascript and PHP.
Given String might be easily interpreted as a Map consisting of a status (String), a domain (string) and avaiable (boolean)
A domain availability search could not be easier, assuming K is your key, D is your search input (Domain):
Download http://freedomainapi.com/checkAvailability?key=K&domain=D as input
Parse JSON from input as json
return json["status"] == "success" and json["avaiable"]
Depending on your language you might need to use methods to access properties of json, but that does not influence the basic usage of this api.
on user enters, it calls click_button function and I am assuming your result displaying div id is "main_container" you can give domain suggestions by passing related DOMAIN_NAME s as arguments to click_button function
function click_button(DOMAIN_NAME){
$.ajax({
url : 'http://freedomainapi.com?key=YOUR_API_KEY&domain=DOMAIN_NAME',
type: 'GET',
crossDomain: true,
contentType: "application/json; charset=utf-8",
success: function(data) {
data=JSON.parse(data);
if(data['available']){
$('#main_container').html($('#main_container').html()+'<br>'+DOMAIN_NAME+': Available');
else{
$('#main_container').html($('#main_container').html($('#main_container').html()+'<br>'+DOMAIN_NAME+': Not Available');
}//success
});//ajax
}
hope it helpful !

How to list all the activities in a specific google domain?

Any ideas on how can I list all the activities in my domain by using the new google+ domain's API in java?
The Developers' Live video shows at 4:00 minute mark that you can do something like this:
Plus.Activities.List listActivities = plus.activities().list("me", "domain");
The Link for this code is here.
But when I actually run the same line of code it shows me the following error.
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "collection",
"locationType" : "parameter",
"message" : "Invalid string value: 'domain'. Allowed values: [user]",
"reason" : "invalidParameter"
} ],
"message" : "Invalid string value: 'domain'. Allowed values: [user]"
}
The error makes sense as in the activities.list documentation it says that "user" is the only acceptable value for collection and not "domain."
So what should I do about this issue?
As you say, the only available way is to list posts by the currently logged user. You have to use user delegation (with service accounts) and loop over all users in the domain in order to get all published activities.
You can use the updated field on the response to check if there is anything new in a user's list of activities.
This line of thought applies to the whole Domains API: every operation is done on behalf of a user, there is no "admin" account with superpowers. This can be a limitation when acting on a big number of users, as you are forced to authenticate for each one in turn (if someone has an idea on how to achieve this in a more efficient way, please share!)
As the documentation sais, only "public" is allowed:
https://developers.google.com/+/api/latest/activities/list
However even using the code provided in the example in the API doc, after going through successful authentication I get 0 activities.
/** List the public activities for the authenticated user. */
private static void listActivities() throws IOException {
System.out.println("Listing My Activities");
// Fetch the first page of activities
Plus.Activities.List listActivities = plus.activities().list("me", "public");
listActivities.setMaxResults(100L);
// Pro tip: Use partial responses to improve response time considerably
listActivities.setFields("nextPageToken,items(id,url,object/content)");
ActivityFeed activityFeed = listActivities.execute();
// Unwrap the request and extract the pieces we want
List<Activity> activities = activityFeed.getItems();
System.out.println("Number of activities: " + activities.size());
// Loop through until we arrive at an empty page
while (activities != null) {
for (Activity activity : activities) {
System.out.println("ID " + activity.getId() + " Content: " +
activity.getObject().getContent());
}
// We will know we are on the last page when the next page token is null.
// If this is the case, break.
if (activityFeed.getNextPageToken() == null) {
break;
}
// Prepare to request the next page of activities
listActivities.setPageToken(activityFeed.getNextPageToken());
// Execute and process the next page request
activityFeed = listActivities.execute();
activities = activityFeed.getItems();
}
}
Anybody know how to get this to work?
when you use Google+ API you must use "public" but when you use Google+ Domains API you must use "user" parameter value.