Запуск рассылки

Запуск рассылки#

Запуск рассылки#

POST https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start

Path Parameters#

Name

Type

Description

dispatchId*

integer

Идентификатор рассылки

Headers#

Name

Type

Description

Authorization*

string

Basic {TOKEN_1}

Возвращается идентификатор рассылки.

{
  "dispatchId": 10000000125
}

Использование невалидного токена.

{
    "error": {
        "code": 4012,
        "msg": "Bad credentials"
    }
}
{
    "error": {
        "code": 4010,
        "msg": "Not Authenticated"
    }
}

Использование неподходящего токена.

{
    "error": {
        "code": 4030,
        "msg": "Access Denied"
    }
}

Совет

Данный запрос завершает создание рассылки: после его выполнения в рассылку не могут добавляться сообщения.

Пример запроса#

POST https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
curl --location --globoff --request POST 'https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start' \
--header 'Content-Type: application/json'
import requests
import json

url = "https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start"

payload = {}
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json'
];
$request = new Request('POST', 'https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "https://direct.i-dgtl.ru/api/v1/dispatch/{dispatchId}/start"
  method := "POST"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}