Skip to content

Commit

Permalink
Add note to remind server users to update hostname in API examples (#…
Browse files Browse the repository at this point in the history
…9137)

* add note for api examples for server readers

* add note about using server hostname to all how-to guides that use the API

* add more context to the note
  • Loading branch information
rosieyohannan authored Dec 17, 2024
1 parent 8019219 commit 2ba183f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jekyll/_cci2/api-developers-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ contentTags:

This guide was written to assist developers in making API calls to CircleCI services to return detailed information about users, pipelines, projects, and workflows. The API v2 Specification itself may be viewed in the https://circleci.com/docs/api/v2/[Reference documentation].

include::../_includes/partials/notes/server-api-examples.adoc[]

[#api-categories]
== API categories

Expand Down
2 changes: 2 additions & 0 deletions jekyll/_cci2/artifacts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ When CircleCI runs a job, a link to the core dump file appears in the *Artifacts
[#downloading-all-artifacts-for-a-build-on-circleci]
== Downloading all artifacts for a build on CircleCI

include::../_includes/partials/notes/server-api-examples.adoc[]

To download your artifacts with `curl`, follow the steps below.

. xref:managing-api-tokens#creating-a-personal-api-token[Create a personal API token] and copy it to a clipboard.
Expand Down
2 changes: 2 additions & 0 deletions jekyll/_cci2/configuration-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2861,6 +2861,8 @@ workflows:

You can use the API to trigger a pipeline with a pipeline parameter set to true:

include::../_includes/partials/notes/server-api-examples.adoc[]

[source,yml]
----
curl -X POST https://circleci.com/api/v2/project/circleci/<org-id>/<project-id>/pipeline/run \
Expand Down
2 changes: 2 additions & 0 deletions jekyll/_cci2/contexts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ Follow these steps to set an expression restriction on a context:

[.tab.set-expression-restriction.API]
--
include::../_includes/partials/notes/server-api-examples.adoc[]

. Set up your API authentication. Steps are available in the xref:api-developers-guide#add-an-api-token[API developers guide].
. You are going to need your organization ID. In the link:https://app.circleci.com/[CircleCI web app] select **Organization Settings** in the sidebar and copy your "Organization ID" somewhere safe.
. To get the ID for your context, list your contexts, as follows, substituting your organization ID:
Expand Down
2 changes: 2 additions & 0 deletions jekyll/_cci2/inject-environment-variables-with-api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ contentTags:
:icons: font
:experimental:

include::../_includes/partials/notes/server-api-examples.adoc[]

[#api-v2]
== API v2

Expand Down
2 changes: 2 additions & 0 deletions jekyll/_cci2/pipeline-variables.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ jobs:
[#passing-parameters-when-triggering-pipelines-via-the-api]
=== Passing parameters when triggering pipelines via the API

include::../_includes/partials/notes/server-api-examples.adoc[]

A pipeline can be triggered with specific `parameter` values using the API v2 endpoint to link:https://circleci.com/docs/api/v2/#trigger-a-new-pipeline[trigger a pipeline]. This can be done by passing a `parameters` key in the JSON packet of the `POST` body.

The API limits the number of parameters that can be passed:
Expand Down
2 changes: 2 additions & 0 deletions jekyll/_cci2/workflows.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ To approve a job follow these steps:

[.tab.approve.API]
--
include::../_includes/partials/notes/server-api-examples.adoc[]

. Set up your API authentication. Steps are available in the xref:api-developers-guide#add-an-api-token[API developers guide].
. You need your workflow ID and the `approval_request_id` (which is the job ID for the job requiring approval) to make the API POST request. Depending on your use case, you might be configuring an approval job in a pipeline, or using an external service to approve a job. You can get the required parameters using xref:variables#[pipeline values or environment variables], or by xref:webhooks#[receiving webhooks] or polling the API. To approve a job, use the link:https://circleci.com/docs/api/v2/index.html#operation/approvePendingApprovalJobById[approve a job] endpoint, for example:
+
Expand Down
1 change: 1 addition & 0 deletions jekyll/_includes/partials/notes/server-api-examples.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTE: **Using server?** If you are using CircleCI server, replace `https://circleci.com` with your server hostname when interacting with the CircleCI API.

0 comments on commit 2ba183f

Please sign in to comment.