title: Publishing to Google pubsub as a JSON through an http request
body: <p>I was trying to push some data to PUB/SUB as mentioned <a href="https://cloud.google.com/pubsub/docs/publisher#pubsub-publish-message-protocol" rel="nofollow noreferrer">here</a></p>
  
  <p>I assume, the URL "POST <a href="https://pubsub.googleapis.com/v1/projects/myproject-id/topics/mytopic-name:publish" rel="nofollow noreferrer">https://pubsub.googleapis.com/v1/projects/myproject-id/topics/mytopic-name:publish</a>" with needed data in a json format as described , would publish the data to the pubsub. Is my assumption correct here? or should I write my own handler to publish the data which i get from a webpage using java/php/python etc?</p>
  
  <p>I could successfully push the data through google play ground. But this requires my username/password to be given to authenticate. </p>
  
  <p>Can I use API_KEY alone here to send the data from my webpage to google pubsub? Or should I go for OAuth2.0 login? If OAuth is used, is there any way to provide the client_id and the API_KEY to do the authentication without prompting the user to enter credentials?  </p>
  
  <p>Any help on the above topics would be really appreciated. </p>
  
  <p>Thanks</p>