I am using google calendar api to insert the events in a calendar. Is there a google calendar api to change the description of the calendar event according to the one set by the user.
Please answer my query.
Thank you!
The Events patch method will allow you to update the description of an event
PATCH https://www.googleapis.com/calendar/v3/calendars/[CALENDARID]/events/[EVENTID]?key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"description": "test"
}
Just remember with patch to only send the properties you want to edit don't send the ones you wish to remain the same.
Related
I'm trying to do a batch call to get Calendars from Google.
I've tried following several answers here on StackOverflow:
What is the endpoint to make batch request for Google Calendar v3 API
Batch request in Google Calendar V3 REST API
and also followed the Google Documentation:
https://developers.google.com/calendar/api/guides/batch#format-of-a-batch-request
Since the general endpoint (https://www.googleapis.com/batch) is deprecated, I'm using https://www.googleapis.com/batch/calendar/v3 to post to.
I'm posting a plain text body:
POST /batch/calendar/v3 HTTP/1.1
Content-Type: multipart/mixed; boundary="batch_foobarbaz"
--batch_foobarbaz
Content-Type: application/http
GET /calendar/v3/calendars/*calendarId1*
--batch_foobarbaz
Content-Type: application/http
GET /calendar/v3/calendars/*calendarId2*
--batch_foobarbaz--
The result I keep getting is:
{
"error": {
"code": 400,
"message": "Failed to get multipart boundary.",
"status": "INVALID_ARGUMENT"
}
}
Can anyone tell me what I'm doing wrong here?
Thanks!
Running Ghost 5.2.2 and using the Admin API to publish posts.
Alongside publishing the post via the API, I want it to send it out to a specified newsletter.
As far as I can tell from the Ghost documentation (https://ghost.org/docs/admin-api/#publishing-and-scheduling-posts) all I need to do is add ?newsletter={{newsletter-slug}} to the query string when I create the post. However it schedules the post, but doesn't schedule/send the email.
Everything appears to be working well (in terms of scheduling and publishing posts), just not sending out the emails.
What am I missing?
Sample HTTPS request:
URL: {{website-url}}/ghost/api/admin/posts/?newsletter=default-newsletter&source=html
Method: POST
Body: {"posts": [{"title": "Title","status": "scheduled","html": "Content","published_at": "2022-06-15T20:07:00.000Z"}]}
Headers:
Content-Type: application/json
Authorization: Ghost {{token}}
You need setup mail service it's required in production.
Check out the documentation here https://ghost.org/docs/config/#mail
I have registered and done email verification. Then, I try the most baisc API trying to shorten a testing link. The following is my HTTP packet.
POST /v4/shorten HTTP/1.1
Host: api-ssl.bitly.com
Content-Type: application/json
Authorization: Bearer my-generic-access-token
Cache-Control: no-cache
{
"group_guid": "shorten_link_testing",
"domain": "mytesting.site.com",
"long_url": "http://mytesting.site.com/"
}
And the following is the return from bit.ly:
{
"message": "FORBIDDEN",
"resource": "bitlinks",
"description": "You are currently forbidden to access this resource."
}
I am using Postman to test, so I am quite sure it is not the problem of my code. And the message format meets that in the documentation of bit.ly, so at least the connection is success. As far as I know, bit.ly should have 10,000 quota for free shorten link per month for every account, right? What have I missed so that I am banned from the shorten link service?
The group_guid param needs to reference the id of a group associated with your bitly account. Hit this api endpoint with your generic access token to get a list of the groups/guids bitly has associated with your account:
GET https://api-ssl.bitly.com/v4/groups.
Apparently the domain param is optional, because your account may have a default domain associated with it. It worked for me after removing the domain param altogether.
https://groups.google.com/forum/#!topic/bitly-api/9RywN3ETLkg
Hope this helps!!
I have been looking around for these issues. Currently, my solution is by removing body group_guid and getting a response 201 (created). I hope my information helps.
I have created and added my Glip bot to my Glip team, during which time the icon and name was chosen.
In Glip, I can change my own icon and name by clicking on the profile, but I cannot modify the bot's profile.
I was wondering if I can update the icon or the bot name after it's been added?
Both the bot name and bot icon in Glip can be updated via the Update Extension API using the bot's access token if the bot app has the EditExtensions permission.
Update Bot Name via Update Extension API
The Update Extension Info API can be used by the bot to update the bot's name in Glip if the bot has the EditExtensions app permission. The bot's name in Glip will be updated to reflect this in real-time.
This is an example HTTP request.
PUT /restapi/v1.0/account/~/extension/~
Authorization: Bearer <botAccessToken>
Content-Type: application/json
{
"contact": {
"firstName": "Mr.",
"lastName": "Bot"
}
}
More info is available here:
API Reference: https://developers.ringcentral.com/api-docs/latest/index.html#!#RefGetExtensionInfo
Update Bot Icon via Upload User Profile Image API
The bot icon in Glip can be updated using the Upload User Profile Image API, which also requires the EditExtensions application permission. Like the bot name, the bot icon will be updated in Glip in real-time.
Here is a sample request.
POST /restapi/v1.0/account/~/extension/~/profile-image
Authorization: Bearer <botAccessToken>
Content-Type: multipart/form-data;boundary=Boundary_1234567890
--Boundary_1234567890
Content-Disposition: form-data; name="image"; filename="icon.jpg"
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAg
[...]
ZWYKMjQ0MjcKJSVFT0YK
--Boundary_1234567890--
Here is an example using curl. Of note, it's necessary to explicitly state the file content type, e.g. type=image/jpeg below.
$ curl -v -H "Authorization: Bearer <botAccessToken>" \
-F "image=#bot_icon.jpg;type=image/jpeg" \
"https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/profile-image"
More info is available on this API here:
API Reference: https://developers.ringcentral.com/api-docs/latest/index.html#!#RefCreateExtensionProfileImage
The code snippets generated from postman don't include whether it is HTTP or HTTPS
GET/apis/123?api-version=2017-03-01 HTTP/1.1
Host: contoso.anc.net
Content-Type: application/json
If-Match: *
Authorization: Bearer token
Cache-Control: no-cache
Postman-Token: fe465591-15b3-cbf0-9d9b-f2ed76efcb2c
The endpoint contoso.anc.net only responds to https endpoint and one of our customers had to figure out the hard way.
Is this missing information in the snippet or the service side should automatically bump to HTTPS when it gets a request over HTTP? Can somebody point to the spec?
Edit
This relates to the Generate Code Snippets that can be created within Postman using the code button.
The HTTP option:
By using console.log(pm.request) in the Tests tab you are able to see the request details in the Postman Console. This shows the Protocol as well as the other request data.
If the API is not telling you what protocol to use when making requests (In the documentation) or not giving the user any feedback within the response, that seems to me like a different problem your customer is facing.