Skip to content

Test whether a webhook is sent successfully

POST /api/v5/repos/{owner}/{repo}/hooks/{id}/tests

This endpoint tests whether the webhook of the specified repository is sent successfully. By triggering a test request, it helps developers verify the webhook configuration and the connectivity of the callback URL, so that push notification issues can be diagnosed and fixed in time.

Supported access tokens

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace that owns the repository (the address path of an enterprise, organization, or individual)
repo path string Yes Repository path (path)
id path string Yes Webhook ID
access_token query string Yes User authorization code

Response parameters

On success, the endpoint returns an empty object {{}} and has no response fields.

Error response

Besides the success response, callers also need to know the shape of failure responses. The following examples are generic forms only; the actual error field names are those returned by the backend.

401 Unauthenticated

{{
  "message": "Unauthenticated or invalid access token"
}}

404 Resource not found

{{
  "message": "Repository or webhook does not exist"
}}

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden
404 Resource not found (Not found)

Request example

Parameter description

Replace <owner> with the address path of the namespace that owns the repository (the address path of an enterprise, organization, or individual); replace <repo> with the repository path (path); replace <id> with the webhook ID; replace <token> with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/hooks/<id>/tests?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/hooks/<id>/tests?access_token=<token>",
  {{
    method: "POST",
    headers: {{
      "Accept": "application/json",
    }},
  }}
);

if (!response.ok) {{
  throw new Error(`Request failed: ${{response.status}}`);
}}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/hooks/<id>/tests",
    params={{"access_token": "<token>"}},
    headers={{"Accept": "application/json"}},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{{}}

Error codes

Error code Description
400 Invalid parameters or the request cannot be parsed
401 Unauthenticated or invalid credentials
403 Forbidden
404 Request path does not exist
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc