API Request
POST https://www.google.com/m8/feeds/contacts/default/full?alt=json
Body
{
"entry": {
"gd$name": {
"gd$fullName": {
"$t": "Rohit Roy"
},
"gd$givenName": {
"$t": "Rohit"
},
"gd$familyName": {
"$t": "Roy"
}
},
"gd$email": [
{
"address": "royrohit1234#exampledomain.com",
"primary": "true",
"rel": "http://schemas.google.com/g/2005#home"
}
],
"gd$phoneNumber": {
"$t": "+919999888877",
"primary": "true",
"rel": "http://schemas.google.com/g/2005#home"
},
"gd$organization": {
"gd$orgName": {
"$t": "XYZ Pvt. ltd."
}
}
}
}
This code is working properly i want to add custom fields to google contacts.
For that i tried convert below XML into JSON.
<gContact:userDefinedField key="chess" value="likes playing black"/>
Like This
"gContact$userDefinedField":{
"key":"food",
"value":"Chinese"
}
But this code is not working with above code so i need help to add custom field with my working code above.
Fortunately i got solution of custom fields, birthday and all other google contact fields with JSON API.
Google Contact API Docs updated and mentioned about Peoples API which is replacement of old google contact API.
So now i am using Peoples API instead of Contacts API V3 which already deprecated.
Click This Link For Peoples API Create Contact API Docs
HTTP Request
POST https://people.googleapis.com/v1/people:createContact
Body
{
"emailAddresses": [
{
"value": "rohitroy#exampledomain.com",
"type": "work"
}
],
"names": [{
"givenName": "John",
"familyName": "Doe"
}],
"birthdays": [
{
"date": {
"year": 1996,
"month": 5,
"day": 2
}
}
],
"userDefined": [
{
"key": "customfield",
"value": "anyvalue-123456"
}
]
}
In the Body userDefined is for custom fields.
Related
I build a chatbot with Watson Assistant and integrate it with Slack. I want to write Native JSON supported by Slack through Watson Dialog using JSON Editor. The doc of Watson Assistant says:
output.integrations.slack: any JSON response you want to be included in the attachment field of a response intended for Slack.
(see https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-responses-json#dialog-responses-json-user-defined)
So I tried sth like this:
{
"output": {
"integrations": {
"slack": {
"attachment": {
"blocks": [
{
"text": {
"text": "Pick a date for the deadline.",
"type": "mrkdwn"
},
"type": "section",
"accessory": {
"type": "datepicker",
"action_id": "datepicker-action",
"placeholder": {
"text": "Select a date",
"type": "plain_text",
"emoji": true
},
"initial_date": "1990-04-28"
}
}
]
}
}
},
"generic": [
{
"response_type": "text",
"values": [],
"selection_policy": "sequential"
}
]
}
}
The content of the attachment field is copied from the Block Kit Builer(https://api.slack.com/tools/block-kit-builder).
But this seems not work. Can anyone give me some suggestions? Thanks in advance.
Output.integrations is not a preferred way.
Pls try
"output": {
"generic": [
{
"user_defined": {
//Put here your slack attachment
},
"response_type": "user_defined"
}
]}
By using user_defined you can mix with it more responses like text, image, etc.
I'm working with Amadeus Flight Offers Search API and I'd like to use my client's corporate code in order to search offers including corp nego fares. I see there is a field for corporate codes in the schema, but corporate codes need to be loaded into an OID in order to work, and I'm not specifying an OID when calling the API. How will this work?
I have tried using some corporate codes that I know and no corporate fares have appeared. This is an example I have tried.
{
"currencyCode": "EUR",
"originDestinations": [
{
"id": "1",
"originLocationCode": "MAD",
"destinationLocationCode": "NYC",
"departureDateTimeRange": {
"date": "2019-09-01",
"time": "10:00:00",
"timeWindow" : "6H"
}
},
{
"id": "2",
"originLocationCode": "NYC",
"destinationLocationCode": "MIA",
"departureDateTimeRange": {
"date": "2019-09-03",
"time": "17:00:00",
"timeWindow": "2H"
}
},
{
"id": "3",
"originLocationCode": "MCO",
"destinationLocationCode": "MAD",
"departureDateTimeRange": {
"date": "2019-09-07",
"time": "17:00:00",
"timeWindow": "6H"
}
}
],
"travelers": [
{
"id": "1",
"travelerType": "ADULT",
"fareOptions": [
"STANDARD"
]
}
],
"sources": [
"GDS", "PYTON"
],
"searchCriteria": {
"maxFlightOffers": 50,
"pricingOptions" : {
"corporateCodes" : ["000001"]
},
"flightFilters": {
"connectionRestriction":
{
"airportChangeAllowed" : false,
"maxNumberOfConnections" : 1
}
}
}
}
The result is all published fares.
In Self-Service, we only offer public fares. Negotiated or private fares are only accessible to our Enterprise users. The reference documentation is not very clear about it, the API is still in beta and we will use your feedback to improve it.
I'm using the Microsoft Graph People API to search for people in my personal contacts and the organization directory.
https://graph.microsoft.com/v1.0/me/people/?$search=username
returning for example:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('123456789')/people",
"#odata.nextLink": "https://graph.microsoft.com/v1.0/me/people/?$search=username&$skip=10",
"value": [
{
"id": "1234567890",
...
"personType": {
"class": "Person",
"subclass": "OrganizationUser"
}
},
{
"id": "0987654321",
...
"personType": {
"class": "Person",
"subclass": "PersonalContact"
}
}
]
}
When I request the photo of an internal Organization User ( "subclass": "OrganizationUser"), everything works.
When I'm request the some for a Personal Contact ("subclass": "PersonalContact") photo service, /me/contacts/{id}/photo/$value returns:
{
"error": {
"code": "ErrorInvalidOperation",
"message": "ConversationId isn't supported in the context of this operation.",
"innerError": {
"request-id": "1b55eca0-f83f-4e66-9006-b728373ad747",
"date": "2019-01-04T01:06:27"
}
}
}
I want to detect chinese characters. So I follow google API to include the "languageHints" key. However, the request has problems and errors are returned. I am not sure whether I set the latLongRect and cropHintsParams correctly. Can anyone please help? Thank you very much.
{
"requests": [
{
"features": [
{
"type": "TEXT_DETECTION",
"maxResults": 10
},
{
"type": "DOCUMENT_TEXT_DETECTION",
"maxResults": 10
}
],
"image": { "content": "xxx"},
"imageContext": {
"latLongRect": {
"minLatLng": {
"latitude": "-180",
"longitude": "-90"
},
"maxLatLng": {
"latitude": "180",
"longitude": "90"
}
},
"languageHints": [
"zh*"
],
"cropHintsParams": {
"aspectRatios": [
"10"
]
}
}
}
]
}
json data shown above has syntax error and it is not well formed.
You can use any online json parser (for e.g. http://jsonparseronline.com/) to check if json is well-formed.
it will help if you can give details of error.
I have following custom field. How do i pass it in JSON to create issue in jira using rest api
"customfield_10300":{
"required":false,
"schema":{
"type":"option",
"custom":"com.atlassian.jira.plugin.system.customfieldtypes:select",
"customId":10300
},
"name":"Severity",
"hasDefaultValue":false,
"operations":[
"set"
],
"allowedValues":[
{
"self":"http://sjira/rest/api/2/customFieldOption/10303",
"value":"Blocker",
"id":"10303"
},
{
"self":"http://sjira/rest/api/2/customFieldOption/10304",
"value":"Critical",
"id":"10304"
}
]
}
As the field is from type "select" you should use the JSON format to populate a select field:
Here an example:
{
"fields": {
"project":
{
"key": "PKEY"
},
"summary": "Your summary",
"description": "your description",
"issuetype": {
"name": "Task"
},
"customfield_10013": { "value": "Blocker" }
}
}
Some more details can be found here: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue