In order to start working with the library, you must first login.
Authorization is done by providing client_id
and client_secret
,
which you can get on the page API and apps.
package main
import (
admitad "github.com/lueurxax/go-admitad-client"
"github.com/lueurxax/go-admitad-client/defaults"
"github.com/lueurxax/go-admitad-client/enums"
"github.com/lueurxax/go-admitad-client/requests"
)
func main() {
url := "https://api.admitad.com"
clientID := "Your-client-id"
clientSecret := "Your-client-secret"
// You also can add logger and metrics collector here
client := admitad.New(url, nil, nil)
client.SetAuth(clientID, clientSecret, string(enums.PrivateData))
}
You also need to keep in mind that you need a certain level of access to some features.
See more here: https://www.admitad.com/en/developers/doc/api_en/auth/auth-rights/
AdmitAD API index: https://www.admitad.com/en/developers/doc/api_en/methods/methods-index/
Using this method, you can obtain the publisher’s private information.
HTTP Method | Access rights | Url | Golang API |
---|---|---|---|
GET | private_data private_data_email private_data_phone | /me/ | Me.Me() |
GET | private_data_balance | /me/balance/ | Me.Balance() |
GET | private_data_balance | /me/balance/extended/ | Me.BalanceExtended() |
GET | private_data_balance | /me/payment/settings/ | Me.Settings() |
GET | private_data_balance | /me/payment/settings/{currency}/ | Me.SettingsByCurrency() |
This section contains the methods for working with tech support.
HTTP Method | Access rights | Url | Golang API |
---|---|---|---|
GET | tickets | /tickets/ | Tickets.Get() |
GET | tickets | /tickets/{id}/ | Tickets.ByID() |
POST | manage_tickets | /tickets/create/ | Tickets.Create() |
POST | manage_tickets | /tickets/{id}/create/ | Tickets.CreateCommentOn() |
Using this method, you can obtain the latest news.
HTTP Method | Access rights | Url | Golang API |
---|---|---|---|
GET | public_data | /news/ | News.Get() |
GET | public_data | /news/{id}/ | News.ByID() |
This section contains the methods that allow obtaining our system’s general data that is not user-specific: the list of languages, categories, currencies, etc.
HTTP Method | Access rights | Url | Golang API |
---|---|---|---|
GET | public_data | /news/ | Currencies.Get() |
The complete set of methods for retrieving all kinds of statistics at publisher’s disposal.
HTTP Method | Access rights | Url | Golang API |
---|---|---|---|
GET | statistics | /statistics/sub_ids/ | Statistics.SubID() |
GET | statistics | /statistics/actions/ | Statistics.Actions() and Statistics.ActionsTotal() |
This section contains methods of working with offline deals.
HTTP Method | Access rights | Url | Golang API |
---|---|---|---|
GET | offline_receipts | /offline_receipts/ | OfflineReceipts.Get() |