Create a Key

Creates a new API key. Data for creating the key can be sent in JSON or XML format only; csv format is not supported.

If you are restricting the API key to a specific Feed or Datastream, the Feed must exist.

Request

Parameters
Method POST
Base URL https://api.xively.com
API Endpoint /v2/keys
Headers
X-ApiKey API_KEY_HERE
Body
JSON
XML
CSV
  • POST/v2/keys.json

     {
      "key":{
        "label":"stupid key",
        "private_access": true,
        "permissions":[
          {
            "access_methods":["put"],
            "source_ip": "128.44.98.129",
            "resources": [
              {
                "feed_id": 504
              }
            ]
          },
          {
            "access_methods": ["get"]
          }
        ]
      }
    }
    
  • POST/v2/keys.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <key>
      <label>sharing key</label>
      <permissions>
        <permission>
          <access-methods>
            <access-method>get</access-method>
            <access-method>put</access-method>
          </access-methods>
        </permission>
      </permissions>
    </key>
    
  • CSV format not available for this call.
    

 

 

Response

Parameters
Status Code 201 CREATED
Headers
Location https://api.xively.com/v2/keys/YOUR_NEW_KEY
Body
JSON
XML
CSV
  • This response does not return body data
    
  • This response does not return body data
    
  • CSV format not available for this call