{"action":"created","issue":{"url":"https://api.github.com/repos/google/google-api-php-client/issues/1276","repository_url":"https://api.github.com/repos/google/google-api-php-client","labels_url":"https://api.github.com/repos/google/google-api-php-client/issues/1276/labels{/name}","comments_url":"https://api.github.com/repos/google/google-api-php-client/issues/1276/comments","events_url":"https://api.github.com/repos/google/google-api-php-client/issues/1276/events","html_url":"https://github.com/google/google-api-php-client/issues/1276","id":247811716,"number":1276,"title":"Google Plus Domains post Media.Upload error 400 answer ","user":{"login":"CHDuBar","id":5651023,"avatar_url":"https://avatars0.githubusercontent.com/u/5651023?v=4","gravatar_id":"","url":"https://api.github.com/users/CHDuBar","html_url":"https://github.com/CHDuBar","followers_url":"https://api.github.com/users/CHDuBar/followers","following_url":"https://api.github.com/users/CHDuBar/following{/other_user}","gists_url":"https://api.github.com/users/CHDuBar/gists{/gist_id}","starred_url":"https://api.github.com/users/CHDuBar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CHDuBar/subscriptions","organizations_url":"https://api.github.com/users/CHDuBar/orgs","repos_url":"https://api.github.com/users/CHDuBar/repos","events_url":"https://api.github.com/users/CHDuBar/events{/privacy}","received_events_url":"https://api.github.com/users/CHDuBar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-03T19:31:23Z","updated_at":"2017-10-02T19:47:48Z","closed_at":null,"author_association":"NONE","body":"I want to upload a multimedia file with Google Plus Domains for later post in an Activity. I have been researching in forum, oficial documentation and reviewed Google APIs Client Library for PHP as result I have the next code\r\n\r\n   ```\r\n $mediaUpload = new \\Google_Service_PlusDomains_Media(\r\n    \t    array(\r\n    \t    \t\t'uploadType' => 'media',\r\n    \t    \t\t'collection' => 'cloud',\r\n    \t    \t\t'media_body' => $completePath, // /u0/.../image.jpg\r\n    \t    \t\t'userId' => $this->id_profile, //Google Plus Profile ID\r\n    \t    \t\t'displayName' => $imageTemp[1], //image.jpg\r\n    \t    \t\t'mediaUrl' => $URL // http://example.com/files/image.jpg \r\n    \t    \t)\r\n       );\r\n  $mediaUploadAnswer = $plusdomains->media->insert('me', 'cloud', $mediaUpload);\r\n```\r\n\r\nThe message error is \r\n\r\n   \r\n\r\n>  'domain' => string 'global' \r\n>     'reason' => string 'invalid' \r\n>     'message' => string 'Invalid Value' \r\n> \r\n>     Error calling POST https://www.googleapis.com/plusDomains/v1/people/me/media/cloud: (400) Invalid Value\r\n> \r\n\r\nI checked all parameters and them are right.\r\n\r\nCurrently I can post Activity with only text, so I get the Client correctly.\r\n\r\nWhat can be?\r\n"},"comment":{"url":"https://api.github.com/repos/google/google-api-php-client/issues/comments/333644208","html_url":"https://github.com/google/google-api-php-client/issues/1276#issuecomment-333644208","issue_url":"https://api.github.com/repos/google/google-api-php-client/issues/1276","id":333644208,"user":{"login":"obscurecloud","id":2232055,"avatar_url":"https://avatars0.githubusercontent.com/u/2232055?v=4","gravatar_id":"","url":"https://api.github.com/users/obscurecloud","html_url":"https://github.com/obscurecloud","followers_url":"https://api.github.com/users/obscurecloud/followers","following_url":"https://api.github.com/users/obscurecloud/following{/other_user}","gists_url":"https://api.github.com/users/obscurecloud/gists{/gist_id}","starred_url":"https://api.github.com/users/obscurecloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscurecloud/subscriptions","organizations_url":"https://api.github.com/users/obscurecloud/orgs","repos_url":"https://api.github.com/users/obscurecloud/repos","events_url":"https://api.github.com/users/obscurecloud/events{/privacy}","received_events_url":"https://api.github.com/users/obscurecloud/received_events","type":"User","site_admin":false},"created_at":"2017-10-02T19:47:48Z","updated_at":"2017-10-02T19:47:48Z","author_association":"NONE","body":"This got me going. \r\nIf you are trying to do a media.insert with the Google Plus API PHP SDK, this is the answer. \r\nSmall change I had to make though:\r\n`$file_mime = $this->mime_content_type($file_title);`\r\nto \r\n`$file_mime = mime_content_type($file_path);`\r\nIf you are working with remote files, check out the comment:\r\nhttp://php.net/manual/en/function.finfo-file.php#119467"}}
{"actor":{"display_login":"obscurecloud"}}