I am able to make localPost using GMB api.
However, when I add media, it gives me an error.
The error is as following.
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
My source code is as following.
Also, I installed google/apiclient from github and GMB library from here
$mediaItem = new \Google_Service_MyBusiness_MediaItem();
$mediaItem->setSourceUrl("https://example.com/test");
$mediaItem->setMediaFormat('PHOTO');
$media[] = $mediaItem;
$post = new \Google_Service_MyBusiness_LocalPost();
$post->setSummary($summary);
$post->setCallToAction($callToAction);
$post->setMedia($media);
$obj = new \Google_Service_MyBusiness($client);
$obj->accounts_locations_localPosts->create($accountLocation,$post);
If I comment out
"$post->setMedia($media);", I can make localPost.
Do you have a suggestion for this?
Best regards,
I solved myself.
Before:
$mediaItem->setSourceUrl("https://example.com/test");
After:
$mediaItem->setSourceUrl("https://example.com/test.jpg");
The reason why I could not make localPost is that the image extension should be image extension.
Google API dose not allow us to post the image that has not extension.
Cheers.
Related
My issue looks very similar to:
Microsoft Graph API OnlineMeetings Error - Expected not null\r\nParameter name: meeting
However the posted solution is not working for me. Presently I'm using postman and posting to:
https://graph.microsoft.com/v1.0/users/MyAzureUserObjectID/onlineMeetings
Currently this is my body:
{
"startDateTime":"2021-07-12T14:30:34.2444915-07:00",
"endDateTime":"2021-07-12T15:00:34.2464912-07:00",
"subject":"Application Token Meeting 2",
"participants": {
"organizer": {
"identity": {
"user": {
"id": "MyAzureUserObjectIDHere"
}
}
}
}
}
I've tried a few variations of participants and fields but always get:
{
"error": {
"code": "InvalidArgument",
"message": "Expected not null\r\nParameter name: meeting",
"innerError": {
"request-id": "3ea5c99c-a346-4c3a-8f38-dcdc9fb4d864",
"date": "2021-03-23T19:59:28",
"client-request-id": "3ea5c99c-a346-4c3a-8f38-dcdc9fb4d864"
}
}
}
returned. Has anyone had a similar issue/have any idea what I might do get this to work?
Thanks.
I had the same problem which also wasn't resolved by simply adding the participant.
The thing that fixed it for me was using the correct content type in the header. As I had started with the starter project from Microsoft Teams, I had copied and pasted some of their example code for the meeting request. You need to use 'Content-type': 'application/json'.
Also for the body, I had to use JSON.stringify around it to get it to function correctly.
Im try to get the pending shifts to approve in teams with api.
Pending shifts teams
Reading the API i think the correct method is https://learn.microsoft.com/en-us/graph/api/openshiftchangerequest-list?view=graph-rest-1.0
When I try to get this method using the graph explore the response request is :
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'openShiftsRequests'.",
"innerError": {
"date": "2020-09-04T17:33:34",
"request-id": "52f61a88-7f43-4653-9162-c8e90fc5998f"
}
}
}
My request is https://graph.microsoft.com/v1.0/teams/MY_TEAM_ID_WITH_SHIFT/schedule/openShiftsRequests
What can I do wrong??
I am trying to access message using graph API with the following URL.
_graphAPIEndpoint = Uri.EscapeUriString("https://graph.microsoft.com/v1.0/me/messages/8577e5c2-3d1b-4882-b930-02de5ad18809#CH1GMEHUB07.gme.gbl");
However, I keep getting the following response:
{
"error": {
"code": "ErrorInvalidIdMalformed",
"message": "Id is malformed.",
"innerError": {
"request-id": "8b2d8f88-ff5b-44f7-bb71-8867a03136b7",
"date": "2018-06-07T18:00:32"
}
}
}
Any suggestions on what's wrong?
My bad. Message ID value should be taken from id field passed by Graph API. To use message ID, following query works:
_graphAPIEndpoint = "https://graph.microsoft.com/v1.0/me/messages?$filter=internetMessageId eq ''"
While creating Notebook in MS365 authorized account via REST api call .I am facing some issue ,could anyone let me know what changes I have to make for this.
Request:
POST - https://graph.microsoft.com:443/v1.0/me/notes/notebooks
Body : {
"name": "MSOneNoteBusiness_OSSA_5LyC"
}
Response
Body : {
"error": {
"code": "BadRequest",
"message": "Unsupported segment type. ODataQuery: users/8dc0a74f-0aa6-45f4-813b-92e910f40bd4/notes/notebooks",
"innerError": {
"request-id": "fa409682-5395-4189-a43c-757adcfaea35",
"date": "2017-06-28T10:08:06"
}
}
The request should be POST https://graph.microsoft.com/v1.0/me/onenote/notebooks, not /me/notes, and the request body should have the property displayName. We also have a sample for this in the Graph Explorer:
I am trying to create a Google Sheet with more than 1000 rows and am receiving the error:
{
"error": {
"code": 400,
"message": "Invalid sheets[0].data[0]: Attempting to write row: 1000, beyond the last requested row of: 999",
"errors": [
{
"message": "Invalid sheets[0].data[0]: Attempting to write row: 1000, beyond the last requested row of: 999",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
I also tried creating an empty sheet, and then running batch update calls with GridRanges.
$range = new Google_Service_Sheets_GridRange();
$range->setSheetId($sheetId);
$range->setStartRowIndex(0);
$range->setEndRowIndex(sizeof($data));
$range->setStartColumnIndex(0);
$range->setEndColumnIndex(sizeof(array_keys($data[0])));
$cellsRequest = new Google_Service_Sheets_UpdateCellsRequest();
$cellsRequest->setFields('*');
$cellsRequest->setRange($range);
$cellsRequest->setRows($rowDataArray);
$request = new Google_Service_Sheets_Request();
$request->setUpdateCells($cellsRequest);
$batchUpdate = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest();
$batchUpdate->setRequests(array($request));
$result = $service->spreadsheets->batchUpdate($documentId, $batchUpdate);
When that didn't work, I tried UpdateCellRequests with ranges that were 1000 records in size. That gave me this error:
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"update_cells\" at 'requests[0]': Proto field is not repeating, cannot start list.",
"errors": [
{
"message": "Invalid JSON payload received. Unknown name \"update_cells\" at 'requests[0]': Proto field is not repeating, cannot start list.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Any help on where to go from here would be great!
Thank you.
The write range is truncated to the size of the sheet, and the sheet is only 1000 rows. You'll need to increase the number of rows in the sheet using an UpdateSheetPropertiesRequest or InsertDimensionRequest first. (It can be in the same batchUpdateSpreadsheet call.)
That's a pretty misleading error message, though, so I'll look into making that better.