Create

This implementation of SNMP V1V2 community string creates a SNMP community string entity in all the devices mentioned in the request.

Parameters of SNMP v1v2 Community String Create

URI

https://<ipaddress>:8111/cvp-config/snmp/community

HTTP Method

POST

Input/Output Format

XML or JSON

Throttled

Yes

For more information on throttling, see Unified CVP REST Request Throttling.

API Type

Synchronous

Request

The POST operation on the Service endpoint creates the SNMP Community String in the listed devices and will return the identifier in header.

POST https: //api.cvp.com:8111/cvp-config/snmp/community

Authorization

Basic signaturevalue

Content-type

Application/XML or Application/JSON

Accept

Application/XML or Application/JSON

Request Data Structure


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<community>
  <name>Public_Community</name>
  <snmpversion>V2C</snmpversion>
  <acceptfromanyhost>false</acceptfromanyhost>
  <hosts>
    <host>10.78.26.43</host>
  </hosts>
  <accessprivilege>ReadOnly</accessprivilege>
  <servers>
    <server>10.78.26.43<server>
  </servers>
</community>
Response Header

Response headers:
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location: https://10.78.26.43:8111/cvp-config/snmp/community/Public_Community
Content-Type: application/xml
Content-Length: 0
Date: Mon, 26 Aug 2013 09:15:27 GMT

Response Code

400- Bad request. If the request body is invalid.

400- API error . If the object either does not exist or is stale.

401- Authorization Failure(for example, the user is not authenticated in the web session)

404- Not Found (for example, the resource is deleted and is not found )

406- Not Acceptable(for example, the accept headers sent in the request is not acceptable.

500- Internal Server Error( for example, the connection is broken with the database server or ORM or any other component.

503 Service Unavailable. When the request processing threshold is reached.

For more information on error codes and their descriptions, see Unified CVP API Error Codes.

Security Constraints

Only a Serviceability administrator can perform this operation.

Parameters

This implementation of the operation does not use request parameters.

Sample Request

The POST operation on the service endpoint creates a SNMP community string in the devices listed in the request, and returns the identifier in the header.


POST https://api.cvp.com:8111/cvp-config/snmp/community

Sample XML Request


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <community>
	<name>communityName</name>
	<snmpversion>snmpVersion</snmpversion>
        <acceptfromanyhost>false</acceptfromanyhost>
	<hosts>
            <host>127.0.0.1</host>
            <host>127.0.0.2</host>
        </hosts>
        <accessprivilege>ReadOnly</accessprivilege>
        <servers>
            <server>ip address of deviceOne</server>
            <server>ip address of deviceTwo</server>
        </servers>
    </community>  

Sample JSON Request


{
  "community": {
    "name": "communityName",
    "version": "snmpVersion",
    "acceptfromanyhost": "false",
    "hosts": {
      "host": [
        "127.0.0.1",
        "127.0.0.2"
      ]
    },
    "accessprivilege": "ReadOnly",
    "servers": {
      "server": [
        "deviceOne",
        "deviceTwo"
      ]
    }
  }
}

Response

Return 201 CREATED with the ref URL mentioned in the location header.

Use a GET request on the ref URL mentioned in the location header to determine the deployment status of the Create request.

Field Names and Data Types Used in the API Parameter

Field Name

Description

Data Type

Size

UTF-8

Required field

Possible values

Additional Validations

name

Represents the Community String name

String

1-128

Yes

Yes

Alphanumeric

Alphanumeric

Dot, underscore and hyphens are allowed.

snmpversion

Represents the SNMP Version Information

String

No

No

V1 (default), V2C

Only V1 or V2C

acceptfromanyhost

Represents whether to accept requests from any host or not.

Boolean

No

No

TRUE(default), FALSE

Only true or false

Not case sensitive

hosts

Represents the wrapper for multiple host fields.

No

Accepted only if acceptfromanyhost=false

host

Represents the management station host IP address.

String

No

No

A valid ip4 address

accessprivilege

Represents the access privileges of the community string.

String

No

No

ReadOnly(default), ReadWrite

Only ReadOnly or ReadWrite

Not case sensitive

servers

If empty, deploys to all the CVP servers configured.

Wrapper

server

Represents the configured CVP Server IP address.

String

No

No

A valid ip4 address

For more information on code snippets, see Unified CVP API Client Sample Code.