I keep getting error 404 when creating a new document archive - clio-api

I am testing the Clio API through Postman but I keep getting error 404 when I tried creating a new document. Below is the sample request.
POST https://app.clio.com/api/v4/document_archives.json?fields=id,size,progress,state
Content-Type: application/json
Authorization: Bearer ****
Body
{
"data": {
"items": [
{
"id": 5998571944,
"type": "Folder"
}
]
}
}

Related

Getting access forbidden when calling a SendGrid API

Trying to invoke https://api.sendgrid.com/v3/suppression/bounces (https://docs.sendgrid.com/api-reference/bounces-api/retrieve-all-bounces) and I get a message of "access forbidden".
I am passing in a valid API Key, which is from a free new account.
API:
GET
Headers:
Authorization Bearer SG.xxxxxxxxxxxxxxxx
Accept application/json
Response:
{
"errors": [
{
"field": null,
"message": "access forbidden"
}
]
}

REST Client extension not sending form-data in VSCode

I'm attempting to POST Authenticate using REST Client in vscode, but it isn't accepting my form-data. This is the http code from postman which appears to match specs on https://marketplace.visualstudio.com/items?itemName=humao.rest-client but I don't understand why it doesn't like my credentials when submitting from vscode. Any help or pointers greatly appreciated.
Request:
POST /myservicestack/authenticate/credentials HTTP/1.1
Host: services.mydomain.com
Accept: application/json
cache-control: no-cache
Postman-Token: cdax7d61-8d8b-4f3q-b45v-74a240f33693
Content-Disposition: form-data; name="UserName"
myemail#address.com
Content-Disposition: form-data; name="Password"
My Password!
Content-Disposition: form-data; name="RememberMe"
true
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Response:
{
"responseStatus": {
"errorCode": "ValidationException",
"message": "Validation failed: \r\n -- 'User Name' should not be empty.\r\n --
'Password' should not be empty.",
"errors": [
{
"errorCode": "NotEmpty",
"fieldName": "UserName",
"message": "'User Name' should not be empty.",
"meta": {
"PropertyName": "User Name"
}
},
{
"errorCode": "NotEmpty",
"fieldName": "Password",
"message": "'Password' should not be empty.",
"meta": {
"PropertyName": "Password"
}
}
]
}
}
The tool here is a red-herring and you should be checking what data format the server endpoint is expecting its data in. Typically REST services are expecting requests as JSON, but that is not universally true.
So for example (including both header and body):
POST https://example.com/comments HTTP/1.1
content-type: application/json
{
"UserName": "myemail#address.com",
"Password": "My Password!",
"RememberMe": true
}
If you want to see what the server may be receiving, then you can check against a service such as https://requestbin.com/ - just don't include any sensitive data.

Swagger/OpenAPI: is it fine send a content application/json although we don't expect any response body?

While integrating an external RESTful service I experience the problem that my generated Java code sends and empty Accept header. The external service seems to only accept a request without an Accept header or Accept: application/json.
I was able to resolve the problem by defining the content in the success response. However I am not sure if this is best practice to resolve this problem as we don't expect any response:
"responses": {
"204": {
"description": "No Content",
"content": { <- these lines
"application/json": { <- these lines
}
}
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"500": {
"description": "Internal server error"
}
},

How I can get authentication token or do loging in Elastic Search using REST API? For example from POSTMAN

I'm trying to list data from Elastic Search using the REST API on Postman.
But I get a security_exception error
I read the elastic documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html
but didn't work.
I'm using Elastic 7.2
Method: POST
Content-type: Application/json
URI: http://xxx.xxx.xxx.xxx:9200/_security/oauth2/token
BODY:
{
"grant_type" : "password",
"username" : "user_name",
"password" : "correct_password"
}
I need this service to return the authentication token. But this is the response:
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status": 401
}
Try to do a basic authentication instead. And pass in the body just the grant_type.

Google cloud storage client api not working for patch

I tried updating header of an object by using API explorer (as well as client library) by giving metadata object as header keys and values.
I only received error respond
{
error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid argument."
}
],
"code": 400,
"message": "Invalid argument."
}
}
The request is:
PATCH https://www.googleapis.com/storage/v1beta2/b/mbi-figure/o/infovilla_paypal.png?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29
X-JavaScript-User-Agent: Google APIs Explorer
{
"metadata": {
"title": "Kyaw"
}
}
You've run into a bug with PATCH that is being worked on. Fortunately, there's a workaround. Adding a "projection=full" parameter to the URL should fix your problem.