You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying out the POST request with the Bearer token in both Java and .NET. The Java version works fine, but the .NET version is failing. Please find the request and the response below for .NET.
Response: {"_meta":{"success":true,"code":201,"message":"A resource was successfully created in response to a POST request. The Location header contains the URL pointing to the newly created resource.","rateLimit":{"limit":30,"remaining":29,"reset":2}},"result":{"id":"1799","first_name":"Brian","last_name":"Ratke","gender":"male","dob":null,"email":"[email protected]","phone":null,"website":null,"address":null,"status":"active","_links":{"self":{"href":"https://gorest.co.in/public-api/users/1799"},"edit":{"href":"https://gorest.co.in/public-api/users/1799"},"avatar":{"href":null}}}}
Is there any resolution for the issue in .NET? Thanks.
The text was updated successfully, but these errors were encountered:
Hi, I'm trying out the POST request with the Bearer token in both Java and .NET. The Java version works fine, but the .NET version is failing. Please find the request and the response below for .NET.
.NET:
Request:
HttpResponse<string> httpResponse = Unirest.post("https://gorest.co.in/public-api/users") .header("Content-Type", "application/json") .header("Accept", "application/json") .header("Authorization", "Bearer Z1UQZlHX3YYchYeqjd1M04ZiHq6XFhfbsKYT") .body(JObject.Parse("{\n \"first_name\": \"Brian\",\n \"last_name\": \"Ratke\",\n \"gender\": \"male\",\n \"email\": \"[email protected]\",\n \"status\": \"active\"\n}")) .asJson<string>();
Response:
{ "_meta": { "success": false, "code": 401, "message": "Authentication failed." }, "result": { "name": "Unauthorized", "message": "Your request was made with invalid credentials.", "code": 0, "status": 401 } }
Java:
Request:
HttpResponse<String> response = Unirest.post("https://gorest.co.in/public-api/users") .header("Content-Type", "application/json") .header("Accept", "application/json") .header("Authorization", "Bearer Z1UQZlHX3YYchYeqjd1M04ZiHq6XFhfbsKYT") .body("{\n \"first_name\": \"Brian\",\n \"last_name\": \"Ratke\",\n \"gender\": \"male\",\n \"email\": \"[email protected]\",\n \"status\": \"active\"\n}") .asString();
Response:
{"_meta":{"success":true,"code":201,"message":"A resource was successfully created in response to a POST request. The Location header contains the URL pointing to the newly created resource.","rateLimit":{"limit":30,"remaining":29,"reset":2}},"result":{"id":"1799","first_name":"Brian","last_name":"Ratke","gender":"male","dob":null,"email":"[email protected]","phone":null,"website":null,"address":null,"status":"active","_links":{"self":{"href":"https://gorest.co.in/public-api/users/1799"},"edit":{"href":"https://gorest.co.in/public-api/users/1799"},"avatar":{"href":null}}}}
Is there any resolution for the issue in .NET? Thanks.
The text was updated successfully, but these errors were encountered: