Page MenuHomePhabricator

Google: Add Accept: header to your HTML requests to RESTBase/Parsoid as per T124365
Closed, ResolvedPublic

Description

T124365#2062088 documents the decision of the ArchCom RFC on API content versioning. Accordingly, Google services should add an Accept: header with the current Parsoid HTML version to your API requests for Parsoid HTML.

Once T128040: Document and implement the REST API format versioning and negotiation policy is resolved, there will be on-wiki documentation about this.

Event Timeline

ssastry renamed this task from Add Accept: header to your HTML requests to RESTBase/Parsoid as per T124365 to Google: Add Accept: header to your HTML requests to RESTBase/Parsoid as per T124365.Feb 26 2016, 11:35 PM
ssastry created this task.
ssastry added a subscriber: Renxiaoyi.
Krenair added a project: Services.

Ack. Please update the topic when T128040 is resolved so that we can start working on our side. And I'm wondering what's the ETA about that?

Thanks,

Ack. Please update the topic when T128040 is resolved so that we can start working on our side. And I'm wondering what's the ETA about that?
Thanks,

Documented at https://www.mediawiki.org/wiki/API_versioning .. Note that the page uses a sample accept-header. For lasest Parsoid, please provide the following header:

text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.2.0"

The next major version bump will be when T78676: Store & load data-mw separately is resolved .. Probably in 3-4 weeks time.

Hi ssastry,

Thanks for the update. However, in my experiments the following curl command

curl -vs -o /dev/null --header "Accept: text/html; charset=utf-8; profile=\"mediawiki.org/specs/html/1.0.0\"" --dump-header /tmp/header https://en.wikipedia.org/api/rest_v1/page/html/New_York/709094805 2>&1

gets response header

Content-Type: text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.2.0"

where I'm expecting profile='mediawiki.org/specs/html/1.0.0'. And another curl command

curl -vs -o /dev/null --header "Accept: text/html; charset=utf-8; profile='mediawiki.org/specs/html/1.2.0'" --dump-header /tmp/header2 https://en.wikipedia.org/api/rest_v1/page/html/NY/652977219 2>&1

gets response header

Content-Type: text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.1.0"

where I'm expecting profile='mediawiki.org/specs/html/1.2.0'. So I'm wondering what's the correct way to use this feature? Is this because the /page/html/title/revision endpoint is "unstable" and the header only works on stable endpoints?

@Renxiaoyi we yet need to implement profile translation. Currently, you get whatever version is stored in RESTBase's storage.

With the next version bump to 1.2.1, we took the opportunity to update the profile header to a valid url with documentation. Please use this instead if you haven't yet implemented this.

'text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.2.1"'

Got it, thanks. Please update the thread when the profile translation is implemented in REST API.

@Renxiaoyi: Please send the Accept header now, before we introduce breaking format changes. See https://www.mediawiki.org/wiki/API_versioning#Content_format_stability_and_-negotiation for the general policy and background, and the specific end point documentation (ex: https://en.wikipedia.org/api/rest_v1/#!/Page_content/getFormatRevision) for the precise content-type.

Thanks for notice. We're already sending requests with header

Accept: text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.2.1"

for some time. I didn't close this task because seems I'm still receiving different versions from the one given in "profile".

Will close the task if this is expected behavior.

Renxiaoyi closed this task as Resolved.Oct 13 2016, 12:51 AM