How to read a Google People api response object [updated] - google-api

I'm new to Google's API and I'm having trouble reading the content of a People contact.
To get the details of a particular contact, references show this code should work [Edit: I updated the personfields]:
profile = service.people().get(resourceName='people/c63810788897573286', personFields='names')
The resourceName is the ID of a particular contact (that ID will only work for someone with access to my account). The server grabs it correctly and returns this:
<googleapiclient.discovery.Resource object at 0x10fd183c8>
How do I read the content of this object? I can't figure out from the documentation
I want to print out the Name. I'm pretty new to APIs, so maybe there is a standard way to read an HTTP object or maybe it's something unique to Google's API. Thanks for any advice

I found an answer in another somewhat related StackOverflow. I needed to the add .execute() to the call
profile = service.people().get(resourceName='people/c63810788897573286', personFields='names').execute()

Related

What is the best way to pull all items with label from Jira programmatically?

I have searched a fair bit and gotten close.
But still struggling to pull the data I want from jira's api.
the api is
https://jira.internal.company.com/rest/api/2/
I can get a reply from it.
Were functional and its behaving as it should.
My struggle is with labels.
What I hope to do is programmatically pull all items in our jira that have the tag "cloud"
and get a json response.
From there the goal will be to write that data to a sqlite3 db and store it in s3 for consumption.
I tried:
https://jira.company.com/rest/api/2/search?jql=labels%20IN%20(%22labelname%22)
But that just returns no values.
Turns out I was silly close:
The update to postman moved my Auth off of basic auth.
This does work:
https://jira.company.com/rest/api/2/search?jql=labels%20IN%20(%22labelname%22)

How to fetch google classroom api's announcements in "swift".

I can get the course list of particular student by signin with the student's credential.
private let scopes = [kGTLRAuthScopeClassroomCourses],
but i need the kGTLRAuthScopeClassroomAnnouncements and have to query using the let query = GTLRClassroomQuery_Announcement.query().
But it is not available for swift classes it seems,
how to get that? Ur help will be very much appreciated.
After a R&D of the client api,the library which is already built in objective C was the clue. I was checking for announcements in that, unfortunately it was missing in my library. So i changed the files which i separately downloaded. Now i got the announcements and also the query. It made me look into the library files deeper.

DynamicsCRM - Search cases (or any other entity) using url querystring

I would like to query Cases on my on-premises DynamicsCRM using a URL querystring.
Something like this:
https://mysvr/foo.aspx?entity=case&query=somecasenumber
I would like to query the field 'Case Number', please notice that it is only an example, anything that can fulfill this need is welcome (since it uses a url to make the query).
I took a look at this link with no luck: https://msdn.microsoft.com/en-us/library/gg328483.aspx
It seems something very straight forward to have but I canĀ“t find any info on this.
Thanks in advance
Nothing like what you're looking for really exists out of the box. What you linked to kind of works if you can go directly to a view that is already filtered to what you want. Otherwise the closest thing would probably be the OData endpoint. For 2013 it would look something like the following HTTP GET:
https://<CRM SERVER URL>/xrmservices/2011/organizationdata.svc/IncidentSet?$filter=TicketNumber%20eq%20%27CAS-00033-Z3K2P7%27
You could paste that into your browser, but the result will be something like the following (depending on the browser) and not the CRM UI
You can open a record via the GUID
https://<CRM URL>/main.aspx?etn=incident&id={<Case GUID>}&newWindow=true&pagetype=entityrecord
Using Matt's answer above can fetch the GUID. (See below code with snipped from the OData endpoint
<id>https://<CRM URL>/XRMServices/2011/OrganizationData.svc/IncidentSet(guid'<Your entities GUID is here>')</id>
Once you have the GUID, the URL will take the user directly into the record.
It's a few more steps than I'd personally like, but using some fancy JavaScript, you can perform the lookup, fetch the GUID and create the URL.
An amazing resource for playing with CRM is the open source Chrome plugin LevelUp for Dynamics CRM. The source code there will give you a start into
https://github.com/rajyraman/Levelup-for-Dynamics-CRM
I am not the cleanest JavaScript coder, so I will not scar your eyes with my "unique style" however I hope I have given you a good starting point.

Resume in articulate with tin-can api

I am trying to implement this endpoint activities/state/?method=GET in my LRS - but I can not seem to get the resume functionality working. I have all the data, but not sure what does Articulate expect the LRS to return in order to resume where the user left off. I also tried looking at Articulate support page, but nothing useful so far. Any help would be appreciated.
It's looking for the state string to be returned. Which is just a long string that is sent out when the state ( bookmark ) is saved.
I recommend testing with the Golf Prototype at http://tincanapi.com/prototypes/ first so that you know the issue is with the LRS. Try the prototypes in both Internet Explorer and another browser such as Chrome; any difference in behaviour could be a clue.
Please also look at your network tab in Chrome's developer tools and let us know if any requests are failing and what is being stored and retrieved from the State.
Full details of how the State API is supposed to work are found in the spec. Here's the relevant section in version 1.0.2: https://github.com/adlnet/xAPI-Spec/blob/a752217060b83a2e15dfab69f8c257cd86a888e6/xAPI.md#stateapi
It's also worth noting that building an LRS is hard. There are a number of commercial and open source LRS that will likely be cheaper than building one yourself.
I managed to get this working. I was using .NET Web API.
I had to explicitly set the content-type header to octet-stream - It was defaulting to text/html.
The following code did the trick:
HttpResponseMessage httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK);
httpResponseMessage.Content = new StringContent(studentModuleName.SuspendData);
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

How can I generate an API Key in My own Controller in Codeigniter

Just want to mention that I am really a newbie in API development (concepts, structure, best practices) I am not nearly familiar with it at all, so please excuse my pathetic stupid question if you find it to be, I'm using Phil Sturgeon's REST API server, Curl Library, and REST API client here's my code:
in my controller application/controllers/make_key
function index(){
$this->load->library('rest');
$this->load->library('curl');
$this->rest->put('https://www.myapplication.com/apifolder/key/X-API-KEY/FOO');
}
- no response at all
where apifolder/key is the location of my key.php (from Phil Sturgeon's default example):
and note that I've also tried this via address bar:
https://www.myapplication.com/apifolder/key/X-API-KEY/FOO
- returns ({"status":false,"error":"Invalid API Key."})
https://www.myapplication.com/apifolder/key?X-API-KEY=FOO
- returns ({"status":false,"error":"Unknown method."})
and tried quite a lot more queries but none seem to be working, my only question is...
How can make this key.php work? my apologies for such a simple minded question thank you in advance
see my self-accepted answer on my own qeuestion... Phils documentation does not provide this information. I had to dig into the library myself.
i ended up finding out the 403 forbidden was because i was not providing an api key to generate keys..
Kind of abiguous as Phil's documentation doesn't state that an existing api key is required before you can generate keys..
I simply created a bogus key in the table in the db and referenced that when calling /key/index?X-API-KEY=boguskey
CodeIgniter REST API Library Ajax PUT throwing 403 Forbidden

Resources