Postman Chrome: What is the difference between form-data, x-www-form-urlencoded and raw

These are different Form content types defined by W3C. If you want to send simple text/ ASCII data, then x-www-form-urlencoded will work. This is the default. But if you have to send non-ASCII text or large binary data, the form-data is for that. You can use Raw if you want to send plain text or … Read more

Recommendations of Python REST (web services) framework? [closed]

Something to be careful about when designing a RESTful API is the conflation of GET and POST, as if they were the same thing. It’s easy to make this mistake with Django’s function-based views and CherryPy’s default dispatcher, although both frameworks now provide a way around this problem (class-based views and MethodDispatcher, respectively). HTTP-verbs are … Read more

“SyntaxError: Unexpected token < in JSON at position 0"

The wording of the error message corresponds to what you get from Google Chrome when you run JSON.parse(‘<…’). I know you said the server is setting Content-Type:application/json, but I am led to believe the response body is actually HTML. Feed.js:94 undefined “parsererror” “SyntaxError: Unexpected token < in JSON at position 0” with the line console.error(this.props.url, … Read more

REST response code for invalid data

400 is the best choice in both cases. If you want to further clarify the error you can either change the Reason Phrase or include a body to explain the error. 412 – Precondition failed is used for conditional requests when using last-modified date and ETags. 403 – Forbidden is used when the server wishes … Read more

When to use @QueryParam vs @PathParam

REST may not be a standard as such, but reading up on general REST documentation and blog posts should give you some guidelines for a good way to structure API URLs. Most rest APIs tend to only have resource names and resource IDs in the path. Such as: /departments/{dept}/employees/{id} Some REST APIs use query strings … Read more

Is it possible to send an array with the Postman Chrome extension?

You need to suffix your variable name with [] like this: If that doesn’t work, try not putting indexes in brackets: my_array[] value1 my_array[] value2 Note: If you are using the postman packaged app, you can send an array by selecting raw / json (instead of form-data). Also, make sure to set Content-Type as application/json … Read more

Should I use PATCH or PUT in my REST API?

The PATCH method is the correct choice here as you’re updating an existing resource – the group ID. PUT should only be used if you’re replacing a resource in its entirety. Further information on partial resource modification is available in RFC 5789. Specifically, the PUT method is described as follows: Several applications extending the Hypertext … Read more

InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately [duplicate]

The docs give a fair indicator of what’s required., however requests allow us to skip a few steps: You only need to install the security package extras (thanks @admdrew for pointing it out) $ pip install requests[security] or, install them directly: $ pip install pyopenssl ndg-httpsclient pyasn1 Requests will then automatically inject pyopenssl into urllib3 … Read more

No ‘Access-Control-Allow-Origin’ – Node / Apache Port Issue

Try adding the following middleware to your NodeJS/Express app (I have added some comments for your convenience): // Add headers before the routes are defined app.use(function (req, res, next) { // Website you wish to allow to connect res.setHeader(‘Access-Control-Allow-Origin’, ‘http://localhost:8888’); // Request methods you wish to allow res.setHeader(‘Access-Control-Allow-Methods’, ‘GET, POST, OPTIONS, PUT, PATCH, DELETE’); // … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)