Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
colourBlue
titleAs of 2.0

...

We use a Request.Builder() to create a request object with the multipart body, headers, and the URL. The following headers are necessary for the import because they contain user information of the user accessing the endpoint: Authorization header that contains the Base64-coded credentials of the user and an X-ID-TENANT-NAME header that contains the tenant name of the user. If the used OkHttp client supports cookie handling, the Authorization header can be omitted after the client's first request, since the logon information is stored in a session cookie (see alsoLogin Tutorial).

Code Block
languagejava
titleBuilding a POST Request for an Import
linenumberstrue
Request request = new Request.Builder()
        .header("Authorization", "Basic "+ auth)
        .header("X-ID-TENANT-NAME", tenant)
        .url(baseUrl + "/api/dms/objects") //baseUrl: "http://<host>:<port>"
        .post(requestBody)
        .build();

Anchor
Response
Response
Response

To display the response of the API to the console, we create an associated response object when the request is executed. Please note that an IOException can be thrown by the OkHttpClient when creating the response object.

...

The assembly of the request object is identical to the normal import.

Response

If successful, the response object contains a multi-element objects list that contains the metadata records of all objects imported in this batch import.

...