Running a Postman API using Newman command which currently uploads a single file. My requirement is to upload multiple files using this same API.
My current code which uploads a single file looks like this:-
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"description": "Jpeg image or video (mov or mp4)",
"type": "file",
"src": "C:\\Test\\abc.jpeg"
}
]
}
In this very same code, I want to upload multiple files.
Need some direction on how can I achieve it.
I post multi file in postman/newman by sending multi POST requests - one file per request.
So you can send many files executing one postman collection of requests.
Edit:
Example of form with 2 file field:
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "myFile1",
"description": "Jpeg image or video (mov or mp4)",
"type": "file",
"src": "C:\\Test\\abc.jpeg"
},
{
"key": "myFile2",
"description": "Jpeg image or video (mov or mp4)",
"type": "file",
"src": "C:\\Test\\def.jpeg"
}
]
}
Related
When retrieving Folder Contents, or Item, or Versions in BIM 360 via API, the "Description" is not included. Any thoughts or updates?
Trying to get files metadata from BIM 360 - all going well except that the files' "Description" is not included.
{
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:-YFunNGUQf-64qpgkfeGMA",
"attributes": {
"displayName": "TP9-AST-105000-BB0A-MB-AR-LOCKERS.rvt",
"createTime": "2022-03-18T11:25:27.0000000Z",
"createUserId": "DFZGQKV2NRSF",
"createUserName": "Mohammed Irfan Mirza Baig",
"lastModifiedTime": "2023-02-01T12:38:11.0000000Z",
"lastModifiedUserId": "ZNAVNEM5G6JM",
"lastModifiedUserName": "Mirna Khoury",
"hidden": false,
"reserved": false,
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.bim360:File-1.0"
},
"data": {
"sourceFileName": "TP9-AST-105000-BB0A-MB-AR-LOCKERS.rvt"
}
}
},
Using test listing information I'm trying to send a http put request to eBay using powerautomate. To set up my HTTP action I've followed the API instructions for the createOrReplaceInventoryItem action.
Ebay API Documentation
I continue to get the below error:
{"errors":[{"errorId":25709,"domain":"API_INVENTORY","subdomain":"Selling","category":"REQUEST","message":"Invalid
value for header Content-Language."}]}
I have read many articles where they have suggested changing Content-Language to Accepted-Language but that has not resolved the issue. Another article said to assign it to the HTTPContent instance but I'm unaware how to do this within powerapps.
Link to Suggestion on this thread
Here is the Request:
{
"uri": "https://api.ebay.com/sell/inventory/v1/inventory_item/TestMonkey",
"method": "PUT",
"headers": {
"Authorization": "*sanitized*",
"Content-Language\t": "en_US",
"Content-Type": "application/json",
"X-EBAY-C-MARKETPLACE-ID": "EBAY_US"
},
"body": {
"availability": {
"shipToLocationAvailability": {
"quantity": 50
}
},
"condition": "NEW",
"product": {
"title": "GoPro Hero4 Helmet Cam",
"description": "New GoPro Hero4 Helmet Cam. Unopened box.",
"aspects": {
"Brand": [
"GoPro"
],
"Type": [
"Helmet/Action"
],
"Storage Type": [
"Removable"
],
"Recording Definition": [
"High Definition"
],
"Media Format": [
"Flash Drive (SSD)"
],
"Optical Zoom": [
"10x"
]
},
"brand": "GoPro",
"mpn": "CHDHX-401",
"imageUrls": [
"https://coolbackgrounds.io/images/backgrounds/white/pure-white-background-85a2a7fd.jpg"
]
}
}
How should I configure the Content-Language header value in powerautomate?
Thank you in advance.
I am referring information on following url.
https://ibm-public-cos.github.io/crs-docs/about-compatibility-api#operations-on-buckets
As mentioned in above URL,there are 3 Objects related IBM cloud storage object API which are accessible.However,some APIs of IBM CSO API are not accessible e.g. PUT Bucket ACL & GET Bucket ACL and getting 403 error message while accessing them with POSTMAN.I need information that how can we access these APIs? Please provide any information related to it.
Any help is greatly appreciated.
As of today, GET/PUT Bucket ACL are supported in IBM COS. If you are using Postman, here's an example of a Postman dump for these (obviously you'll need to calculate the Authorization header and use all of your own info, this is just an educational sample):
{
"version": 1,
"collections": [
{
"id": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Operations on buckets",
"folders": [],
"requests": [
{
"id": "b89a66a4-0183-43cf-9712-7c07ba615b0b",
"url": "http://endpoint/bucket-name?acl=",
"method": "PUT",
"collectionId": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Add a bucket ACL (canned)",
"description": "",
"headers": "x-amz-date: {timestamp}\nAuthorization: {authorization-string}\nx-amz-acl: public-read\nContent-Type: text/plain",
"dataMode": "raw",
"data": ""
},
{
"id": "df2a9b2a-d66b-4ea6-8cfb-ab341ec23bc2",
"url": "http://endpoint/bucket-name?acl=",
"method": "PUT",
"collectionId": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Add a bucket ACL (custom)",
"description": "",
"headers": "x-amz-date: {timestamp}\nx-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nAuthorization: {authorization-string}\nContent-Type: text/plain; charset=utf-8",
"dataMode": "raw",
"data": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n <Owner>\n <ID>d4d11b981e6e489486a945d640d41c4d</ID>\n <DisplayName>OwnerDisplayName1</DisplayName>\n </Owner>\n <AccessControlList>\n <Grant>\n <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\">\n <ID>d4d11b981e6e489486a945d640d41c4d</ID>\n <DisplayName>some-name</DisplayName>\n </Grantee>\n <Permission>FULL_CONTROL</Permission>\n </Grant>\n <Grant>\n <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\">\n <ID>a5c26620b0704967a72d7aeb90cf57b2</ID>\n <DisplayName>some-name</DisplayName>\n </Grantee>\n <Permission>WRITE</Permission>\n </Grant>\n </AccessControlList>\n</AccessControlPolicy>"
},
{
"id": "7f79523f-b9aa-46ad-abda-9ad7e37d3980",
"url": "http://bucket-name.endpoint/?acl=",
"method": "GET",
"collectionId": "ab20b534-025a-4be2-b90f-a980d4a81632",
"name": "Get a bucket ACL",
"description": "",
"headers": "x-amz-date: {timestamp}\nAuthorization: {authorization-string}\nContent-Type: text/plain",
"dataMode": "raw",
"data": ""
}
],
"order": [
"b89a66a4-0183-43cf-9712-7c07ba615b0b",
"df2a9b2a-d66b-4ea6-8cfb-ab341ec23bc2",
"7f79523f-b9aa-46ad-abda-9ad7e37d3980"
]
}
],
"environments": [
{
"id": "fa619322-0a84-47b5-958b-84fa4a6286ba",
"name": "API-Flow Imports",
"values": [],
"timestamp": 1497532748923
}
]
}
Based on your reference to the 'Cloud Storage Object API', I can guess you might be working with an on-premises installation of IBM COS. Please send me an email at nicholas.lange[at]ibm.com so we can discuss what you are looking for.
I am trying to create a collection that will upload images and be able to run it in multiple iterations and want to use newman to run it.
For our API it only supports uploading images through using binary data.
https://www.getpostman.com/docs/requests
- Postman does not support saving the files for both form-data and binary.
https://www.getpostman.com/docs/run_file_post_requests - They show how you can upload images with Newman using form-data, but not for binary.
Is it possible to use newman with binary image upload?
here is what you need in your request. I had to modify the src from the saved collection
{
"name": "Room Document",
"request": {
"url": "{{url}}/api/v1/folders/321/documents",
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "3242349-324432-23423423-23424",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"type": "file",
"src": "blank.pdf"
}
]
},
"description": " "
},
"response": []
},
I used it like this which worked with the binary:
"body": {
"mode": "file",
"file": {
"src": "path/to/your/file.jpg"
}
}
That way you dont have to set the KEY, Type and so on. But you need to set it within the Header as
Content-Disposition: attachment; filename="file.jpg"
and in our case with
Content-Type: application/octet-stream
I am fairly new to drop wizard (dropwizard.io) & just completed their tutorial. I would like to integrate Swagger (swagger.io) into this sample app.
I found:
github.com/federecio/dropwizard-swagger-sample-app
github.com/federecio/dropwizard-swagger
The generated JSON seems to be quite similar, however I cannot expand the REST resources to see their respective operations.
The only difference I noted was that the example code of the swagger integration uses SERVER whereas the official drop wizard example is using APPLICATION
Here an Image (i.stack.imgur.com/QzhPa.png)
Please could you tell me what is wrong in my approach.
Thank you very much. Here is the code to my approach: https://github.com/geoHeil/dropwizardSwaggerIntegrationNotWorking
Edit:
for api - docs {
"apiVersion": "0.0",
"swaggerVersion": "1.2",
"apis": [{
"path": "/sample"
}, {
"path": "/hello-world",
"description": "Operations about greetings"
}]
}
for sample {
"apiVersion": "0.0",
"swaggerVersion": "1.2",
"basePath": "http://geoHeil.local:8080",
"resourcePath": "/sample",
"apis": [{
"path": "/sample",
"operations": [{
"method": "GET",
"summary": "Sample endpoint",
"notes": "",
"type": "void",
"nickname": "get",
"authorizations": {},
"parameters": []
}]
}, {
"path": "/sample/hello-with-path-param/{name}",
"operations": [{
"method": "GET",
"summary": "Sample endpoint with path param",
"notes": "",
"type": "void",
"nickname": "getWithPathParam",
"authorizations": {},
"parameters": [{
"name": "name",
"required": true,
"type": "string",
"paramType": "path"
}]
}]
}, {
"path": "/sample/hello-with-query-param",
"operations": [{
"method": "GET",
"summary": "Sample endpoint with query param",
"notes": "",
"type": "void",
"nickname": "getWithQueryParam",
"authorizations": {},
"parameters": [{
"name": "name",
"required": false,
"type": "string",
"paramType": "query"
}]
}]
}]
}
for hello - world {
"apiVersion": "0.0",
"swaggerVersion": "1.2",
"basePath": "http://geoHeil.local:8080",
"resourcePath": "/hello-world",
"apis": [{
"path": "/hello-world",
"operations": [{
"method": "GET",
"summary": "Greetings endpoint",
"notes": "",
"type": "void",
"nickname": "sayHello",
"authorizations": {},
"parameters": [{
"name": "name",
"required": false,
"items": {
"type": "string"
},
"paramType": "query"
}]
}]
}]
}
There is now a Swagger spec 2.0 example available:
https://github.com/swagger-api/swagger-samples/tree/master/java/java-dropwizard
This uses the latest swagger core libraries with minimal dependencies. Note, the version of Jackson needed to be updated from dropwizard's 2.3.2 to swagger's 2.4.2.
I don't see anything obvious in the generated JSON that would cause the operations to not expand.
However, the swagger-ui bundled with the dropwizard-swagger package is a bit old. I would try using the newer version of swagger-ui.
I'm not sure if it would conflict with the bundled swagger-ui or not, but basically you need to clone https://github.com/swagger-api/swagger-ui and copy the /dist directory to your static content.
Another option is to run the swagger-ui locally (just for testing purposes) but opening the /dist/index.html and pointing it at your /api-docs directory. However, in order for that to work properly, you'd need to enable CORS - https://github.com/swagger-api/swagger-ui#cors-support.
EDIT:
I didn't notice you edited the question with the JSON, and it made it easier to read.
There's a problem with the GET /hello-world operation. It looks like it's supposed to accept an array of strings as a query parameter, but the parameter is missing a "type": "array" in its definition. I can't say what may be causing it without seeing the method's declaration and its annotations, but that's what you should be looking at.