Splunk® Answers and Splunkbase

Working with Splunkbase

Download manual as PDF

Download topic as PDF

Submit content to Splunkbase with the REST API

You can use the Splunkbase REST API to upload new releases to an existing app. Releases uploaded to this endpoint will be subject to the same validations and permissions as those enforced via the Splunkbase web UI.

To upload new releases to Splunkbase with the REST API:

  1. Enable API access.
  2. Upload a new release package.
  3. Check the new release package validation status.

Enable API access

Before you can access the API, you must agree to the Splunkbase Developer Distribution Agreement and enable API access.

  1. In a web browser, navigate to your profile page (https://splunkbase.splunk.com/user/USERNAME/) and scroll to the "API Access" section to view the status of your API access.
  2. Click the link to display the Splunkbase Developer Distribution Agreement.
  3. In the window that displays, view the Splunkbase Developer Distribution Agreement and click "Agree and turn on API access" or "Cancel".
    If you click “Agree and turn on API access,” the Splunkbase Developer Distribution Agreement window closes, and your API access status is saved.
    If you click “Cancel,” the window closes and your API access status is not modified.

Note: To disable API access, navigate to the API Access section on your profile page and click the disable link.

Upload a new release package

To upload a new release package, you must be an owner or editor of the app specified by the APPID. APPID is the Splunkbase numerical app id listed in the URL of the app details page.

URL

https://splunkbase.splunk.com/api/v1/app/APPID/new_release/

A trailing slash is required.

Description
Use this API endpoint to upload a new release package to an existing app on Splunkbase. You can POST to this endpoint no more than 20 times in one hour.

Authentication
Authentication occurs over SSL using HTTP Basic Authentication and uses your Splunkbase (splunk.com) credentials.

Method

POST

Parameters
Required

Name Type Description
files[] File The release package. Syntax varies depending on client.
filename String The name of the file, for example "my_package.tar.gz”.
splunk_versions Comma separated string The Splunk version(s) that the release is compatible with. For example, "6.7,7.0".

Not required

Parameter Type Description
visibility false true = The release is to be visible upon package validation success.

false = if the release is to be hidden.

cim_versions Comma separated string The CIM version(s) that the release is compatible with. For example, "4.9,4.7".

Example request and responses

Example request:

curl -u <user> --request POST https://splunkbase.splunk.com/api/v1/app/<APPID>/new_release/ -F "files[]=@<file path>" -F "filename=test_package.tgz" -F "cim_versions=4.9,4.7" -F "splunk_versions=6.7" -F "visibility=true"

Example success response:

HTTP Status Code: 200
<br> 
{"id":14}

The ID represents the package ID, which you can use to check the new release package validation status.


Example failure responses:

You do not provide authentication credentials:

HTTP Status Code: 403

{"detail":"Authentication credentials were not provided."}


Your authentication fails:

HTTP Status Code: 403

{"detail":"Invalid username/password."}


You succeed at authentication but do not have permission to upload to this app:

HTTP Status Code: 403

{"detail":"You do not have permission to perform this action."} 


You succeed at authentication but have not accepted the Splunkbase Developer Distribution Agreement:

HTTP Status Code: 403

{"errors":" You must enable API access before using the API. You can do this on your profile page on the Splunkbase website: <profile url>."}


You try to upload to an APPID that doesn't exist:

HTTP Status Code: 404

{"detail":"Not found."} 


You try to upload to a Directory Listing app:

HTTP Status Code: 400

{'errors': 'Cannot upload new release to directory listing app'}


You pass an invalid Splunk or CIM version:

HTTP Status Code: 400

{"errors":"Not a valid Splunk version"}

{"errors":"Not a valid CIM version"}


You try to upload more than 20 new releases in an hour:

HTTP status code: 429

{'errors': 'Only 20 new releases may be posted per hour'}

Check the new release package validation status

URL

https://splunkbase.splunk.com/api/v1/package/PACKAGEID/

PACKAGEID is the ID of the package, as returned by the new release package upload endpoint. A trailing slash is required.

Description
Use the package status endpoint to check package status after you have successfully uploaded the new release package. Package status can only be viewed by the user who uploaded the package. The package is validated with the same validation process that occurs when you upload a new release with the Splunkbase web UI.

After the package status returns the value "pass", you can log into the Splunkbase website to see the new release on your app. In some situations, new releases to existing apps require internal approval. If an app is held for internal approval, the app might not be immediately visible regardless of the visibility flag setting.

Authentication
Authentication occurs over SSL using HTTP Basic Authentication and uses your Splunkbase (splunk.com) credentials. You must be logged in as the user who uploaded the new release package.

Method

GET

Parameters
None.

Example request and responses

Example request:

curl -u <user> https://splunkbase.splunk.com/api/v1/package/<package ID>/


Example success response:

The package successfully validated:

HTTP Status Code: 200
 
{"message":{"release_name":"1.0","release_file":2723,"app_id":"my_app_1"},"result":"pass"}


The package did not validate:

HTTP Status Code: 200
 
{"message":["Unable to extract package"],"result":"fail"}

Note:

"message"

can be one or more of the many package validation failure scenarios.


Example failure responses:

You do not provide authentication credentials:

HTTP Status Code: 403
 
{"detail":"Authentication credentials were not provided."} 


Your authentication fails:

HTTP Status Code: 403
 
{"detail":"Invalid username/password."} 


You succeed at authentication but do not have permission to check this package:

HTTP Status Code: 403
 
{"detail":"You do not have permission to perform this action."} 


You try to check the status of a PACKAGEID that doesn't exist:

HTTP Status Code: 404
 
{"detail":"Not found."} 
PREVIOUS
Submit content to Splunkbase with the web UI
  NEXT
After submitting

This documentation applies to the following versions of Splunk® Answers and Splunkbase: splunkbase


Comments

Is there a parameter for the release notes?

Lwu splunk, Splunker
September 9, 2019

Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters