Resources

Resource container list

Returns the list of the resource containers (files) of a given project

REQUEST

GET /v1/{workspaceUrl}/projects/{projectUrl}/resources

PARAMETERS

  • workspaceUrl required (path) - Workspace URL

  • projectUrl required (path) - Project URL

  • localeInFileName (query) - determines if the locale info should be rendered in the file name: ALL(default), TARGETS, NONE.

  • addIso2Slug (query) - if true the iso2_slug parameter will be always added to the rendered resource file URLs.

RESPONSE

OK: Returns a list of the project's resource containers (files).

{
  "members": [
  {
   "name": "string",
   "links": [
    {
     "rel": "string",
     "href": "string",
     "media": "string",
     "title": "string",
     "type": "string"
    }
   ],
   "project_locale": "string"
  }
 ],
 "links": [
  {
   "rel": "string",
   "href": "string",
   "media": "string",
   "title": "string",
   "type": "string"
  }
 ]
}

Upload resource file

Uploads & imports the given resource file to the specified project

REQUEST

POST /v1/{workspaceUrl}/projects/{projectUrl}/resources

Since this is a multipart/form-data request, we will show an example based on curl:

curl -X POST "https://api.lingohub.com/v1/lingohub-workspace/projects/my-project/resources" \
  -F "iso2_slug=en" \ 
  -F "path=/config/locales" \
  -F "file=@/config/locales/translations.en.json"

PARAMETERS

  • workspaceUrl required (path) - Workspace URL

  • projectUrl required (path) - Project URL

  • file required (request body) - the file content as request body having Content-Disposition: form-data; name="file"

  • path (query) - to which path the resource file has to be uploaded

  • iso2_slug (query) - The iso code of the resource file language. Alias of iso2_code

  • iso2_code (query) - The iso code of the resource file language. Alias of iso_slug

  • source:createNew (query, boolean) - if this file belongs to the source language: new segments should be created

  • source:updateExisting (query, boolean) - if this file belongs to the source language: changed segments should be updated

  • source:deactivateMissing (query, boolean) - if this file belongs to the source language: removed segments should be deactivated

  • target:createNew (query, boolean) - if this file belongs to the target language: new segments should be created

  • target:updateExisting (query, boolean) - if this file belongs to the target language: changed segments should be updated

  • target:deactivateMissing (query, boolean) - if this file belongs to the target language: removed segments should be deactivated

Download resource file

Exports & downloads the requested resource file

REQUEST

GET /v1/{workspaceUrl}/projects/{projectUrl}/resources/{fileName}

PARAMETERS

  • workspaceUrl required (path) - Workspace URL

  • projectUrl required (path) - Project URL

  • fileName required (path) - Name of the resource file to download

  • path (query) - the specified path of the resource container (file) to download. If a path has been specified

  • iso2_slug (query) - The iso code of the resource file language. Alias of iso2_code

  • iso2_code (query) - The iso code of the resource file language. Alias of iso_slug

  • source:blankContentHandling (query) - Should the segment be exported if source content is blank. One of: keep, skip

  • target:blankContentHandling (query) - Should the segment be exported if target content is blank. One of: fallback, use_source, keep, skip

  • source:filterByStatus (query) - Filter for source segments based on status. One of: ALL, TRANSLATED_AND_APPROVED, APPROVED

  • target:filterByStatus (query) - Filter for target segments based on status. One of: ALL, TRANSLATED_AND_APPROVED, APPROVED

  • htmlEncoding (query) - If the segment content holds HTML, how should it be escaped? One of: RAW, ESCAPE, CDATA

  • encoding (query) - The character encoding that has to be used to render the file. Eg. UTF-8, UTF-16, ISO-8859-1

  • escapeMode (query) - Alias of htmlEncoding

  • addLocaleInformationToFilename (query) - If the language (locale) information should be part of the file name. One of: ALL, TARGETS, NONE

  • escapeCharacters (query, boolean) - If special characters should be escaped. Different behaviour according to the resource type

  • exportTargetComments (query, boolean) - Should comments be exported to files of the target language?

  • exportSourceLocale (query, boolean) - If a resource file holds multiple languages, this indicates if the source language should be included in this export

  • exportHeader (query, boolean) - If the file header (if applicable) should be exported

  • exportTitle (query, boolean) - If the title of the segments should be rendered in this export

  • exportDescription (query) - If the description of the segments should be rendered in this export

  • projectType (query) - Overrides the project type of the project for this export. Enables to eg. download an iOS file as Android XML or vice versa.

Delete Resource container

Deletes the addressed resource container from the given project.

For addressing the resource container, the fileName and path of the resource belonging to the source language has to be given. If the target language is provided, an error will be responded.

REQUEST

DELETE /v1/{workspaceUrl}/projects/{projectUrl}/resources/{fileName}

PARAMETERS

  • workspaceUrl required (path) - Workspace URL

  • projectUrl required (path) - Project URL

  • fileName required (path) - Name of the resource file to download

  • path (query) - the specified path of the resource container (file) to download. If a path has been specified

RESPONSE

OK: if the resource container has been deleted NOT_FOUND: Not able to determine the resource container BAD_REQUEST: The specified file name/path has to belong to the source language of the project

Last updated