How to get a list of RingCentral Contact Center Routing Numbers via API? - phone-number

RingCentral has a type of phone number called Contact Center Routing Number (CCRN) which is used with RingCentral Office and Contact Center. Is it possible to get a list of these numbers via API?
In the Online Account Portal, these numbers are found under:
"Phone System" > "Phone Numbers" > "Contact Center".
I looked in the RingCentral API Reference but didn't see a section for Contact Center.

To add to Grokify's answer above, these are the contactCenterProvider IDs:
1 = In-Contact NA
2 = In-Contact EU
3 = In-Contact APAC
4 = In-Contact AUS

A list of Contact Center Routing Numbers (CCRNs) can be retrieved using the List Account Phone Numbers API documented here:
https://developers.ringcentral.com/api-reference/Phone-Numbers/listAccountPhoneNumbers
CCRN Phone Numbers will have usageType set to ContactCenterNumber.
When querying the API, the usageType query string parameter can be set to filter results. In the response, the same parameter is present in the phone numbers records.
The contactCenterProvider property is populated for CCRNs as shown below:
Here's an example:
GET /restapi/v1.0/account/11111111/phone-number?usageType=ContactCenterNumber&perPage=10
HTTP 200 OK
{
"uri" : "https://platform.ringcentral.com/restapi/v1.0/account/11111111/phone-number?page=1&perPage=10",
"records" : [ {
"uri" : "https://platform.ringcentral.com/restapi/v1.0/account/11111111/phone-number/22222222",
"id" : 22222222,
"phoneNumber" : "+18005550100",
"paymentType" : "TollFree",
"type" : "VoiceOnly",
"usageType" : "ContactCenterNumber",
"status" : "Normal",
"contactCenterProvider": {
"id": "1",
"name": "In-Contact NA"
}
} ]
}
It is possible to update the phone number's contactCenterProvider as shown:
PUT /restapi/v1.0/account/11111111/phone-number/22222222
{
"usageType": "ContactCenterNumber",
"contactCenterProvider": {
"id": "3"
}
}
Update Response:
{
"uri" : "https://platform.ringcentral.com/restapi/v1.0/account/11111111/phone-number/22222222",
"id" : 22222222,
"phoneNumber" : "+18005550100",
"paymentType" : "TollFree",
"type" : "VoiceOnly",
"usageType" : "ContactCenterNumber",
"status" : "Normal",
"contactCenterProvider": {
"id": "3",
"name": "In-Contact APAC"
}
}

Related

Multiple Joins In CouchDB

I am currently trying to figure out if CouchDB is suitable for my use-case and if so, how. I have a situation similar to the following:
First set of documents (let's call them companies):
{
"_id" : 1,
"name" : "Foo"
}
{
"_id" : 2,
"name" : "Bar"
}
{
"_id" : 3,
"name" : "Baz"
}
Second set of documents (let's call them projects):
{
"_id" : 4,
"name" : "FooProject1",
"company" : 1
}
{
"_id" : 5,
"name" : "FooProject2",
"company" : 1
}
...
{
"_id" : 100,
"name" : "BazProject2",
"company" : 3
}
Third set of documents (let's call them incidents):
{
"_id" : "300",
"project" : 4,
"description" : "...",
"cost" : 200
}
{
"_id" : "301",
"project" : 4,
"description" : "...",
"cost" : 400
}
{
"_id" : "302",
"project" : 4,
"description" : "...",
"cost" : 500
}
...
So in short every company has multiple projects, and every project can have multiple incidents. One reason I model the data is, that I come mainly from a SQL background, so the modelling may be completely unsuitable. The second reason is, that I would like to add new incidents very easily by just using the REST-API provided by couchdb. So the incidents have to be single documents.
However, I now would like to get a view that would allow me to calculate the total cost for each company. I can easily define a view using map-reduce and linked documents which get's me the total amount per project. However once I am at the project level I cannot get any further to the level of the company.
Is this possible at all using couchDb? This kind of summarising data sounds like a perfect use case for map-reduce. In SQL I would just do a three-table join, but it seems like in couchDb the best I can get is two-table joins.
As mentioned you cannot do joins in CouchDb but this isn't a limitation, this is an invitation to both think about your problems and approach them differently. The correct way to do this in CouchDb is to define data structures called for example : IncidentReference composed of :
The project id
And the company id
That way your data would look like :
{
"_id" : "301",
"project" : 4,
"description" : "...",
"cost" : 400,
"reference" : {
"projectId" : 1,
"companyId" : 2
}
}
This is just fine. Once you have that, you can play with Map/Reduce to achieve whatever you want easily. Generally speaking, you need to think about the way you are going to query your data.

Messages from ValidationMessages.properties in generated JSON

I'm using the ValidationRulesServlet to generate valdr JSON for my APIs. Currently the generated JSON looks like this:
{
"Person" : {
"firstName" : {
"size" : {
"min" : 2,
"message" : "{javax.validation.constraints.Size.message}",
"max" : 2147483647
},
"required" : {
"message" : "{javax.validation.constraints.NotNull.message}"
}
},
"lastName" : {
"size" : {
"min" : 2,
"message" : "{javax.validation.constraints.Size.message}",
"max" : 20
},
"required" : {
"message" : "{javax.validation.constraints.NotNull.message}"
}
}
}
}
I'm using Jersey for my REST services and I want the messages in the above JSON to be replaced with values from ValidationMessages.properties.
My ValidationMessages.properties is located in classpath (src/main/resources) and is used correctly by Jackson. This can be confirmed by calling a REST endpoint with an invalid value. Here is an example response:
[
{
"message": "Must be between 2 and 2147483647 characters",
"messageTemplate": "{javax.validation.constraints.Size.message}",
"path": "PersonServiceImpl.updatePerson.arg0.firstName",
"invalidValue": ""
}
]
The corresponding message in my ValidationMessages.properties is
javax.validation.constraints.Size.message = Must be between {min} and {max} characters
How can I get the valdr JSON to output messages from ValidationMessages.properties rather than e.g. {javax.validation.constraints.Size.message}?
You can't, at least not out of the box. The reason is pretty obvious if you check the Bean Validation spec or look at the Constraint Javadoc:
Each constraint annotation must host the following attributes:
String message() default [...]; which should default to an error message key made of the fully-qualified class name of the constraint
followed by .message. For example
{com.acme.constraints.NotSafe.message}
So, in essence "message" : "{javax.validation.constraints.Size.message}" in the valdr constraint JSON signifies the message key rather than the actual validation message. It'd IMO be more sensible to call the JSON property messageKey to make this very clear but we wanted to stick with the Bean Validation lingo. In fact, all the properties in the JSON are extracted 1-by-1 from the Bean Validation Constraint.
So, you need a way to display "Must be between 2 and 2147483647 characters" in your AngularJS front-end if the Person.firstName.size constraint is violated. valdr achieves that by integrating well with angular-translate.
All you need to do is to make your ValidationMessages.properties available to the front-end and to initialize angular-translate with the messages from that file.

Can't connect user to entity in Apigee Usergrid

When using the IOS API, I'm making a call to connect via the ApigeeDataClient connectEntities method. I pass in the type "users", then the user's uuid, then connectionType "likes", with the connectee type of "songs" and the song's uuid.
Example:
ApigeeClientResponse *response = [_dataClient connectEntities:#"users" connectorID:_apigeeUser.uuid connectionType:#"likes" connecteeType:#"songs" connecteeID:song.uuid];
When I make the connection, it says successful, but when I look at the data on the server, it seems to save the connection incorrectly. For example, for the song, I see:
connecting :likes :/songs/b523a6aa-bb39-11e4-a2bb-35673af856e9/connecting/likes
It looks like the song's uuid isn't in the connecting path.
The same is true for the connection related to the user. It's the user's uuid that seems to be connected to the same user. The uuid is that of the song's uuid, not the user's. When I make the call to getEntityConnections, like so:
ApigeeClientResponse *response = [_dataClient getEntityConnections:#"songs" connectorID:_apigeeUser.uuid connectionType:#"likes" query:nil];
It returns an error, saying "expected song, but got user's uuid.
Entity c831e1c4-2e6e-11e4-94ce-299efa8c6fd5 is not the expected type, expected song, found user"
In looking in Apigee itself, in the data section, I see the following snippet:
"connections": {
"likes": "/users/c831e1c4-2e6e-11e4-94ce-299efa8c6fd5/likes"
}
The song's uuid is missing. Even when I try to update the JSON directly on the server, basically adding the song's uuid to the end, it says it's saved, but it removes the song's uuid.
Even just using the curl method to make a connection doesn't work. For example:
curl -X POST http://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f177‌​9d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6
When I make that call, I get this
{"action":"post",
"application":"0baaf590-2c1b-11e4-9bb5-11cb139f1620",
"params":{
},
"path":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes",
"uri":"https://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes",
"entities":[
{
"uuid":"c37f1eaa-bfa3-11e4-9141-97b3510c98e6",
"type":"song",
"name":"WingSpan",
"created":1425167080842,
"modified":1425167080842,
"bpm":"124",
"code":"WingSpan",
"genre":"Progressive House",
"metadata":{
"connecting":{
"likes":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6/connecting/likes"
},
"path":"/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes/c37f1eaa-bfa3-11e4-9141-97b3510c98e6"
},
"title":"Wing Span"
}
],
"timestamp":1425246006718,
"duration":78,
"organization":"peterdj",
"applicationName":"sandbox"
}
Notice that the resulting connecting path seems correct when it's returned, but when do another GET curl, as so:
curl http://api.usergrid.com/peterdj/sandbox/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d
The song's uuid isn't there:
{
"action" : "get",
"application" : "0baaf590-2c1b-11e4-9bb5-11cb139f1620",
"params" : { },
"path" : "/users",
"uri" : "https://api.usergrid.com/peterdj/sandbox/users",
"entities" : [ {
"uuid" : "bc2fc82a-bfa3-11e4-a994-b19963f1779d",
"type" : "user",
"name" : "peter",
"created" : 1425167068578,
"modified" : 1425167495412,
"username" : "peterdj",
"email" : "asdf#adf.com",
"activated" : true,
"picture" :"",
"metadata" : {
"path" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d",
"sets" : {
"rolenames" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/roles",
"permissions" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/permissions"
},
"connections" : {
"likes" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/likes"
},
"collections" : {
"activities" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/activities",
"devices" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/devices",
"feed" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/feed",
"groups" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/groups",
"roles" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/roles",
"following" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/following",
"followers" : "/users/bc2fc82a-bfa3-11e4-a994-b19963f1779d/followers"
}
}
} ],
"timestamp" : 1425311662762,
"duration" : 12,
"organization" : "peterdj",
"applicationName" : "sandbox"
}
Is this a bug with the entity connections with Apigee/Usergrid or am I doing something wrong?
Thanks
Well, turns out, thanks to the comments by #remus, I've figured it out.
In this call:
ApigeeClientResponse *response = [_dataClient getEntityConnections:#"songs" connectorID:_apigeeUser.uuid connectionType:#"likes" query:nil];
The connection needs to be "users", not "songs". Works now. Thanks #remus

ElasticSearch writing query for priority search

I am new to elastisearch and I just set it up and tried default search. I am using elasticsearch rails gem. I need to write custom query with priority search (some fields in table are more important then others, etc. title, updated_at in last 6 months...). I tried to find explanation or tutorial for how to do this but nothing seems understandable. Can anyone help me with this, soon better.
Never having used the ruby/elasticsearch integration, it doesn't seem too hard... The docs here show that you'd want to do something like this:
client.search index: 'my-index', body: { query: { match: { title: 'test' } } }
To do a basic search.
The ES documentation here shows how to do a field boosted query:
{
"multi_match" : {
"query" : "this is a test",
"fields" : [ "subject^3", "message" ]
}
}
Putting it all together, you'd do something like this:
client.search index: 'my-index', body: { query: { multi_match : {
query : "this is a test",
fields : [ "subject^3", "message" ]
} } }
That will allow you to search/boost on fields -- in the above case, the subject field is given 3 times the score of the message field.
There is a very good blog post about how to do advanced scoring. Part of it shows an example of adjusting the score based on a date:
...
"filter": {
"exists": {
"field": "date"
}
},
"script": "(0.08 / ((3.16*pow(10,-11)) * abs(now - doc['date'].date.getMillis()) + 0.05)) + 1.0"
...
I have done in php, Never used the gem from Ruby on rails. Here you can give the priority for the fields using the caret (^) notation.
Example:- Suppose if we have fields namely name, email, message and address in table and the priority should be given for the name and message then you can write as below
> { "multi_match" : {
> "query" : "this is a test",
> "fields" : [ "name^3", "message^2".... ] } }
Here name has 3 times higher priority than other fields and message has got 2 times higher priority than other fields.

Is there a way to to see what dates/times tickets changed Status via the JIRA API?

I am trying to run queries against the JIRA API and get results in which I can see the dates and times that each issue went through a status change.
E.g.: Run a query to grab all issues with a certain assignee and see, along with the rest of the information, timestamps for when each issue changed from "Open" to "Resolved".
Is this possible?
EDIT: I have tried expanding the changelog, but while that tells me what status changes a ticket went through (e.g., that the particular ticket transitioned from "Open" to "Resolved" and then from "Resolved" to "Closed"), it doesn't tell me WHEN these transitions occurred.
Turns out that each of the transition objects showing the status changes have a "created" field that contains the time and date the transition occurred, which I feel is a bit of a misnomer, but there it is. An example object inside the "histories" array in the expanded changelog object:
{ "author" : { "active" : true,
"avatarUrls" : { "16x16" : "https://company.jira.com/secure/useravatar?size=xsmall&avatarId=10072",
"24x24" : "https://company.jira.com/secure/useravatar?size=small&avatarId=10072",
"32x32" : "https://company.jira.com/secure/useravatar?size=medium&avatarId=10072",
"48x48" : "https://company.jira.com/secure/useravatar?avatarId=10072"
},
"displayName" : "First Last",
"emailAddress" : "first.last#company.com",
"name" : "first.last",
"self" : "https://company.jira.com/rest/api/2/user?username=first.last"
},
"created" : "2013-04-17T16:21:13.540-0400",
"id" : "24451",
"items" : [ { "field" : "status",
"fieldtype" : "jira",
"from" : "5",
"fromString" : "Resolved",
"to" : "6",
"toString" : "Closed"
},
{ "field" : "assignee",
"fieldtype" : "jira",
"from" : "old.assignee",
"fromString" : "Old Assignee",
"to" : "first.last",
"toString" : "First Last"
}
]
}

Resources