Assets (1.0)
Download OpenAPI specification:Download
Uploads files that will be hosted by Nexway and then accessed through public https links. Assets can be transferred as text, binary data or URL link.
List assets
Returns collection of public URLs. For internal use by Nexway.
Authorizations:
query Parameters
size | integer <int64> Default: 50 Amount of items returned per pagination page |
page | integer <int64> Default: 0 Pagination page starting from 0 |
Responses
Response samples
- 200
- 400
- 401
- 403
- 500
{- "format": "short",
- "items": [
], - "last": false,
- "number": 41,
- "size": 10,
- "totalItems": 100523,
- "totalPages": 10053
}
Upload asset
File is transferred using multipart/form-data https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 As a result service will return a public https link to resource. File content is used to generate id of the asset, hence files cannot be duplicated. In such case asset is re-uploaded to already existing location. Only one file can be sent at once.
Usage and integration examples
curl
Transfer file from disk
curl -i -X POST \
https://api.staging.nexway.build/assets \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-F file=@"/home/user/Pictures/nexway_main.png"
Transfer using url
curl -i -X POST \
https://api.staging.nexway.build/assets \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-F url="https://www.nexway.com/wp-content/uploads/2019/08/nexway_main.png"
Define file content type
curl -i -X POST \
https://api.staging.nexway.build/assets \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-F file=@"/home//user/Documents/report.csv;type=text/csv"
golang
// Download file from URL
fileResp, _ := http.Get("https://www.nexway.com/wp-content/uploads/2019/08/nexway_main.png")
defer fileResp.Body.Close()
// create multipart form
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
h := make(textproto.MIMEHeader)
h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, "file", "nexway_main.png"))
h.Set("Content-Type", "image/png")
part, _ := writer.CreatePart(h)
io.Copy(part, fileResp.Body)
writer.Close()
// Execute the request
r, _ := http.NewRequest("POST", "https://api.staging.nexway.build/assets", body)
r.Header.Add("Content-Type", writer.FormDataContentType())
r.Header.Add("Authorization", "Bearer "+os.Getenv("JWT_TOKEN"))
client := &http.Client{}
resp, _ := client.Do(r)
// Results
fmt.Println("Headers", resp.Header)
bodyBytes, _ := ioutil.ReadAll(resp.Body)
fmt.Println("Body", string(bodyBytes))
java
// Create multipart form
File file = new File("/home/user/Pictures/nexway_main.png");
String boundary = "JavaMultiFormBoundary58c6x3GIcM";
HttpEntity reqEntity = MultipartEntityBuilder.create()
.setBoundary(boundary)
.addBinaryBody("file", file, ContentType.IMAGE_PNG, "nexway_main.png")
.build();
// Create post request with form
HttpPost httpPost = new HttpPost("https://api.staging.nexway.build/assets");
httpPost.setHeader("Authorization", "Bearer "+System.getenv("JWT_TOKEN"));
httpPost.setHeader("Content-Type", "multipart/form-data; boundary="+boundary);
httpPost.setEntity(reqEntity);
// Execute request
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
System.out.println("Response: " + httpResponse);
System.out.println("Response Body : " + EntityUtils.toString(httpResponse.getEntity(), "UTF-8"));
httpClient.close();
Authorizations:
Request Body schema: multipart/form-data
file | string <binary> Upload file from hard drive |
url | string Upload by URL |
Responses
Response samples
- 400
- 401
- 403
- 500
{- "error": "Bad Request",
- "message": "error: field can't be empty",
- "path": "/service-name/resource/36a6d3ac-207f-4b64-be01-664c1edbd38b",
- "status": 400,
- "timestamp": 1593769514607
}
Delete assets
Only Nexway employee can delete the assets.
Authorizations:
Request Body schema: multipart/form-data
ids | Array of strings The request contains a list of up to 1000 keys that you want to delete |
Responses
Response samples
- 400
- 401
- 403
- 500
{- "error": "Bad Request",
- "message": "error: field can't be empty",
- "path": "/service-name/resource/36a6d3ac-207f-4b64-be01-664c1edbd38b",
- "status": 400,
- "timestamp": 1593769514607
}
Control Assets
Evaluates whether product-related content file is stored in the order.
Authorizations:
path Parameters
orderId required | string Order id |
filename required | string File name without URL and MDAUTH e.g. software.exe |
Responses
Response samples
- 401
- 403
- 500
{- "error": "Unauthorized",
- "message": "Unauthorized",
- "path": "/service-name/resource/36a6d3ac-207f-4b64-be01-664c1edbd38b",
- "status": 401,
- "timestamp": 1593769514607
}