36 Matching Annotations
  1. Nov 2022
  2. Aug 2022
  3. Jun 2022
    1. The creator of GraphQL admits this. During his presentation on the library at a Facebook internal conference, an audience member asked him about the difference between GraphQL and SOAP. His response: SOAP requires XML. GraphQL defaults to JSON—though you can use XML.
    2. Conclusion There are decades of history and a broad cast of characters behind the web requests you know and love—as well as the ones that you might have never heard of. Information first traveled across the internet in 1969, followed by a lot of research in the ’70s, then private networks in the ’80s, then public networks in the ’90s. We got CORBA in 1991, followed by SOAP in 1999, followed by REST around 2003. GraphQL reimagined SOAP, but with JSON, around 2015. This all sounds like a history class fact sheet, but it’s valuable context for building our own web apps.
  4. Jan 2022
    1. The key thing about the REST approach is that the server addresses the client state transitions. The state of the client is almost totally driven by the server and, for this reason, discussions on API versioning make little sense, too. All that a client should know about a RESTful interface should be the entry point. The rest should come from the interpretation of server responses.
    2. In fact, most people believe that to build a RESTful API you can simply create an API based on URLs and HTTP verbs. This is absolutely false. This misunderstanding is going around for too long.
  5. Nov 2021
    1. Feature GraphQL REST

      GraphQL vs *REST (table)

    2. There are advantages and disadvantages to both systems, and both have their use in modern API development. However, GraphQL was developed to combat some perceived weaknesses with the REST system, and to create a more efficient, client-driven API.

      List of differences between REST and GraphQL (below this annotation)

  6. Sep 2021
  7. Jun 2021
  8. Feb 2021
  9. Jun 2020
    1. You can use any Firebase Database URL as a REST endpoint. All you need to do is append .json to the end of the URL and send a request
  10. Mar 2020
    1. OpenAPI links are different than HAL links or HATEOAS links, because these links mainly specify the "flow" throughout the API methods.

    2. OpenAPI links do not require the link information present in the actual responses

      This means that these links mostly document the way this API can be traversed.

    3. traversal mechanism between the operations
  11. Nov 2019
    1. REST and GraphQL are wonderful tools to create an API that is meant to be consumed by third parties. Facebook's API, for example, is consumed by ~200k third parties. It is no surprise that Facebook is using (and invented) GraphQL; a GraphQL API enables third parties to extensively access Facebook's social graph enabling them to build all kinds of applications. For an API with that many consumers, GraphQL is the fitting tool. But, to create an internal API (an API developed and consumed by code written by the same organization), RPC offers a simpler and more powerful alternative. Large companies, such as Netflix, Google and Facebook, are starting to replace REST/GraphQL with RPC for their internal APIs. Most notably with gRPC which is getting popular in the industry.
    1. The result of the uniform interface is that requests from different clients look the same, whether the client is a chrome browser, a linux server, a python script, an android app or anything else

      Reason of the uniform interface - requests from different clients look the same

    2. The client can request code from the server, and then the response from the server will contain some code, usually in the form of a script, when the response is in HTML format. The client then can execute that code

      6) Code-on-demand (optional) - when the response is in HTML format, the response will come in form of a script, which can be executed

    3. data the server sends contain information about whether or not the data is cacheable. If the data is cacheable, it might contain some sort of a version number. The version number is what makes caching possible: since the client knows which version of the data it already has (from a previous response), the client can avoid requesting the same data again and again

      5) Cacheable - client can avoid requesting the same data again, thanks to remembering the version number of the cacheable data

    4. In order for an API to be RESTful, it has to adhere to 6 constraints

      6 constraints of RESTful API:

      1. uniform interface
      2. client - server separation
      3. stateless
      4. layered system
      5. cacheable
      6. code-on-demand (optional)
    5. there might be a number of servers in the middle. These servers might provide a security layer, a caching layer, a load-balancing layer, or other functionality

      4) Layered system - there's a number of server between the server and the response

    6. Stateless means the server does not remember anything about the user who uses the API

      3) Stateless - server doesn't store any history/information of user's requests

    7. client and the server act independently, each on its own, and the interaction between them is only in the form of requests, initiated by the client only, and responses, which the server send to the client only as a reaction to a request

      2) Client - server separation - client and server act independently, communicating through requests (client) and responses (server)

    8. Uniform interface

      1) Uniform interface has 4 parts:

      1. Request to the server includes resource identifier.
      2. Response from the server includes enough information so the client can modify the resource.
      3. Request to APi contains all the information server needs to perform the request, and vice versa.
      4. Hypermedia as the engine of application state - the server can inform the client, in a response, of the ways to change the state of the web application.
    1. What the server does when you, the client, call one of its APIs depends on 2 things that you need to provide to the server

      2 things required by the server:

      1. endpoint <--- identifier of a resource (its URL).
      2. HTTP method / verb <--- operation to perform: GET, POST, PUT, DELETE
    2. The representation of the state can be in a JSON format, and probably for most APIs this is indeed the case. It can also be in XML or HTML format

      JSON, XML or HTML <--- most popular formats of state representations

    3. It means when a RESTful API is called, the server will transfer to the client a representation of the state of the requested resource.

      Reason REST is named as REST:

      *REpresentational State Transfer*

    4. RESTful web application exposes information about itself in the form of information about its resources. It also enables the client to take actions on those resources, such as create new resources (i.e. create a new user) or change existing resources (i.e. edit a post).

      RESTful web application

  12. Jun 2019
  13. Jun 2018
    1. 一开始数据源的上传用的是 -d @/home/centos.tar  这个选项,但是经过反复试验,这个选项TM上传文件不完整,800M的文件只能上传230M,反复查找问题也找不到,最终换成--upload-file选项,上传成功,且根据此镜像可正常启动实例
      curl -i -X PUT -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" -d @/home/glance/ubuntu-12.10.qcow2 $image_url/v2/images/{image_id}/file
      curl -i -X PUT -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" --upload-file @/home/glance/ubuntu-12.10.qcow2 $image_url/v2/images/{image_id}/file
    1. curl -H "Content-Type:application/json" -X POST -d 'json data' URL
      curl -H "Content-Type:application/json" -X POST -d '{"user": "admin", "passwd":"12345678"}'
  14. Mar 2017