I'm using the V2 Http API : https://www.dropbox.com/developers/documentation/http/documentation
I'm trying to post for: https://api.dropboxapi.com/2/files/get_metadata for the root folder.
my request body: {"path":""}
my headers:
Content-Type: application/json
Authorization: Bearer my_token
Dropbox-API-Select-User: dbmid:some_user_id
I'm getting a response code 400 with the body:
Error in call to API function "files/get_metadata":
request body: path: '' did not match pattern '((/|id:).*)|(rev:[0-9a-f]{9,})'
sending an empty json didnt work too.
When I'm trying to get to a folder that's not root, it works (like : "/111").
In the documentation in the "Path formats" section it says : "The empty string ("") represents the root folder".
What am I doing wrong?
Thanks!
You're correct that the root path should be indicated by the empty string "", however the /files/get_metadata endpoint doesn't support querying on the root, since there isn't any metadata to return for it anyway.
As you mentioned, and as you can see in the documentation, for any non-root folder, the path can be specified like "/Homework/math". The documentation also shows examples of specifying via id, like "id:a4ayc_80_OEAAAAAAAAAYa", or rev, like "rev:a1c10ce0dd78". The regex in the error message reflects those three options.
If your actual goal is to list the contents of root, you should instead use /files/list_folder, which does allow the root path.
Related
When i try to test api with localhost:[port] it gives the invalid character in header ["Host"] console error. I am using dotnet core webApi. I cross checked the CORS configuration from api end it is fine. The issue is on the Postman side.
Postman version: v8.7.0
I had the same error being reported for any forked or created Postman requests:
Error: Invalid character in header content ["Host"]
The request URL was using a global parameter:
{{BaseUri}}/some/sort/of/resource
In the console logs the following was reported (URLs redacted):
Request Headers
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 9d14e81d-1e21-44a2-93ed-2758f0ad24fa
Host: my.url.co.uk↵
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Note the ↵ character at the end of the Host Header.
The global BaseUri parameter did not appear to have a line break at the end of it. However, completely deleting said parameter and recreating it seems to have fixed the issue.
I also had same incident and I was able to find the error by exporting "My Workspace" content and open it from notepad++. Then change the encoding to "ANSI" from notepad++ (Encoding=> ANSI). You will notice special characters as below,
This can happen when you copy the url and paste in Postman and then try to edit it.
If you are getting this URL from someone what you can ask is to provide exported json file from postman. Then import it to your workspace.
I thought the issue was in a variable I was using because the error was telling me there's an invalid character in my host https://localhost:4431 which is exactly the value of my variable.
I figured out the invalid character was actually not in my variable but in the rest of the URL in my request.
Turns out, when copying endpoint names from the Swagger of my API, I was also copying an invisible character %E2%80%8B. I saw it when checking the API's console RequestPath:/%E2%80%8BmyEndpoint
Removing this invisible character solved the issue
Taken from question comments. by Fidel Garcia
I created the request again via Add Request menu and it works. I'm not sure if it is a problem with the update and old requests. The old one is still failing.
===================================================
It also worked for me. I created new request with the same parameters and it worked.
I created a requested with and wrote the parameters in headers. After wrong requested I changed it to correct one (post request and parameters in body) and got the error. After creating new request with correct configuration (post request parameters in body) it worked correctly.
In my case:
I removed the authentication from Header then I re-enter the authentication credentials again.
In my case enter after param and path generate error. Exact reason could be found in postman console.
In my case this happened because I added an extra blanckspace at the end of an environment variable deffinition. That extra space was being taken into account in the route when making a request.
Be careful with those extra blanck spaces.
Following this procedure:
https://learn.microsoft.com/en-us/graph/auth-v2-user
I'm trying to get a refresh token from this microsoft end point:
https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize
Using PostAsync method from System.Net.Http.HttpClient class from nuget (asp.net core 2.2) library, I'm able to get a response back with this error: "AADSTS90102: 'redirect_uri' value must be a valid absolute Uri.":
I tried to set some redirect url in the Azure Portal including:
https://automation.legroupeti.com/Configurations/GetRefreshToken/
https://automation.legroupeti.com/Configurations/GetRefreshToken
https://automation.legroupeti.com/
https://automation.legroupeti.com
The post request is the following (Using PostAsync method from System.Net.Http.HttpClient class from nuget (asp.net core 2.2)):
Here are the configured redirect urls form the registred application in the Azure Portal:
I expect a valid response from the endpoint.
How do I configure the redirect_uri to be valid?
EDIT 1
I fixed the redirect_uri parameter.
From the screenshot, it appears that the URLEncoding is incorrect. The '/' character in the path should be encoded to %2F, while your code has %2. (After '.com' and before 'Configurations'.)
Also, have you considered the Authorization Provider from the SDK?
https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=CS#AuthCodeProvider
I was getting this error and for me the issue was that I was encoding the redirect_uri value in the post request to the /oauth2/v2.0/token endpoint. Notice how redirect_uri is not encoded in this request.
POST /{Tenant ID}/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
Cookie: {cookie}
Content-Length: 941
client_id={Application (client) ID}
&scope=https://graph.microsoft.com/mail.read
&redirect_uri=http://localhost/myapp/
&grant_type=authorization_code
&client_secret={secret}
&code={code}
I used the Postman sample provided by Microsoft to find the root cause.
https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-access-token
You seem to be mixing the authorize and token endpoints.
If you want the user to authenticate, you have to redirect the user to that URL, not send a POST request to it.
After the user returns to your app, you need to exchange the authorisation code for tokens.
Documentation: https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-web-app-call-api-overview
If you want a token just for your app without user authentication, you need to call the token endpoint.
Documentation: https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-overview
I also faced the same problem:
AADSTS90102: 'redirect_uri' value must be a valid absolute Uri.
I tried few URL variants (with encoding, without, etc.) in Chrome, but was getting different exceptions about a wrong URL. Then I used the Safari browser and voila, I got a response code.
In the final result, I just copied the URL from the documentation, pasted tenant and client_id values from the registered application into the return_url parameter, and instead of the /myapp/ prefix I pasted %3A8080, where %3A it's the : symbol. The redirect_utl param has to be the same as URL in the registered application.
The Docker Registry API Documentation (here) states that you can do:
https://index.docker.io/v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry
However this (with several image ids I have tried) only yields a 404. Why?
You are using the incorrect domain. Note from the documentation example:
GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry HTTP/1.1
Host: registry-1.docker.io
Accept: application/json
Content-Type: application/json
Cookie: (Cookie provided by the Registry)
You should be using registry-1.docker.io, not index.docker.io. So your url should be:
https://registry-1.docker.io/v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry
When I run this I no longer get a 404 but instead get an authorization error. This is because you need to auth against index.docker.io and then run your api against registry-1.docker.io.
It's not well documented - you may find this discussion helpful:
https://forums.docker.com/t/registry-hub-api-is-buggy/732
from the discussion:
registry-1.docker.io is the docker-registry used for storing images,
this API is public, but requires authorization.
index.docker.io is the "index" now called RegistryHub, this tags
endpoint is not public, and might change at any time. I would not use
this one, since it is for internal use only, and may change without
warning.
I am trying to upload files programmatically to an IBM Connections Community File library.
I am able to upload to files and then share with the community, but unfortunately is not the desired behavior.
I followed the API documentation (http://www-10.lotus.com/ldd/lcwiki.nsf/xpAPIViewer.xsp?lookupName=IBM+Connections+5.0+API+Documentation#action=openDocument&res_title=Creating_community_files_ic50&content=apicontent)
I am sending a POST to this URL: /files/basic/api/community/{community_uuid}/introspection
I tried using a file Atom Entry document, and Content-Type:application/atom+xml
But it's not working and giving me a 405 with following error:
UnsupportedOperation
-> Request sent
POST /files/basic/api/community/00f04081-f000-4752-bd88-8b73d281fb19/introspection
Content-Type: application/atom+xml
<?xml version='1.0' encoding='UTF-8'?>
<entry
xmlns:thr='http://purl.org/syndication/thread/1.0'
xmlns:opensearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:snx='http://www.ibm.com/xmlns/prod/sn'
xmlns:td='urn:ibm.com/td'
xmlns='http://www.w3.org/2005/Atom'>
<td:label>test-restore20</td:label>
<title type="text">test-restore2</title></entry>
I tried using the same method than for stand alone file, with a basic header but still giving me a 405 with following error:
UnsupportedOperation
-> Request sent:
POST /files/basic/api/community/00f04081-f000-4752-bd88-8b73d281fb19/introspection
Content-Type: binary/octet-stream
X-Update-Nonce:<Nonce>
Slug:TMap_Next_Book.pdf
Filename: /Users/Downloads/TMap_Next_Book.pdf
When I upload to myfile, works fine
-> request sent:
POST https://greenhouse.lotus.com/files/basic/api/myuserlibrary/feed
X-Update-Nonce: <Nonce>
Slug: test-restore2
Content-Type: application/binary
Filename: /Users/Downloads/client-error-log.zip
I tried the Playground, but not well documented for that part, so so far no success.
Any of you were able to do that, and would be able to share the solution?
Thanks.
Rightfully this document should be called working with IBM Connections Community Files
http://www-10.lotus.com/ldd/lcwiki.nsf/xpAPIViewer.xsp?lookupName=IBM+Connections+5.0+API+Documentation#action=openDocument&res_title=Creating_community_files_ic50&content=apicontent
The introspection endpoint should be called to get the "community collection document feed"
it doesn't look like you have the URL parameter which is required. You should use the URL with a GET /files/basic/api/community/3a246a15-b4d6-44e1-a01d-1c3d89f1f9a4/introspection?communityUuid=3a246a15-b4d6-44e1-a01d-1c3d89f1f9a4
Then you'll look for
Community Collection
Documents Feed
/
You'll then POST your file to the href --- https://greenhouse.lotus.com/files/basic/api/collection/e78ba00e-cee6-460f-a9ee-0350bf344e0b/feed
I've asked the team to change the title of the page.
I would like to create a new Trello Card when a new User signs up for our webapplication.
To do that I requested a "read,write" Token (lets name it "myToken" ) for my user and I have my application key (lets name it "myKey").
Because I could not find any PHP-Wrapper I first used Fiddler to test the HTTP-Post request. Specifically I tried the following:
HTTP-POST
URL:
http://api.trello.com/1/cards
Request-Headers:
User-Agent: Fiddler
Host: api.trello.com
Content-Length: 177
Request Body:
key=myKey&token=myToken&name=newCardName&desc=newCarddescription&idList=myListId
However this doesnt work. I get back an HTML-Code, that shows a website which tells the user to login! What am I doing wrong?
Thanks #Daniel LeCheminant.
I made two mistakes:
1.) I used http instead of https
2.) I put the variables in the request body. Even though it is a post request, trello expects the variables in the url itself
This solution works for me:
https://api.trello.com/1/cards?key=myKey&token=myToken&name=newCardName&desc=newCarddescription&idList=myListId