Updating entry of Contentful using postman - postman

As you can check below screenshot I tried to make PUT api call in the Contentful to update the entry.
When I try to hit GET call, everything works fine but don't understand here what is reason of this below error while making PUT call.
Did I missed anything here or anything wrong here?
NOTE: I changed all the variable while making call, spaceId, env, entryId and authorisation(passing access_token)

From what I see in your URL, it looks like you are trying to hit the Contentful Preview API, which is read-only.
API Base URL https://preview.contentful.com
This is a read-only API
source
Therefore, updating an entry via a PUT request cannot be done with the url you are using.
However, I believe your PUT request should work if you update the base url to be https://api.contentful.com/ instead. This is the endpoint for the Content Management API.
Important note:
if you do this, you will need to use a different auth token for the Content Management API.
Using https://api.contentful.com/ hits the writable Content Management API, which has documentation for the PUT request you are making.
Importing the corresponding curl command into your Postman client will confirm this.
So in the end, the url would be this:
https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/entries/{entry_id}
Again, the bearer token will have to come from the writable Content Management API.

Related

How to send data to AWS API server in JSON with Retrofit and OkHttp?

Okay so I am supposed to make this API call:
I am supposed to send the request with all the appropriate headers. I don't know what the -F stands for though. Basically I need to update the user's profile picture. I do that by sending the path to the image in the internal storage, and in return I get the User with the updated profile picture URL posted on AWS. I don't know what I am doing wrong...
My API module looks like this
The URL is "http://localhost:3000"
My request looks like:
Does the -F in the first picture stand for Field? Am I using it right?
This is the function where I make the API call
My response looks like this
The User class looks like this
Chucker doesn't show anything. And I get this error

How to restrict access to Chatting service only to registered websites

I am making a chatting service (something like Zendesk) and a website must be registered in order to use the service. There will be a frame which the website owner places in the .html file and the rest is up to me.
Problem
Anyone can start using the service right now (by reading the requests and copying them in Postman). I want a method to restrict access only to those websites that have registered to use the service when the session is started or by the messages sent from that session.
Failed solutions (to give an idea of what I am trying to do)
A stupid idea was to read and send the website URL with JavaScript and check if it exists in the database, but that can easily be forged.
I also tried generating unique tokens for each registered website, but the token is something that must be send with the request for validation and since it is something that public can see (the token is placed with the frame) that token is indeed meaningless. (Maybe I don't understand how tokens work)
At this point, seems like this is inevitable, any Ideas?
(Back-end is written in Django 3.1 and My database tables look like this, if it helps - Ignore the details, just an overview)

Missing Authentication Token while accessing API Gateway when tested in chrome but working in postman

I created an AWS Lambda function which invokes the endpoint of ML model I created in sagemaker. I tested it and it's working fine. Next I created REST API that calls this lambda function. I set any authentication type as NONE. Anyone with the url can access it. I created it following this aws blog. I tested my url in postman. It's working fine in postman but when I entered the url in chrome, its throwing {"message":"Missing Authentication Token"} error. Can someone please tell how do I get rid of that error while testing my url in chrome
The error is misleading. It's got absolutely nothing to do with tokens. What is actually happening is that the URL you are trying to access is invalid.
API Gateway's URL looks like this: https://xxxxxxx.execute-api.some-region.amazonaws.com/your-stage but it's very likely that you created an endpoint on API Gateway, which would then be accessible via https://xxxxxxx.execute-api.some-region.amazonaws.com/your-stage/YOUR_ENDPOINT
If you hit the base URL or a path which does not exist, you will get that weird, misleading Missing Authentication Token message.
So, long story short, hit a valid path for your API and it should work just fine.
Tip: maybe you are doing a POST request via Postman but whenever you try with the browser it issues a GET request, which would also result in an invalid path and therefore the Missing Authentication Token message.

Facebook auth setup

How can I setup PAW to work with Facebook locally for development? Or even at all for that matter?
I have a node.js backend that I'm setting up with Facebook Auth. Every one of my routes needs the user to be logged in. I have two endpoints related to FB Auth. localhost:3000/api/v1/loginFB and localhost:3000/api/v1/callbackFB. Both of these work great in a web browser.
loginFB simply returns this string... https://www.facebook.com/dialog/oauth?client_id=523534457345&redirect_uri=https://localhost:3000/api/v1/callbackFB&scope=email,public_profile,user_friends.
When I call that URI in a browser, it returns a code=blahblah which my callbackFB endpoint uses to fire off another request to get the access token. All good.
So now in PAW I'm confused by the difference between the request URI and the Authorization URL text field? Should I use the loginFB URI for my request URI? And then https://www.facebook.com/dialog/oauth in the Authorization URL textfield?
Basically what's happening is that when I click Get Access Token, it returns the code but my callbackFB endpoint 500's by saying "This authorization code has been used." The code that it's getting returned is definitely different each time I Get Access Token.
This is where I'm at with this thing (Client ID and Client Secret are actually my App ID and App Secret from fb's dev management site, and the Access Token URL is actually set to https://graph.facebook.com/v2.3/oauth/access_token which I'm 99% sure is the correct URI):
This is the error I get when I click Get Access Token button:
It would be awesome to get some advice from anyone with experience with this issue. Thanks.
Re: #MichaMazaheri
tl;dr Fixed in version 2.2.2
Sorry for the super late follow-up. We actually fix this exact issue in Paw 2.2.2, which is already released on our website, and pending review for the Mac App Store. (It was some JSON vs. Form URL-Encoded parsing issue). Thanks for reporting.

Empty Checkin Response

I'm having an issue that I've seen in a couple of places, but with no real resolution.
I'm attempting to view my friends' checkins using the /checking api. I'd prefer not to use fql, as proposed in this answer: Graph Checkin method returns empty data, because I'd like to have all of the user/place/checkin meta data in one call.
I've tested the call using the access token that all the examples on the Graph API docs site use (http://developers.facebook.com/docs/reference/api/). When I use that access token on this url:
https://graph.facebook.com/103309013088837/checkins?access_token=ACCESS_TOKEN
I get back a result with one checkin.
However, when I use the token I've generated via my app on the same url I get an empty data set. I've confirmed that the permissions on both tokens are the same using the /me/permissions call and that other calls return the same result for both access tokens.
Is there something that needs to be configured on the app side? Is there anything else I could be doing incorrectly?