Quantcast
Channel: Runscope Blog - API Monitoring and Testing
Viewing all articles
Browse latest Browse all 231

Error # 1 – “Making a lousy menu choice” -- or using the wrong HTTP method

$
0
0
10-API-Errors1.png

Just as we can choose a bad dish in a restaurant, we can sometimes use the wrong HTTP method, which can often be blamed on poor/unclear menus (documentation). Even though they should, the endpoint documentation often does not adequately detail what methods are supported, or they use the wrong verb entirely.

In this context, tools should also be used with caution. Take curl for example. If a user issues a GET request with the data option (-d), but forgets to specify -XGET, then it will automatically default to a POST request and include the `Content-Type:application/x-www -form-urlencoded` header.

In all cases, it’s important to carefully read the documentation and not fall victim to making incorrect assumptions – especially when working across different tools and APIs. For example, the Runscope® API uses a POST method when creating API test environments or steps, and PUT to modify them. On the other hand, the Stripe® API uses POST to both create and update objects. While both are perfectly valid, the goal of an API provider is to remain consistent and keep documentation clear and up to date.

Download the Full Whitepaper

Viewing all articles
Browse latest Browse all 231

Trending Articles