# Multiple APIs within the same Service and Content Negotiation

**URL:** <https://discuss.jsonapi.org/t/multiple-apis-within-the-same-service-and-content-negotiation/312>\
**Category:** Uncategorized\
**Created:** [January 24, 2016, 12:06am UTC](https://discuss.jsonapi.org/t/multiple-apis-within-the-same-service-and-content-negotiation/312 "2016-01-24T00:06:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicente](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/vicente/32/194_2.png) [@vicente](https://discuss.jsonapi.org/u/vicente)\
**Post date:** [January 24, 2016, 12:06am UTC](https://discuss.jsonapi.org/t/multiple-apis-within-the-same-service-and-content-negotiation/312/1 "2016-01-24T00:06:06Z")

</div>

Hello everyone,

I’m using JSONAPI to implement Service-to-Service communication and Application-to-Service communication. I’d like to know if the following Content Negotiation strategy is aligned with JSONAPI 1.0.

Can I use the `Accept` header to the tell server **which** API I’d like clients to use?

> Clients **MUST** send all JSON API data in request documents with the header `Content-Type: application/vnd.api+json` without any media type parameters.  
> Clients that include the JSON API media type in their Accept header **MUST** specify the media type there at least once without any media type parameters.

In the dependency diagram below, you can see that my Collector Service publishes two different APIs for two different supporting actors.

```auto
      application/vnd.harvester-api-1.0+json

+-------------+ +-------------+
| | | |
| Collector | | Harvester |
| Service <----------------+ Service |
| | | |
+------+------+ +-------------+
       ^
       |
       | application/vnd.dashboard-api-1.0+json
       |
       |
+------+------+
| |
| Dashboard |
| Application |
| |
+-------------+

```

When the Harvester Service pushes data to the Collector it’d use:

```auto
POST /events
Content-Type: application/vnd.api+json
Accept: application/vnd.harvester-1.0-+json

```

When it’s the Dashboard Application the one pulling data, it’d use:

```auto
GET /events
Content-Type: application/vnd.api+json
Accept: application/vnd.dashboard-api-1.0-+json

```

I could express the same separation of concerns using namespaces in the URL, it’s my personal preference to keep URLs “clean”.

```auto
POST /harvester/1/events
GET /dashboard/1/events

```

I was wondering if the `Content-Type` vs `Accept` header would be considered still valid.

---

<div class="post-metadata">

**Author:** ![dmcwherter](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/dmcwherter/32/192_2.png) [@dmcwherter](https://discuss.jsonapi.org/u/dmcwherter)\
**Post date:** [January 26, 2016, 6:10pm UTC](https://discuss.jsonapi.org/t/multiple-apis-within-the-same-service-and-content-negotiation/312/2 "2016-01-26T18:10:34Z")

</div>

As far as I can tell, this is a server implementation detail since I cannot find anywhere in the spec where this is addressed. Generally, this is the purpose of the accept header.

That being said, if you want to remain spec compliant, you could consider building this out as [an extension](http://jsonapi.org/extensions/#extension-negotiation) which allows you to tack on some other information to the headers.
