How to get the activity name from activity code in google fit - google-fit

I am working with google fit . I have activities int value, I want to get the name of the activity from int value.

We can done with following method of Fittness activity
FitnessActivities.getName(activitycode);
Reference

Related

In testrail API how do I get project_id from case data?

I am trying to add a run with the add_run endpoint, but in my automation code I only have the test cases ids but not the project id (which according the the docs is mandatory).
Right now I am doing:
get all projects with /get_projects
get all cases /get_cases/{project_id}
Then I loop over the cases I get and add the project_id to the case so I could create an add_run with the proper project_id.
This seems like the wrong way to do it.
Anybody has a better solution?
Also is there a way to create a run without a project_id? for example if I have a sanity run that includes cases from many projects.
Any help is appreciated.
You can do the following to get the parent project ID:
get the case by ID and capture value of the suite_id field
get the parent suite by the value of the suite_id field and capture value of the project_id field <--- here you have your project ID and can use it for creating runs.

Google place api search result with place_id returns different location with place_id

I'm using google places api, but it returns the value with different place_id.
I have considered this blog : https://developers.google.com/places/documentation/search
I have requested with place id like this :
https://maps.googleapis.com/maps/api/place/details/json?key=AAIS...
In this url, you can see that the place_id is "EiJ..."
But in the returning json, i have received different place_id.
"place_id" : "AASS...",
"reference" : "df..."
When I have tried with reference, it was the same.
What did I wrong?
Is this the same location with different place_id?
Thanks for your help...
1) Never post your API key on a public forum. Go get yourself a new one.
2) reference has been deprecated, so you don't need to include it
3) EiJG... doesn't look like a Placeid. My guess is that you are trying to look up a value that doesn't exist and you're getting strange behavior.
Run a Place Search and get the Placeid and try again. You haven't posted what you searched for initially so it's impossible to verify that EiJ... really is a valid Placeid.
You can also have more than one place ID associated with a particular place.
In that case, if you request details using one place ID, you can get another ID back (you used the alternate ID, it returns what it considers the primary).
I found your question how to deal with this because I'll be storing information using their primary key and if it changes it will cause issues since the ID initially comes from their search (I'll get the new ID and not realize it is associated with the information I stored).

How should I delete a field with the Profiles library

Suppose you have a complete user entry with al details like department, company name, job title, some custom fields, etc.
How should we delete a field or leave it blank; for example, I if I try to leave blank company name to delete it, I get a "Cannot call method "setCompanyName" of null, so how should deletion of this information should be managed?
With single value fields like Department, CompanyName etc you can set the value to an empty string (not null) to remove the existing value. For example:
profile.setCompanyName('');
For custom fields, use .deleteCustomeField() and fields for which there can be multiple instances use the provided delete methods like .deletePhoneField(). Use them like this:
var phones = profile.getPhones();
for (var i in phones) {
phones[i].deletePhoneField();
}
The ProfilesApp Tests script has examples of all these in unit tests.

Box API: Get_managed_users returning all users

Using the Box 1.0 REST API, I am trying to work with the functions in SOAP UI.
The API doc for get_managed_users with user_id=12345 (internal id retrieved with get_user_id call correctly) is returning all the users. The docs say that would be the case if you do not specify a user_id value. But my full command is: (Token and API key changed to protect the clueless)
https://www.box.com/api/1.0/rest?user_id=27360&auth_token=blahbalhblah1234&action=get_managed_users&api_key=someKeyYouShouldNotSee
Now I could work with the complete result list, but that won't scale as we get thousands of users into the system.
I can make a call with edit_managed_user, using the same user_id value and the change is reflected in the UI, and in the next get_managed_users call. Thus I do have the correct user_id value, I would so assume.
I tried testuser#gmail.com as the user_id value as well, and get the entire list back. This leads me to believe that somehow I am sending user_id wrong, but I just do not see it.
Any hints? Why, with what seems like a valid user_id value is it acting like it is absent or incorrect?
Most likely you have either called this method with an invalid user_id, or one that is not in your set of managed users. Can you double check that the user comes back in your list of already managed users?

Displaying Album Info via JSON Facebook Graph API

I've been looking through the different threads on the Facebook Graph API and displaying the results via JSON. The examples are great but I only want to output the info for a particular album not loop through various results.
Here is a link to the Coca-Cola Wall Photos album. https://graph.facebook.com/99394368305
What I would like to do is display the Name of the Album and the Link.
Any help is much appreciated!
You can choose only the fields you want by specifying the fields query parameter:
https://graph.facebook.com/99394368305/?fields=name,link
From http://developers.facebook.com/docs/reference/api/#reading:
Selection
By default, most object properties are returned when you make a query. You can choose the fields (or connections) you want returned with the "fields" query parameter. For example, this URL will only return the id, name, and picture of Ben: https://graph.facebook.com/bgolub?fields=id,name,picture
You can also request multiple objects in a single query using the "ids" query parameter. For example, the URL https://graph.facebook.com?ids=arjun,vernal returns both profiles in the same response.