Context

Run automatic context matching

Changed on

Automatically matches context against strings in the project and creates corresponding bindings. Optionally, you can restrict matching to only a set of strings that you specify to ensure that no unwanted bindings are created.

The following endpoint does not support video contexts pointing to Youtube or Vimeo videos.

Optical Character Recognition (OCR) is used for IMAGE and VIDEO contexts, while HTML context uses an approximate string matching algorithm.

This is a convenient method provided to save time and complexity in your integration. Although that our OCR functionality is advanced, it cannot match 100% of strings. If you need complete context coverage, use either Create string to context bindings endpoint to bind strings manually or check your image contexts in the Smartling Dashboard after running this request to fill in any blanks. Note that OCR quality may be lower if you are using an unusual or script-like font.

Applying this operation to a video context, keep in mind the original context will be removed and image contexts will be created instead for each frame that has one matched string at least. A string can't be bound to multiple frames simultaneously.

post/context-api/v2/projects/{projectId}/contexts/{contextUid}/match/async

Request

  • Base URL
    https://api.smartling.com
  • Auth
    HTTP bearer

Path parameters

projectIdstring required

Unique identifier of a Smartling project — 9 lowercase alphanumeric characters.

Example:84c012a33

A unique project identifier. This can be found in the Smartling Dashboard under Account Settings > API.

contextUidstring uuid required

Unique identifier of a context

Request body

contentFileUristring

URI path of a source file within a Smartling project.

stringHashcodesHashcode[]

An array of string hashcodes to perform matching with the context: <br/> Example: "stringHashcodes": ["hashcode1", "hashcode2"] <br/> Can't be used along with the contentFileUri or translationJobUids parameter.

translationJobUidsTranslationJobUid[]

A translation job UID to perform matching with the context. Only one UID can be specified: <br/> Example: "translationJobUids": ["translationJobUid"] <br/> Can't be used along with the contentFileUri or stringHashcodes parameter.

overrideContextOlderThanDaysinteger

Specifies whether to override context for strings that were already bound to other context, and that context is at least as "overrideContextOlderThanDays" old.

videoMatchingMode'SUBTITLES' | 'OCR_WITH_SPLITTING' | 'OCR'

Specifies the behavior of string matching for video contexts.

videoMatchingModeDescription
SUBTITLESIn this mode you should provide the property contentFileUri that points to the subtitles content file. Strings will be bound by the subtitle's timestamps.
OCR_WITH_SPLITTINGDetects key frames and checks each frame for text using OCR. If string matches, an image context is created for that frame. Frames without matches and the original video are deleted.
OCRDetects key frames and checks each frame for text using OCR. If string matches, we bind the string to the original video using the key frame's timestamp and text coordinates.

Example request

{
  "contentFileUri": "/content/en/home.json",
  "stringHashcodes": [
    "d41d8cd98f00b204e9800998ecf8427e"
  ],
  "translationJobUids": [
    "j45v1uvsi3tx"
  ]
}

Response

ACCEPTED

Example response

{
  "response": {
    "data": {
      "processUid": "097ecbc2-8f1b-4ce5-b5c4-d48c3f0e5d9e"
    }
  }
}

Changes

    • breaking

      added the pattern ^[a-z0-9]{9}$ to the path request parameter projectId

    • breaking

      added to the request property allOf list

    • breaking

      added the pattern ^[a-f0-9]{32}$ to the request property /

    • breaking

      added the pattern ^[a-z0-9]{12}$ to the request property /

    • breaking

      the request property type changed from string to no type

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the response property /// became nullable for the status

    • breaking

      the // response's property type changed from string to no type, and format from uuid to no format for status

    • info

      for the path request parameter projectId, the format was generalized from uuid to no format

    • info

      the / request property format was generalized from hash to no format

    • info

      the / request property format was generalized from hash to no format

    • info

      added to the // response property allOf list for the response status

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property // to the response with the status

    • info

      response property response/data/matchId deprecated