Authentication
The ChartMogul API uses HTTP Basic Authentication.
API Endpoint
The base URL for the ChartMogul API is:
https://api.chartmogul.com/
- All requests to the API must be made over HTTPS. Requests over HTTP will fail.
- All requests and responses are formatted in JSON. Our client libraries may return data in different formats.
CORS Support
The ChartMogul API supports Cross-Origin Resource Sharing (CORS) to allow you to consume it from a client-side application.
Be careful to never expose your API credentials in any client-side code.
ChartMogul allows you to create multiple API keys, and we strongly encourage you to use a separate key for each external application or service you connect to ChartMogul. Learn more about creating and managing API Keys.
Basic Auth credentials
With every request made to the ChartMogul API, you must provide your API Key as the username with Basic Auth credentials. The password with Basic Auth can either be empty or the same as the API key.
Find your API Keys by navigating to Profile > View Profile and choosing API Keys in the sidebar.
Click ADD API KEY to create a new key.
Updates to developer libraries
Starting October 29 2021, we are updating our developer libraries to support enhanced API Access Management. The latest versions of our libraries now only require an API Key for authentication.
When using older versions that still require an Account Token and a Secret Key, please use the same API Key for both of these values. For example, if your API Key is 717098869e029c50690d80913728eb89 then set API Token to 717098869e029c50690d80913728eb89 and Secret Key to 717098869e029c50690d80913728eb89
Once you have your API Key, you can quickly verify it by sending us an authentication ping. You will receive a satisfying pong! in response if your credentials are correct.
In the example requests below, replace <CHARTMOGUL_API_KEY>
with your API key. In the cURL command, don’t add a password after the colon. If you’re using a GUI tool such as Postman, paste your API key as the username and leave the password blank.
curl -X GET "https://api.chartmogul.com/v1/ping" \
-u <CHARTMOGUL_API_KEY>:
require "chartmogul"
ChartMogul.global_api_key = "<CHARTMOGUL_API_KEY>"
puts ChartMogul::Ping.ping.inspect
const ChartMogul = require("chartmogul-node");
const config = new ChartMogul.Config("<CHARTMOGUL_API_KEY>");
console.log(ChartMogul.Ping.ping(config));
ChartMogul\Configuration::getDefaultConfiguration()
->setApiKey('<CHARTMOGUL_API_KEY>');
print_r(ChartMogul\Ping::ping()->data);
import cm "github.com/chartmogul/chartmogul-go/v4"
func main() {
api := cm.API{
ApiKey: "<CHARTMOGUL_API_KEY>",
}
ok, err := api.Ping()
if err != nil {
fmt.Printf("This didn't work out: %v", err)
} else {
fmt.Println(ok)
}
}
import chartmogul
config = chartmogul.Config("<CHARTMOGUL_API_KEY>")
print(chartmogul.Ping.ping(config).get())
{
"data": "pong!"
}
#<ChartMogul::Ping:0x00000001054c9018
@data="pong!"
>
{
data: "pong!"
}
pong!
true
<Ping{
data="pong!"
}>
Updated about 2 months ago