How to create a Google Contact using the new People API and at the same time registered that contact into multiple groups/labels - google-contacts-api

Google People API - the new version of Google Contacts Api
How can I create a new contact using Google People API and at the same time "register" or add that contact to multiple user groups/labels. Previously using the google contact api this was trivial but Google has now updated their API and depreciated their OLD API.
I have an example below of what I am trying to achieve. For example I wish to create a new contact "Steve Jobs" that belongs to the groups/labels in google contacts "Apple" and "Technology" and "Super_User".
I am using this endpoint - https://developers.google.com/people/api/rest/v1/people/createContact
Also you should note that it works fine with 1 group but not with multiple groups.
Thank you in advance!
"memberships": [
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/123456789010",
"contactGroupResourceName": "contactGroups/1234567890"
}
}
]
}
}
],
"names": [
{
"familyName": "Jobs",
"givenName": "Steve"
}
]
}```

I managed to solve this myself. I'm a silly person. Obviously you need to ensure that the contact group id equals an existing ID that is in your Google Contacts account. You can see the ID by creating a group in google contacts then clicking on the group name. Look in your URL and it will show the contact group ID.
"memberships": [
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/123456789"
}
},
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/123456789832"
}
},
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/232353433233"
}
}
]

Related

Graph API: how to filter contacts email addresses by a domain and remove odata.etag

Currently Microsoft Graph API is fetching only limited number of contacts
GET https://graph.microsoft.com/v1.0/me/contacts?$select=emailAddresses
I'm trying to fetch specific domain users from contacts like gmail.com,yahoo.com,hotmail.com etc.
How can I filter contacts by a domain?
Is it possible to remove the #odata.etag from the response?
{
"#odata.etag": "W/\"EQAAABYAAAA7dvnHzGk5R7sHHysSXK7DAACr9QQo\"",
"id": "AQMkADAwATMwMAItMzdhMS02YTgwLTAwAi0wMAoARgAAA1uMJPrjGhBAoUs_D2djgpAHADt2_cfMaTlHuwcfKxJcrsMAAAIBDgAAADt2_cfMaTlHuwcfKxJcrsMAAACr-pPFAAAA",
"emailAddresses": [
{
"name": "bmalet#yahoo.com",
"address": "bmalet#yahoo.com"
}
]
}
You cannot filter contacts by a domain. You cannot apply any other operator or function with $filter, such as ne, le, and startswith().
To remove #odata.etag you need to add a request header
Accept: application/json;odata.metadata=none
Resources:
Contacts: Optional query parameters

Magneto Rest API to Update Tracking Number and Carrier Code is not working

I tried to update the tracking no and carrier code using the following API with the payload.
http://example.com/rest/default/V1/shipment/track
Payload
{
"entity":{
"order_id":63,
"entity_id":26,
"parent_id":26,
"weight":2,
"qty":1,
"description":"This is testing trackig no",
"extension_attributes":{
},
"track_number":"333333",
"title":"United Parcel Service",
"carrier_code":"United Parcel Service"
}
}
The above API is found in the documentation link given below.
https://magento.redoc.ly/2.4.3-admin/tag/shipmenttrack
The shipment is done through Magento UI but tracking number and carrier code is not updated.
so I use the Rest API to Update the tracking number and carrier code with the above API.
As per documentation, It has quantity and weight. if I a ship has more than one item, should we give total quantity and weight.
It gives the response with 200 OK but Magento UI is not showing the tracking details.
Is there any restriction to update tracking when order is complete.
It is not working even when the order is "Processing"
Please advise.
Thanks
Rajan
POST URL : https://example.com/index.php/rest/V1/shipment/track
Please try the following payload,
{
"entity": {
"order_id": 1232,
"parent_id": 1234,
"track_number": "96867546342",
"title": "Delhivery",
"carrier_code": "custom"
}
}

Assignment screen disabled for Teams created via Microsoft Graph

When I create a Team (they are of the type Class for Teachers and Students) using the Microsoft Graph Education APIs, the Team appears in the Microsoft Teams app and the Assignment tab is visible.
When I try to create a new assignment in the Teams app, the screen for creating an assignment is disabled, so it's not possible to create new assignments for any Team created via the API.
Am I doing something wrong?
Team created through the API (controls are disabled, no save and delete controls):
Teams created through the Teams app (controls are enabled):
Workflow:
I create a Team via POST https://graph.microsoft.com/V1.0/education/classes
with the body of:
{
"displayName": "Test2",
"description": "Test2",
"classCode": "Test2",
"externalId": "2",
"externalName": "Test2",
"externalSource": "sis",
"mailNickName": "Test2_2",
"term": {
"displayName": "Term2",
"externalID": "2",
"startDate": "2017-09-01",
"endDate": "2019-08-31"
}
}
(also tried with "externalSource":"manual")
Add a Teacher using POST https://graph.microsoft.com/V1.0/education/classes/{id}/teachers/$ref with a body of
{
"#odata.id": "https://graph.microsoft.com/V1.0/education/users/{id}"
}
Add a Student using POST https://graph.microsoft.com/V1.0/education/classes/{id}/members/$ref with a body of:
{
"#odata.id": "https://graph.microsoft.com/V1.0/education/users/{id}"
}
All of these calls are successful and the Team shows up in the Teams app. The Assignment tab also shows up, so the Team is an Education Team.
This was a known bug - the fix was deployed on 9/3/2018.

GetResponse API v3 - Get contacts who open the newsletter

I'm having a hard time finding for the API in getting the contacts of the people who open the newsletter after sending it to a list of email. In the official API documentation of GetResponse, I didn't find a solution. Any idea or suggestion can help. thanks.
Though it's rather old now, I'll try to answer, maybe it helps someone.
Just as inside GetResponse web interface, you'll need to search contacts according to some criteria. These pages of the API docs describe how this is done:
http://apidocs.getresponse.com/v3/resources/search-contacts
Search contacts is the most complex part of the API. To save a search of contacts who opened a particular message you'll need to POST something like below to https://api.getresponse.com/v3/search-contacts/:
{
"name": "test_conditions", //can be any you like
"subscribersType": [
"subscribed" //can also be "undelivered", "removed" and "unconfirmed"
],
"sectionLogicOperator": "or", //or "and"
"section": [ //section can have up to 8 conditions; one saved search can have up to 4 sections
{
"campaignIdsList": [
"V" //you'll need to get campaigns' IDs with http://apidocs.getresponse.com/v3/resources/campaigns#campaigns.get.all
],
"logicOperator": "or",
"subscriberCycle": [
"receiving_autoresponder",
"not_receiving_autoresponder"
],
"subscriptionDate": "all_time", //"today", "yesterday", "this_month", "last_month", "this_week", "last_week" are also possible
"conditions": [
{
"conditionType": "opened",
"operatorType": "message_operator",
"operator": "autoresponder", //or "newsletter", or "split"
"value": "WTjXF" //message id, should be firstly got with a separate API call
}
]
}
]
}
More info on how the payload for such requests should be formed is here: http://apidocs.getresponse.com/v3/resources/search-contacts-reference
And the last point: if you don't need to save a search but only get the emails who've opened a message, in the object above you should remove the "name" property and post this to http://apidocs.getresponse.com/v3/search-contacts/contacts
More: http://apidocs.getresponse.com/v3/resources/search-contacts#search-contacts.contacts.form

Chrome Web Store: how to check for Payment with google apps script

We put two Google Apps Script web services succesfully into the chrome web store. One is f.e.
https://chrome.google.com/webstore/detail/aagmbfbgdjhkilafppdjihnafgcahpbc
Now we want to check for Payment like described in
https://developers.google.com/chrome/web-store/docs/check_for_payment?hl=de
But
1. How to get a user ID for the current user (an OpenID URL corresponding to a Google account)
2. How to make a request with the Licensing API
with Google Apps Script code?
Do you just use the verify payment method:
google.payments.inapp.getPurchases({
'success': onLicenseUpdate,
'failure': onLicenseUpdateFail
});
responds with:
{
"response": {
"details": [
{
"kind": "chromewebstore#payment",
"itemId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sku": "giant_tv",
"createdTime": "1387221267248",
"state": "ACTIVE"
}
]
}
}
https://developer.chrome.com/webstore/payments-iap