Using Postman to test an API, I'm able to select Body/binary then choose an image file stored locally. Postman inserts binary data somehow into the request and I get a favorable response:
When trying to build this as a Custom Connector in PowerApps, I can't find any info on what the schema for the Body of the request should be.
When I try to add a generic {"body": ""} body to the connector with a string type of binary, I receive this error:
Specified swagger has the following errors: 'Definition is not valid. Error: 'Error : paths/~1prebuilt~1analyze/post/parameters/2/schema/properties/body : A schema with type/format 'string/binary' can only be at the top level of a body or formData parameter. '
I was running into the same problem.
Body:
""
When you have clicked Import, go to the request -> body -> body and click the three dots -> Edit.
Under Body, it will say "key-body-output". Click the three dots and click Edit.
Change Type to String (if not already) and change Format to Binary. Change Is required to Yes.
Update the connector and you can now use the custom connector with PowerApps by using ImageX.Image for the body property for example.
Related
I have a Plumsail form where a user can attach several pdf or word documents. In power automate I create an array of these documents and then attach the array to the "Start and wait for approval" action. When I run it, I get the error below:
The request failed. Error code: 'InvalidRequestContent'. Error
Message: 'The request content was invalid and could not be
deserialized: 'Could not find member 'ContentBytes' on object of type
'ApprovalsConnectorAttachment'.
I'm assuming you followed the How to send an email from Plumsail form with Power Automate Plumsail guide as it tells you to assign the HTTP GET file response to a property named ContentBytes.
While this will work with the Send an Email (V2) action (from the guide) the Start and wait for an approval action expects a property named content content.
To fix the problem append the following object to the array (note the contentproperty):
{
"name": #{items('Apply_to_each_2')?['file']},
"content": #{body('HTTP')}
}
or as an image:
Swagger-parser version: 2.1.1
Example swagger spec:
The test case is quite large, so I put it in a github gist. Don't be surprised by the names of the paths and schemes - I masked the critical data.
Description:
When using the ResolveFully option, I get requests with unresolved links. For example, take the request POST /v1/BusinePEH0JF. In swagger-ui it renders correctly - in the request body in the manager field, the Emplo4XN6X schema is resolved:
enter image description here
But swagger-parser gives this result:
enter image description here
Here the link is not resolved. This is most likely due to the fact that the parent schema BusinesYD77B4X in this request is stored as such in resolvedModels due to the fact that it is also used in other requests, such as POST /v1/ApprovalSetU0C9RY71SHD/manager-to-employees. Here, the manager field is empty, because this scheme has already been used above in the approver field.
enter image description here
Reproduction of the error:
val parseOptions = new ParseOptions()
parseOptions.setResolve(true)
parseOptions.setResolveFully(true)
val openAPI = new OpenAPIV3Parser().read(swaggerSpec, null, parseOptions)
Expected result:
Like on the first screen in swagger-ui
Thanks!
In my play-framework application, there is a messages file which I can use to define my own messages. Eg
##############Application Error messages
error.incorrectBodyType=Incorrect body type. Body type must be JSON
error.incorrectBodyContentInLoginRequest=No Login info found in the request. Check format
error.incorrectUsernameOrPassword = Incorrect username or password
error.unregisteredUser = registration not complete
error.ghostUsername = No record found for the username
error.unauthenticated = You must first sign in
error.unauthorized = You are not permitted
####### Application Success Messages
success.signoutSuccessful = Signout Successful
The play frameworks makes these messages available to my Controller and I can use them like the messagesApi("error.unauthenticated")(langs.availables(0)).
I am unable to figure out how I can use the messages file in my unit tests. I am using compile time injection and am creating my own instances of the required classes. To create MessagesApi, there is a DefaultMessagesApi method but it take a map, not a File.
I am able to create the messages in my unit tests as follows but I have to duplicate the effort of copying messages from messages file to this map
val messagesApi = new DefaultMessagesApi( //takes map of maps. the first is the language file, the 2nd is the map between message title and description
Map("en" -> //the language file
Map("error.incorrectBodyType" -> "Incorrect body type. Body type must be JSON",
"error.incorrectUsernameOrPassword"->"Incorrect username or password",
"error.incorrectBodyContentInLoginRequest"->"No Login info found in the request. Check format", //map between message title and description
"error.unregisteredUser" -> "registration not complete",
"error.ghostUsername" -> "No record found for the username",
"success.signoutSuccessful" -> "Signout Successful",
"error.unauthenticated" -> "You must first sign in",
"error.unauthorized" -> "You are not permitted")
)
)
Is there a way I can read the messages file and use it in my test case?
My test case already extended OneAppPerSuiteWithComponents. I used components.messagesApi of OneAppPerSuiteWithComponents which was already available and reads from the messages file
Objective: I am trying to integrate creator-form-data with google-sheet using google-sheet-api-v4.
I am able to create an empty sheet(data params being empty ) at google spreadsheets.
but i don't know ,how to create sheet with data-params , to either-
(1) assign title ,to spreadsheet , or
(2) write any data, to spreadsheet
error received : using deluge to perform task no. ( 1 ), the error thrown is :
Invalid JSON payload received. Unexpected token
Note:
(1)Oauth credentials are checked and correct,
google access token is also valid, confirming via
Google-oauth-playground
(2) i am able to assign title and data from google-try-api-platform,but no success from deluge side.
google-sheet-try-api
The issue is solved now ,in postUrl the post-data to be posted , must be converted from json to string (params=data.toString(); ).
I had sent post-data in json format thats the mistake I made.
Below is correct sample code for deluge:
append_data = {"values":{{thisDate,thisQuantity}}};
final_append_data = append_data.toString();
response = postUrl(append_data_sheet_url,final_append_data,mymap,false);
Note: variable "final_append_data" is converted to string.
Has anyone successfully constructed the correct url to retrieve the file content from this endpoint?
All my attempts have resulted in a status 404.
The documentation is confusing in this link
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-file
Below is the example it provides
GET /changes/{change-id}/edit/path%2fto%2ffile
this is data from gerrit.
{
"branch": "BR16516",
"change_id": "Ieb84eb99147fc39d3e117fe61eef8389d2f64611",
"change_number": "52490",
"change_revision": "2",
"file_name": "sql/BR16516-update-order-15102.sql",
"lines_inserted": 77,
"size_delta": 2041,
"status": "A"
}
I can't seem to provide a value for {change-id} and {'path%2fto%2ffile'} that gerrit recognises
The value I provided (see shown above) is the same value retrieved from /changes endpoint documented here
- https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
This is the code example provided:
Retrieves content of a file from a change edit.
Request
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
In this example, the filename is 'foo' however the {change-id} introduces myProject~master~ and I tried substituting this for the relevant values for my project but with no luck.
If there are other endpoints that will give me plain text from the file in the branch, that will be good too.
I managed to get the file content from this end point
GET /changes/{change-id}/revisions/{revision-id}/files/{file-id}/content
change_id is the id from the change record
revision-id is the revision id from the change record
the change record is from the query changes end point
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes