I need to send a post request to the bunnynet api using fetch in vuejs, for this I need to enter the name of the video in the body part.
I want to name the video with the variable I got from the input section, but I couldn't write it as a body. I can send requests statically, but I need to get the name of the video I will create from outside. I couldn't find a solution, I'm stuck on this, can you please help?
enter image description here
enter image description here
I tried to send the value I received as an object or as a string, unfortunately nothing happens.
body: JSON.stringify({
// your expected POST request payload goes here
title: "My post title",
body: "My post content."
})
it worked, i'm so ignorant
Related
I am unable to get specific data and need you guys' advice on how I can retrieve it.
I am using a curl as a post to submit through an Api in postman and in sucess I only get empty string but the response that I need is there in the headers on the headers tab next to body the image is below
api response shows in headers click for image view
I have used getHeaders and many more functions to get but failed to get anything yet so please guide me that should i do.
Thanks
I have a Vue application that is using mongodb and flask for the back-end. I am trying to test the code as follows.
There is a form as you can see from the image above. When I enter the URL's, tokens, password, ssh, and project name, and click Create button, I add them to an object and send them to the database in a request.
I want to write these values in Cypress.js (this part is done), and click the create button. After clicking create button I want to test the data that is sent as request. How can I reach the body in the request in cypress?
You can use cy.intercept() to look at outbound requests. Request object documentation here.
cy.intercept('/some/url', (req) => {
// whatever you need to do with the request object
// for example, validating the request body has a name field
expect(req.body.name).to.equal('My Body Object Name');
// req.continue() tells the request to continue!
req.continue()
});
Problem Set: Client .posts image from form action='/pages/contact/image/something' to node.js and I .putItem to AWS S3. On the success response I would like to send the image url back to the client without refreshing the screen and update the location they wanted to add the image with the new src url.
If the page refreshes I lose the location where they wanted to upload the image. Open to any suggestions, I have looked at res.send, res.end, res.json, res.jsonp, res.send(callback): all of which overwrite(refresh) the client webpage with the array, text or context in general I am passing back to the client . Code below:
myrouter.route('/Pages/:Page/Image/:Purpose')
.post(function (req, res) {
controller.addImageToS3(req, res)
.then(function(imgurl){
//res.json({imgurl : imgurl});
//res.send(imgurl);
//res.end(imgurl);
//res.send(req.query.callback(imgUploadResponse(imgurl)))
<response mechanism here>
console.log('Image Upload Complete');
}, function (err){
res.render('Admin/EditPages', {
apiData : apiData,
PageId : PageId
});
});
});
Ideally there could be a passed parameter to a javascript function that I could then use: Example:
function imgUploadResponse(imgurl){
// Do something with the url
}
You, as a developer, have full control over the s3 url format. It follows a straightforward convention:
s3-region.amazonaws.com/your-bucket-name/your-object-name.
For example:
https://s3-us-west-2.amazonaws.com/some-random-bucket-name/image.jpg
While I would recommend keeping those details in the back-end, if you really want to avoid using res.send, you can basically make the front-end aware of the url formatting convention and present the url to the user, even before the image was actually uploaded (just need to append the name of the image to the s3-region.amazonaws.com/your-bucket-name)
Also, I'm not sure why your page would refresh. There are ways to refresh content of your page without refreshing the whole page, the most basic being AJAX. Frameworks like angular provide you with promises that allow you to do back-end calls from the front-end.
Hope this helps!
I'm making a simple http request that looks something like this:
https://example.com/api/chat.postMessage?text=This%20should%20be%20a%20link
What this does is posts a message to our internal chat service. The text= is the text that gets posted to the chat channel. What I'd like is to embed a hyperlink here so that when the message is posted, "This should be a link" will actually link to an http link. Is this at all possible? Thanks!
Looks like you're working with the Slack API? The following two links could be helpful:
the chat.postmessage method
testing the method call
To encode the following text...
"go to http://www.google.com/"
...it seems that you would send a request to the following URL:
.../api/chat.postMessage?text=go%20to%20http%3A%2F%2Fwww.google.com%2F
This is related to the following question, but I think something has changed since that issue was resolved: How can I use the Feed Dialog to post on a Facebook Fan Page wall not liked by the user?
I am getting the same error message:
An invalid target was specified: 92586461482. The target must be a page, event, or user that the actor can post on the wall of.
The answer that was provided by DMCS was a link to a bug on FB: https://developers.facebook.com/bugs/407033842673075 where a FB developer said "You can write wall posts to pages, but not post content with attachments. By default, feed dialog publishes content with an attachment. So this is by design and not a bug."
However, as you can see below, I do not have any attachment specified in the parameters and I am still not able to use this code to post to a page that is not liked. I've seen other folks having this same issue as well.
FB.ui({
method: 'feed',
to: '92586461482'
}, function(response) {
console.log(response);
});
Is there a way to pass another parameter that will remove the supposed "default" attachment so this will work for users who do not like the page?