I started learning web api recently. I know in web api we use get verb to retrieve data, post verb to insert data, put verb to update data, etc.
Someone asked me why we need separate verbs for insert,update, delete etc. We can do delete by using the verb post or can do update using verb delete. Why then use separate verbs?
I searched it on the internet, but I am not able to find exact answer to his question. So I thought to ask here.
Sorry for asking stupid question.
Related
in my Laravel 5.7/mysql app I need to make external api to read some data from external
app with get request and to write some data to my db with post request.
Which tools/scripts are there for this and how to make these requests safe?
MODIFIED :
Thanks for feedbacks, but looks like I badly put my question
The external app(I do not know what is it written with) need to read data from my app
and write data to my Laravel 5 app.
And how have I to test these requests while on development locally ?
Looks like I have to use Guzzle as in provided link?
Which steps have I to take for safety on my side?
Thanks!
These three libraries are popular for your use-case:
Guzzle
Curl
zttp
If the database is local you can use Eloquent, If not, remote connection to that database may help. otherwise, if you only have API access you should consume eighter of above libraries or any alternative options to make an HTTP request your application might require.
Security-wise, as long as you are only making a request to a remote server, the Suggested way is to store any key or secret string related to authorizing your request (if applicable) in your .env to prevent it from committed to your version control systems. Needless to say to always handle any possible HTTP error your remote API might throw in order to prevent any unwanted error on your application side.
And as Abir Adak mentioned in the comment check this thread for further details.
Updated Answer: On the case of MODIFIED part, generally you have 3 popular options,
REST API
This blog post is a detailed walkthrough written for Laravel
This one from Stack Overflow can help you with designing you API
This last one can help you to develop a widely accepted API response and endpoints by following its specifications.
GraphQL
Can save some time for developing your API, but I suggest to make sure that the consumers of your API are happy to use this option.
GraphQ
Laravel Package for GraphQL
If using Laravel isn't a must, and you are using PostgreSQL, you might want to look at Hasura as well.
SOAP
Have little knowledge on this option for Laravel, just know folks coding using C# and .net are happier to expose their API with this protocol. read more about it on WikiPedia
Postman is a great tool for testing your API or any other API.
I am in the process of converting our project from the Shopify REST API over to the GraphQL API, however, I can't seem to find a way to pull "Abandoned checkouts".
This is the REST API documentation for abandoned checkouts that I am currently using and referencing:
https://help.shopify.com/en/api/reference/orders/abandoned-checkouts
I can't seem to find the equivalent using GraphQL.
Schema has nothing on that. Probably a better idea to direct your question at Shopify API dev forums. At least there you're bound to get an answer from Shopify, whereas here, you're bound to hear crickets chirping.
Please forgive me, I am fairly new to the Dialogflow Api (v2.)
I am starting off with testing these API calls using the Google API Explorer utility on the right side of the page.
My question is specifically about the "access_token" field:
Is this supposed to be the JSON authentication file that I downloaded from the Google Cloud Console when I created a new service account?
If not, then where do I find the specific resource I am actually supposed to pass into this field?
Side note: I read in the support section: "Google engineers monitor and answer questions about the Google API Explorer on Stack Overflow using the tag google-apis-explorer." Thank you all in advance for your service/help in this topic!
The access_token field is a higher-level field used across the API by some tooling. In some manual client libraries, you might need to use it, but for the API Explorer utility and for most use-cases, you can ignore it. This is true of most (maybe all) fields under the "Show standard parameters" zippy.
The documentation on the left side should explain the relevant fields you need to fill in to successfully complete a request. Keep in mind that even some of these fields are optional; you can leave them blank if they are not relevant to your goal.
I have been attempting to get the twitter trends but I am unsure of how to do this with json. I also have not found any good tutorials that I am able to follow to accomplish this successfully. As of now, I have been using Hammock to get my statuses, mentions, etc. Are there any tutorials that completely describe how to do this?
The best way is using the Twitter Official API (JSON). You can see the example.
Anyway, I found a link that may help you: Windows Phone 7 – Asynchronous Programming.
All you have to do is use this API method, with an unauthenticated HTTP request.
Given that you are a beginner, here are some starting tips:
How to perform a HTTP request
Parsing JSON with JSON.NET
When you go to edit your favorite music or movies on Facebook, you will notice an autocomplete suggest list that is basically a list of "everything" (brand names, music artists, movies, etc.) How can someone consume that list in their own code? Is it part of the Facebook API?
They wrap some of the functionality in their FBML fields, but their developer wiki shows how they do what they do. If you want to consume their data though, you're going to have to play with an HTTP proxy and figure out what parameters to send to their server. There are also a couple parameters that seem to be session based, so I don't know how well you're going to be able to integrate this into your own application.
This was working for awhile, but now they require the session cookie, so we'll have to hope they add support for this to the graph api, unless you want to fight w/ the proxy.