1

Trying to post a simple object through nodejs using request http module, every time I try to send my data to my API it showing this options.uri is a required argument yet I provided a URL end point where to POST the data.

var url = 'http://omcloud.azurewebsite.net/api/Test';
request.post(url,
            { json: { "Definition": "Test"} },
            function (error, response, body) {
                if (!error && response.statusCode == 200) {
                    console.log(body)
                }
            }
        );

Can someone shed a light what's wrong with the code above?

1 Answer 1

3

Try adding url : url inside post's json

  var url = 'http://omcloud.azurewebsite.net/api/Test';
    request.post({ 
                url : url, 
                json: { "Definition": "Test"} },
                function (error, response, body) {
                    if (!error && response.statusCode == 200) {
                        console.log(body)
                    }
                }
            );
Sign up to request clarification or add additional context in comments.

1 Comment

still the same though

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.