Method: projects.topics.create

Creates the given topic with the given name. See the resource name rules.

HTTP request

PUT https://pubsub.googleapis.com/v1/{name}

Path parameters

Parameters
name

string

Name of the topic. Format is projects/{project}/topics/{topic}.

Request body

The request body contains data with the following structure:

JSON representation
{
  "labels": {
    string: string,
    ...
  }
}
Fields
labels

map (key: string, value: string)

See Creating and managing labels.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Response body

If successful, the response body contains a newly created instance of Topic.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/pubsub
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

Try it!

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Pub/Sub