Skip to content

Public API GA #3390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_data/glossary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Analytics.js: |
The Segment Javascript library wrapper, which makes it simple to send your data to any tool without having to learn, test or implement the new API for each tool every time.

API: |
Application Programming Interface. In software, this term describes a way of interacting with software in an automated fashion, without the use of a user-interface designed for humans. In Segment, we call the standard calls (`track`, `page` and `screen`, `identify` and `group`) our API. We also provide the [Config API](/docs/config-api/), which you can use to configure sources and destinations, and perform other functions in your workspace, without logging in using a web browser.
Application Programming Interface. In software, this term describes a way of interacting with software in an automated fashion, without the use of a user-interface designed for humans. In Segment, we call the standard calls (`track`, `page` and `screen`, `identify` and `group`) our API. We also provide the [Public API](/docs/api/), which you can use to configure sources and destinations, and perform other functions in your workspace, without logging in using a web browser.

App: |
The app is what we call the main Segment web application, the part you log in to, and where you configure sources and destinations, see events in the debugger, manage your tracking plan, and so on.
Expand Down
20 changes: 20 additions & 0 deletions src/_data/sidenav/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,23 @@ sections:
title: Prod and Testing Environments in Segment
- path: /segment-app/verify-email-address
title: Verifying Your Email Address
- section_title: API
section:
- path: /api
title: Public API
- section_title: Config API
slug: api/config-api
section:
- path: /api/config-api
title: Config API overview
- path: /api/config-api/api-design
title: API design
- path: /api/config-api/authentication
title: Authentication
- path: /api/config-api/fql
title: Destination Filter Query Language
# - path: "https://reference.segmentapis.com/"
# title: Reference
# menu_icon: new-tab
# - path: /config-api/tutorial-javascript-google-analytics
# title: Creating a Javascript web source and Google Analytics destination
8 changes: 8 additions & 0 deletions src/_includes/content/papi-ga.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="premonition success">
<div class="fa fa-info-circle"></div>
<div class="content">
<p class="header">The Segment Public API is available</p>
<p markdown=1>Segment's [Public API](/docs/api) is available to use. You can use the Public API and Config APIs in parallel, but moving forward any API updates will come to the Public API exclusively. </p>
<p markdown=1>Please contact your account team or [friends@segment.com](mailto:friends@segment.com) with any questions.</p>
</div>
</div>
5 changes: 5 additions & 0 deletions src/_includes/icons/api.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions src/_includes/menu/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
<div class="sidebar">
<div class="sidebar__content">
{% include menu/menu-primary.html %}

<nav class="menu">
<ul class="list list--unstyle">
<li class="menu-item">
<a class="menu-item__link menu-item__link--highlight menu-item__link--icon flex flex--middle" href="{{ site.baseurl }}/config-api/">
<div class="menu-item__icon flex__column">
{% include icons/config-api.svg %}
</div>

<div class="flex__column">Config API</div>
</a>
</li>

<li class="menu-item {% if currentPage == "help" %}menu-item--active{% endif %}">
<a class="menu-item__link menu-item__link--highlight menu-item__link--icon flex flex--middle" href="{{ site.baseurl }}/help/">
<div class="menu-item__icon flex__column">
Expand Down
2 changes: 0 additions & 2 deletions src/_layouts/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
{% include menu/menu-glossary.html %}
{% elsif currentPage[1] == 'partners' %}
{% include menu/menu-partners.html %}
{% elsif currentPage[1] == 'config-api' %}
{% include menu/menu-config-api.html %}
{% else %}
{% include menu/menu.html %}
{% endif %}
Expand Down
17 changes: 15 additions & 2 deletions src/_sass/components/_markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,16 @@
top: 0;
left: 0;
}

div.highlighter-rouge {
margin: 15px auto;
position: relative;
}

table {
margin: 15px auto;
}

&>ul,
ol {
margin-top: 0;
Expand Down Expand Up @@ -213,6 +216,14 @@
line-height: 1.5;
padding: 24px;
}

img {
border: none;
display: inline;
margin: 0;
vertical-align: inherit;
}

}

thead {
Expand Down Expand Up @@ -309,7 +320,7 @@
}

//a[target="_blank"]:not(.reference-button):after {
//content: url("/docs/images/external-link-alt-solid.svg");
//content: url("/docs/images/external-link-alt-solid.svg");
// margin-left: 4px;
//}

Expand Down Expand Up @@ -406,12 +417,14 @@ div.highlighter-rouge {
right: 0;
border-radius: 0 0.15rem;
width: 40px;

img {
width: 16px;
margin: 0;
border: none;
border-radius: 0px;
}

img:hover {
filter: invert(65%) sepia(9%) saturate(784%) hue-rotate(192deg) brightness(91%) contrast(87%);
transition: 0.2s ease-out;
Expand All @@ -422,7 +435,7 @@ div.highlighter-rouge {
}
}

.green{
.green {
background-color: #BAE5D5;
content: "copied!";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: API Design
---

{% include content/papi-ga.html %}

## API Evolution: Versioning and Compatibility

Segment strives to maintain a strict contract around the stability of our APIs once they reach maturity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
title: Authentication
---

{% include content/papi-ga.html %}


You can access the Config API programmatically using access tokens. When you authenticate with an access token, you have access to any resource and permission assigned to the token.

## Create an Access Token
Expand Down
3 changes: 3 additions & 0 deletions src/config-api/fql.md → src/api/config-api/fql.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
title: Destination Filter Query Language
---

{% include content/papi-ga.html %}


Destination Filter Reference documentation can be found in the [main Config API reference docs](https://reference.segmentapis.com/#6c12fbe8-9f84-4a6c-848e-76a2325cb3c5).

Filter Query Language ("FQL") is a simple language for filtering JSON objects used by the Transformations API to conditionally apply transformations. In the Transformations API, FQL statements evaluate to `true` or `false` based on the contents of each Segment event. If the statement evaluates to `true`, the transformation is applied, and if it is `false` the transformation is not applied.
Expand Down
5 changes: 1 addition & 4 deletions src/config-api/index.md → src/api/config-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
title: Config API Overview
---

> info "The Segment Public API: Beta Release"
> The Segment Public API is available in Public Beta. This new API features more consistent endpoints, improved error handling and reporting, support for pagination, and more.
>
> See the [Segment Public API documentation](https://api.segmentapis.com/docs/){:target="_blank"} for more information.
{% include content/papi-ga.html %}

The Config API enables you to programmatically manage Segment workspaces, sources, destinations and more. With the API you can:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Reference
feedback: false
hide-feedback: true
published: false
---

See the [Segment Config API Reference](https://reference.segmentapis.com/) hosted by [Postman](https://www.getpostman.com/).
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'Creating a JavaScript web source and Google Analytics destination'
sidebar: 'Tutorial: Google Analytics Destination'
published: false
---

Segment makes it easy to collect data from cloud services (for example, advertising, helpdesk, and marketing) and send it to many destination services (for example, CRM services and data warehouses).
Expand Down
27 changes: 27 additions & 0 deletions src/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Public API
---
The Segment Public API helps you manage your Segment workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs.

All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a workspace.

{% include components/reference-button.html
href="https://docs.segmentapis.com"
icon="media/programming.svg"
title="Segment Public API Documentation"
description="Research and test the Public API's available endpoints."
%}

## Config API vs Public API
The Public API includes the following benefits over the Config API:

| Benefit | Details |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Future Enhancements | Future improvements will be added to the Public API only. |
| Improved error handling | The Public API offers more specific error messages, for faster issue resolution. |
| Versioning | Each endpoint on the Public API can have multiple versions. Stable versions can coexist with beta or alpha versions. |
| Higher rate limits | The Public API can offer higher rate limits when needed or different rate limits per endpoint or token. |
| Improved architecture | The Public API is built with improved security, checks for authentication, authorization, input validation, HTTPS exposed services, auto-scaling, and more in mind. |
| Cleaner mapping | The Public API uses unique IDs for reference, in place of slugs in the Config API. Unique IDs are, by design, unique. |
| Available in Europe | The Public API is accessible to both US and EU-based workspaces. |
| Increased reliability | The Public API features more stable endpoints, and a 99.8% success rate |
12 changes: 6 additions & 6 deletions src/connections/destinations/add-destination.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Destinations are tools or services which can use the data sent from Segment to p

## Adding a destination

There are two ways to add a destination to your deployment: using the Segment web app, or using the [Config API](/docs/config-api/).
There are two ways to add a destination to your deployment: using the Segment web app, or using the [Public API](/docs/api/).


#### Adding a destination from the Segment web app
Expand Down Expand Up @@ -46,12 +46,12 @@ You can also add a destination directly from the source's settings page in the S
6. On the next page, find the **Connection Settings** section, and enter the token or credentials for that destination tool.
7. Click the toggle at the top of the Settings page to enable the destination.

#### Adding a destination using the Config API
#### Adding a destination using the Public API

You can use the Segment Config API to add destinations to your workspace using the [Create Destination endpoint](https://reference.segmentapis.com/#51d965d3-4a67-4542-ae2c-eb1fdddc3df6). The API requires an authorization token, and uses the `name` field as a namespace that defines which _source_ the destination is connected to. You send the rest of the destination's configuration as a JSON blob. View the documentation page in the Segment Catalog, or query the [Segment Catalog API](https://reference.segmentapis.com/#7a63ac88-43af-43db-a987-7ed7d677a8c8), for a destination to see the available settings.
You can use the Segment Public API to add destinations to your workspace using the [Create Destination endpoint](https://docs.segmentapis.com/tag/Destinations#operation/createDestination){:target = "_blank"}. The API requires an authorization token, and uses the `name` field as a namespace that defines which _source_ the destination is connected to. You send the rest of the destination's configuration as a JSON blob. View the documentation page in the Segment Catalog, or query the [Segment Catalog API](https://docs.segmentapis.com/tag/Catalog){:target="_blank"}, for a destination to see the available settings.

> success ""
> You must use an authorization token to access the Config API, and these tokens are tied to specific workspaces. If you use the Config API to access multiple workspaces, make sure you're using the token for the workspace you want to access before proceeding.
> You must use an authorization token to access the Public API, and these tokens are tied to specific workspaces. If you use the Public API to access multiple workspaces, make sure you're using the token for the workspace you want to access before proceeding.


## What happens when you add a destination
Expand Down Expand Up @@ -120,9 +120,9 @@ You can create unique destination filters for each destination instance connecte
It is not possible to connect multiple instances of one source (for example, two website sources) to the same destination. However, you can create another instance of the destination for the other sources, and click **Copy Settings From Other Destination** to save yourself time entering the settings values again.


### Connect to more than one instance of a destination using the Config API
### Connect to more than one instance of a destination using the Public API

You can add multiple instances of a destination using the Segment Config API. See the Segment Config [API documentation](https://reference.segmentapis.com/?version=latest#39ce0439-0969-48c3-ba49-b22a46c41060). If a destination does not support multi-instance, the Config API throws an appropriate error.
You can add multiple instances of a destination using the Segment Public API. See the Segment Config [API documentation](https://docs.segmentapis.com/){:target="_blank"}. If a destination does not support multi-instance, the Public API throws an appropriate error.


### Multi-instance destinations and Device-mode
Expand Down
4 changes: 2 additions & 2 deletions src/connections/destinations/repeater-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ You can create a QA instance of your destination to verify that it is configured
1. If you created a QA instance of the Repeater and you created a QA destination instance, you can test this process before you use production data.


2. You can disable the repeater and enable the new destination instance manually in the Segment web app, or by using the [Segment Config API](/docs/config-api/).
2. You can disable the repeater and enable the new destination instance manually in the Segment web app, or by using the [Segment Public API](/docs/-api/).

- **If the destination can de-duplicate events**, enable the new instance of the destination, and _then_ disable the Repeater.
- **If the destination does not de-duplicate events**, you can disable the Repeater and then enable the new instance of the destination.
This could result in minor data loss during the few seconds between the Repeater being disabled and the new destination instance being enabled. You can use the Segment Config API [Update Destination endpoint](https://reference.segmentapis.com/#f25d9ac1-3e20-4635-8687-26ed4153086d) to disable and enable destinations quickly, which can minimize the time between these two actions. However, we cannot guarantee that no data will be lost.
This could result in minor data loss during the few seconds between the Repeater being disabled and the new destination instance being enabled. You can use the Segment Public API [Update Destination endpoint](https://docs.segmentapis.com/tag/Destinations#operation/updateDestination){:target="_blank"} to disable and enable destinations quickly, which can minimize the time between these two actions. Segment does not guarantee that no data will be lost.
If your workspace is on the Business Tier, and the destination supports [Replay](/docs/guides/what-is-replay/), you can replay the data from that period into the new destination instance. Replays are available for any destinations that support cloud-mode data (meaning data routed through Segment) and that also process timestamps. Contact your CSM for more information about replays. If the destination does not de-duplicate events and replays are not available, you can manually delete duplicate events in the destination.
2 changes: 1 addition & 1 deletion src/connections/functions/destination-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ To test the batch handler:

The editor displays logs and request traces from the batch handler.

The [Config API](/docs/config-api/) Functions/Preview endpoint also supports testing batch handlers. The payload must be a batch of events as a JSON array.
The [Public API](/docs/api/) Functions/Preview endpoint also supports testing batch handlers. The payload must be a batch of events as a JSON array.

### Handling batching errors

Expand Down
2 changes: 1 addition & 1 deletion src/connections/storage/catalog/aws-s3/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ To finish configuration, enable the AWS S3 Destination with IAM Role Support des
6. Verify Segment data is stored in the S3 bucket by navigating to the `<your_S3_bucket>/segment-logs` in the AWS console. The bucket will take roughly 1 hour to begin receiving data.

> info ""
> Did you know you can create destinations with the Config API? For more information, see [Create Destination](https://reference.segmentapis.com/#51d965d3-4a67-4542-ae2c-eb1fdddc3df6){:target="_blank"}.
> Did you know you can create destinations with the Public API? For more information, see [Create Destination](https://docs.segmentapis.com/tag/Destinations#operation/createDestination){:target="_blank"}.

## Migrate existing destinations

Expand Down
2 changes: 1 addition & 1 deletion src/connections/storage/warehouses/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Amazon's service has some more powerful features and will be more cost-effective
When you create a new source, the source syncs to all warehouse(s) in the workspace by default. You can prevent the source from syncing to some or all warehouses in the workspace in two ways:

- **Segment app**: When you add a source from the Workspace Overview page, deselect the warehouse(s) you don't want the source to sync to as part of the "Add Source" process. All warehouses are automatically selected by default.
- **Config API**: Send a [PATCH Connected Warehouse request](https://reference.segmentapis.com/?version=latest#ec12dae0-1a3e-4bd0-bf1c-840f43537ee2) to update the settings for the warehouse(s) you want to prevent from syncing.
- **Public API**: Send a request to the [Update Warehouse](https://docs.segmentapis.com/tag/Warehouses#operation/updateWarehouse) endpoint to update the settings for the warehouse(s) you want to prevent from syncing.

After a source is created, you can enable or disable a warehouse sync within the Warehouse Settings page.

Expand Down
2 changes: 1 addition & 1 deletion src/guides/usage-and-billing/account-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You should also change your write keys for each source and remove all Segment sn

## What happens if I change my workspace name or slug?

Changing your workspace name or slug won't impact any sources or destinations you've already configured. If you're using [Segment's Config API](/docs/config-api/), though, you'll need to change the slug in your request URLs.
Changing your workspace name or slug won't impact any sources or destinations you've already configured. If you're using [Segment's Public API](/docs/api), you'll need to change the slug in your request URLs.

## Can I recover a source or workspace after I delete it?

Expand Down
Loading