1,129 Matching Annotations
  1. Oct 2022
    1. How do REST APIs work? REST, or “representational state transfer,” is a type of software design that gives access to data (aka “web resources”) by using a uniform and predefined set of operations. The payload - the data to be delivered - defined in the request itself, will be formatted in a language such as HTML, JSON, or XML. The set of operations are the methods available to HTTP, which is the underlying protocol for how browsers retrieve websites from servers. These methods include GET, POST, PUT, DELETE, and others.

      O que é payload

    2. REST APIs If you’ve heard people talk about JSON (javascript object notation), chances are they’re talking about REST APIs. Over 70% of all public APIs use REST, because of its fast performance, reliability, and ability to scale by reusing modular components without affecting the system as a whole.

      O que é REST API

    1. Communication with this endpoint consists of JSON-encoded messages sent from client to server and vice versa.

      Este é o EndPoint da API do Hypothesis.

    1. Para solicitar a primeira API, crie um URL que aponte para o “endpoint” da API com a qual deseja se comunicar e passe o URL à ação “Obter Conteúdo do URL”. Quando o atalho é executado, essa ação faz a solicitação de API.

      Parece que um EndPoint é a porta de comunicação entre um HTTP API server e seu cliente.

    1. If the common storage type has to be changed (for example from string to int), a migration of content is perfomed together with any necessary update of the mapping code
    1. With a well-defined versioning strategy, when releasing a non-backwards compatible version, you can keep the existing one and the new one working in parallel for a pre-defined window of time
    1. you will need to accommodate backwards compatibility or support multiple versions of an API running in parallel
  2. Sep 2022
    1. "detail": [ { "loc": [ "body", "name" ], "message": "Field required" }, { "loc": [ "body", "email" ], "message": "'not-email' is not an 'email'" } ]

      not complient with Problem Details, which requires details to be a string

  3. Aug 2022
    1. I'm building a Rails API with a separate web frontend app as "just another API client" (various smartphone apps to follow as well). In the previous "monolithic" version of the service, where all the server side was rolled into one Rails app
    1. The Widget API allows you to externally control the widget that is embedded on your website through javascript. You set the width and height of the widget to 0 and it hides the widget. I tinkered with this on codepen this week and I am pleased that I now have a working playlist ready to be utilized on my website.

      https://codepen.io/mdcrowcodes/pen/eYEMyzY

      ```js var iframeElement = document.querySelector('iframe'); var iframeElementID = iframeElement.id; var widget = SC.Widget(iframeElement); var x = document.getElementById("play");

      widget.bind(SC.Widget.Events.FINISH,function(){ widget.getCurrentSound(function(currentSound) { document.getElementById("currentTrack").innerHTML = currentSound.title; }); });

      function play(){<br /> if (x.innerHTML === "▶") { x.innerHTML = "||"; } else {x.innerHTML = "▶"; } widget.toggle(); };

      function next(){ x.innerHTML = "||"; widget.next(); widget.seekTo(0); widget.getCurrentSound(function(currentSound) { document.getElementById("currentTrack").innerHTML = currentSound.title; }); };

      function prev(){ x.innerHTML = "||"; widget.prev(); widget.seekTo(0); widget.getCurrentSound(function(currentSound) { document.getElementById("currentTrack").innerHTML = currentSound.title; }); };

      widget.bind(SC.Widget.Events.READY, function() { widget.getCurrentSound(function(currentSound) { document.getElementById("currentTrack").innerHTML = currentSound.title;

      widget.getSounds(function(tracks){ for (var i in tracks) {

         $('#tracklist').append("<li class='track-item' id='" + i + "'" + ">" + tracks[i].title + "</li>");
        }
      
       $(".track-item").click(function(){
         var s = this.id
         widget.seekTo(0);
      widget.skip(s);       
        x.innerHTML = "||" ;     widget.getCurrentSound(function(currentSound) {
      

      document.getElementById("currentTrack").innerHTML = currentSound.title; });

      });

      });

      }); }); ```

    1. yaml definitions: Annotation: type: object required: - user - uri properties: id: type: string description: Unique ID for this Annotation. uri: type: string description: URI which is the target of this Annotation. target: type: array items: - type: object properties: scope: type: array items: - type: string selector: type: array items: - type: object properties: type: description: Type of Selector--see Web Annotation Data Model. type: string source: type: string user: type: string description: User URI in the form of an `acct` prefixed URI. document: type: object description: Target document metadata schema: $ref: '#/definitions/DocumentMetadata' permissions: type: object description: Permissions for this Annotation. created: type: string format: date-time updated: type: string format: date-time AnnotationList: type: object properties: total: type: number rows: type: array items: $ref: '#/definitions/Annotation' DocumentMetadata: type: object properties: eprints: type: object title: type: string twitter: type: object properties: image:src: type: array items: type: string title: type: array items: type: string description: type: array items: type: string card: type: array items: type: string site: type: array items: type: string dc: type: object favicon: type: string prism: type: object highwire: type: object link: type: array items: type: object properties: href: type: string facebook: type: object properties: site_name: type: array items: type: string description: type: array items: type: string title: type: array items: type: string url: type: array items: type: string image: type: array items: type: string type: type: array items: type: string

    1. These are the key parameters.

      prop=revisions&rvprop=content&rvsection=0

      rvsection = 0 specifies to only return the lead section.

    1. you can also replicate the bind:this syntax if you please: Wrapper.svelte <script> let root export { root as this } </script> <div bind:this={root} />

      This lets the caller use it like this: <Wrapper bind:this={root} />

      in the same way we can already do this with elements: <div bind:this=

  4. Jul 2022
  5. Jun 2022
    1. # tunejack.sh uses the TuneIn public API (at opml.radiotime.com) to search for # a radio station, print out its details and try to play it somehow.
    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.
  6. May 2022
    1. json { "success": true, "message": "User logged in successfully", "data": { "user": { "id": 2, "name": "Client", "client_id": 1, "email": "client@clickapps.co", "gender_label": null, "gender": null, "mobile": "123654789", "code_country": "00967", "birth_date": null, "avatar": "http://localhost:3000/default_image.png", "sms_notification": true, "is_mobile_verified": false, "otp": { "otp": "8704" }, "client_city": { "id": 3, "name_ar": "الرياض", "name_en": "Riadh", "name": "Riadh", "status": 1, "status_label": "Active", "country": { "id": 2, "name": "Kingdub saudi Arab", "code_country": "ksa", "avatar": "http://localhost:3000/default_image.png", "status": 1, "status_label": "Active" } }, "client_locations": [ { "id": 1, "client_id": 1, "latitude": "0.0", "longitude": "0.0", "address": "169 Rath Rapids", "address_ar": "964 Michale Parkway", "address_en": "169 Rath Rapids", "building_name": "building_name", "location_type": 1, "location_type_label": "Home", "apartment_name": null, "require_permission": false, "city": null, "zip_code": null } ] }, "role": "client", "token": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MiwibmFtZSI6IkNsaWVudCIsImVtYWlsIjoiY2xpZW50QGNsaWNrYXBwcy5jbyIsIm1vYmlsZSI6IjEyMzY1NDc4OSIsImltYWdlIjoiL2RlZmF1bHRfaW1hZ2UucG5nIiwiYWRtaW4iOmZhbHNlLCJpYXQiOjE1NDc5MjU0MzIsImV4cCI6MTU1MDUxNzQzMn0.4Vyjd7BG7v8AFSmGKmIs4VM2FBw3gOLn97Qdf6U4jxU" } }

    1. If you want to fetch comics and metadata automatically, you can use the JSON interface. The URLs look like this: https://xkcd.com/info.0.json (current comic) or: https://xkcd.com/614/info.0.json (comic #614) Those files contain, in a plaintext and easily-parsed format: comic titles, URLs, post dates, transcripts (when available), and other metadata.
    1. bash $ curl https://api.specref.org/search-refs?q=json-ld | jq '.' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 38628 100 38628 0 0 44605 0 --:--:-- --:--:-- --:--:-- 44553 { "JSON-LD-TESTS": { "authors": [ "RDF Working Group" ], "href": "https://www.w3.org/2013/json-ld-tests/", "title": "JSON-LD 1.0 Test Suite", "date": "11 April 2013", "status": "ED", "publisher": "W3C", "id": "JSON-LD-TESTS" }, "json-ld": { "authors": [ "Manu Sporny", "Gregg Kellogg", "Markus Lanthaler" ], "href": "https://www.w3.org/TR/json-ld/", "title": "JSON-LD 1.0", "status": "REC", "publisher": "W3C", "deliveredBy": [ { "url": "https://www.w3.org/2011/rdf-wg/", "shortname": "rdf" } ], "versions": [ "json-ld-20201103", "json-ld-20140116", "json-ld-20131105", "json-ld-20130910", "json-ld-20130411", "json-ld-20120712" ], "id": "json-ld", "date": "3 November 2020" }, ...

    1. ``` HTTP/1.1 200 OK Content-Type: application/ld+json Link: http://api.example.com/doc/; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"

      { "@context": "http://www.w3.org/ns/hydra/context.jsonld", "@graph": [{ "@id": "http://api.example.com/people", "@type": "hydra:Collection", "api:personByName": "api:PersonByNameTemplate" }, { "@id": "http://api.example.com/events", "@type": "hydra:Collection", "api:eventByName": "api:EventByNameTemplate" } } ```

    1. If you are using RDFa within your pages, you can use the resource attribute to indicate that you are linking to a piece of legislation while including a link to another source of information. For example,

      html The <a rel="cite" resource="http://www.legislation.gov.uk/id/ukpga/1999/17" href="http://en.wikipedia.org/wiki/Disability_Rights_Commission_Act_1999">Disability Rights Commission Act 1999</a> replaced the National Disability Council with the Disability Rights Commission (DRC). will generate the triple

      <> xhv:cite <http://www.legislation.gov.uk/id/ukpga/1999/17>

    1. Exemplar output (in JSON)

      json [ { "oci": "02001010806360107050663080702026306630509-0200101080636102703040309", "citing": "10.1186/1756-8722-6-59", "cited": "10.1186/ar3439", "creation": "2013", "timespan": "P2Y", "journal_sc": "no", "author_sc": "no" }, { "oci": "02001010806360107050663080702026306630509-0200101080636102704000806", "citing": "10.1186/1756-8722-6-59", "cited": "10.1186/ar4086", "creation": "2013", "timespan": "P1Y", "journal_sc": "no", "author_sc": "no" }, { "oci": "02001010806360107050663080702026306630509-020010200003619122437020001023704023707090006", "citing": "10.1186/1756-8722-6-59", "cited": "10.1200/jco.2012.42.7906", "creation": "2013", "timespan": "P0Y", "journal_sc": "no", "author_sc": "no" }, { "oci": "02001010806360107050663080702026306630509-02003010009360008080300010805370200010237060604070907", "citing": "10.1186/1756-8722-6-59", "cited": "10.3109/08830185.2012.664797", "creation": "2013", "timespan": "P0Y", "journal_sc": "no", "author_sc": "no" }

    1. |Prefix|Supplier|Identifier type|Example| |--- |--- |--- |--- | |010|Wikidata|Wikidata Identifier (QID)|oci:01027931310-01022252312| |020|Crossref|Digital Object Identifier (DOI)|oci:02001010806360107050663080702026306630509-02001010806360107050663080702026305630301| |030|OpenCitations Corpus|OpenCitations Corpus Internal Identifier|oci:0301-03018| |040|Dryad|Digital Object Identifier (DOI)|oci:040050006013613273410133708070900-04003070302361019113701000000040801| |050|CROCI|Digital Object Identifier (DOI)|oci:05001000106361937321411281422370200010237000837000001-050010008073602000009020002|

    1. If you paste a message from somewhere else that spans multiple lines, you can quote that without having to manually prepend > to every line!
    1. We also support machine tags that follow the pattern NAMESPACE:KEY=VALUE. For example: geo:lat=43.555 camel:size=medium machine:tag=with space Machine tags are not revealed to the user on the track pages.

    1. Get all repos from the user https://api.github.com/users/:user/repos, then look for open_issues_count in the named repo.

      HI, when you get issues by page like issues?page=0&per_page=5 number property from first element will be count of issues.

  7. datatracker.ietf.org datatracker.ietf.org
    1. 4. Link Relations for Web Services

      In order to allow Web services to represent the relation of individual resources to service documentation/description and metadata, this specification introduces and registers three new link relation types.

      4.1. The service-doc Link Relation Type

      The "service-doc" link relation type is used to represent the fact that a resource or a set of resources is documented at a specific URI. The target resource is expected to provide documentation that is primarily intended for human consumption.

      4.2. The service-desc Link Relation Type

      The "service-desc" link relation type is used to represent the fact that a resource or a set of resources is described at a specific URI. The target resource is expected to provide a service description that is primarily intended for machine consumption. In many cases, it is provided in a representation that is consumed by tools, code libraries, or similar components.

      4.3. The service-meta Link Relation Type

      The "service-meta" link relation type is used to link to available metadata for the service context of a resource. Service metadata is any kind of data that may be of interest to existing or potential service users, with documentation/description being only two possible facets of service metadata. The target resource is expected to provide a representation that is primarily intended for machine consumption. In many cases, it is provided in a representation that is consumed by tools, code libraries, or similar components.

      Since service metadata can have many different purposes and use many different representations, it may make sense for representations using the "service-meta" link relation to offer additional hints about the specific kind or format of metadata that is being linked.

      This definition of the "service-meta" link relation makes no specific assumptions about how these link hints will be represented, and the specific mechanism will depend on the context where the "service-meta" link relation is being used.

      One example is that a "service-desc" link may identify an OpenAPI description, which is supposed to be the machine-readable description of a Web API. A "service-meta" link may identify a resource that contains additional metadata about the Web API, such as labels that classify the API according to a labeling scheme and a privacy policy that makes statements about how the Web API manages personally identifiable information.

    1. If you have a use case not supported by the existing public APIs, please ask and we'll be glad to add an API for you or make an existing private API public.

      please ask

  8. Apr 2022
    1. ORCID identifier types

      | Name | Description | Resolution Prefix | Case sensitive | Primary use | |----------------|---------------------------------------------------------------------------------|-------------------------------------------------|--------------------|-----------------| | agr | agr: Agricola | false | work | | ark | ark: Archival Resource Key Identifier | true | work | | arxiv | arxiv: ArXiv | https://arxiv.org/abs/ | false | work | | asin | asin: Amazon Standard Identification Number | http://www.amazon.com/dp/ | false | work | | asin-tld | asin-tld: ASIN top-level domain | false | work | | authenticusid | authenticusid: AuthenticusID | https://www.authenticus.pt/ | false | work | | bibcode | Bibcode | http://adsabs.harvard.edu/abs/ | true | work | | cba | cba: Chinese Biological Abstracts | false | work | | cienciaiul | cienciaiul: Ciência-IUL Identifier | https://ciencia.iscte-iul.pt/id/ | false | work | | cit | cit: CiteSeer | false | work | | ctx | ctx: CiteExplore submission | false | work | | dnb | dnb: German National Library identifier | https://d-nb.info/ | false | work | | doi | doi: Digital object identifier | https://doi.org/ | false | work | | eid | Scopus Identifier | false | work | | emdb | emdb: Electron Microscopy Data Bank | https://www.ebi.ac.uk/emdb/ | true | work | | empiar | empiar: Electron Microscopy Public Image Archive | https://www.ebi.ac.uk/empiar/ | true | work | | ethos | ethos: EThOS Peristent ID | http://ethos.bl.uk/OrderDetails.do?uin= | false | work | | grant_number | grant number | false | work | | hal | hal: Hyper Articles en Ligne | https://hal.archives-ouvertes.fr/view/resolver/ | false | work | | handle | handle: Handle | http://hdl.handle.net/ | false | work | | hir | hir: NHS Evidence | false | work | | isbn | isbn: International Standard Book Number | https://www.worldcat.org/isbn/ | false | work | | ismn | ismn: International Standard Music Number | false | work | | issn | issn: International Standard Serial Number. Includes print and electronic ISSN. | https://portal.issn.org/resource/ISSN/ | false | work | | jfm | jfm: Jahrbuch über die Fortschritte der Mathematik | http://zbmath.org/?format=complete&q=an%3A | false | work | | jstor | jstor: JSTOR abstract | http://www.jstor.org/stable/ | false | work | | kuid | kuid: KoreaMed Unique Identifier | https://koreamed.org/article/ | false | work | | lccn | lccn: Library of Congress Control Number | http://lccn.loc.gov/ | false | work | | lensid | lensid: Lens ID | https://www.lens.org/ | false | work | | mr | mr: Mathematical Reviews | http://www.ams.org/mathscinet-getitem?mr= | false | work | | oclc | oclc: Online Computer Library Center | http://www.worldcat.org/oclc/ | false | work | | ol | ol: Open Library | http://openlibrary.org/b/ | false | work | | osti | osti: Office of Scientific and Technical Information | https://www.osti.gov/biblio/ | false | work | | other-id | Other identifier type | false | work | | pat | Patent number | false | work | | pdb | pdb: Protein Data Bank identifier | http://identifiers.org/pdb/ | false | work | | pmc | pmc: PubMed Central article number | https://europepmc.org/article/pmc/ | false | work | | pmid | pmid: PubMed Unique Identifier | https://pubmed.ncbi.nlm.nih.gov/ | false | work | | ppr | ppr: Europe PMC Preprint Identifier | https://europepmc.org/article/PPR/ | false | work | | proposal-id | Proposal ID | false | work | | rfc | rfc: Request for Comments | https://tools.ietf.org/html/ | false | work | | rrid | rrid: Research Resource IDentifier | https://identifiers.org/rrid/ | true | work | | source-work-id | Non-standard ID from work data source | false | work | | ssrn | ssrn: Social Science Research Network | http://papers.ssrn.com/abstract_id= | false | work | | uri | uri: URI | true | work | | urn | urn: URN | false | work | | wosuid | wosuid: Web of Science™ identifier | false | work | | zbl | zbl: Zentralblatt MATH | http://zbmath.org/?format=complete&q= | false | work |

  9. Mar 2022
    1. service-desc Link relation type

      One way to point to your OAS document is to use an HTTP Link header with a relation-type (rel value) of service-desc. More information can be found in RFC-8631

    1. his serves as a good example of apt-gets stability. In apt, the name was changed to be more user friendly, while in apt-get the name remains unchanged so as not to break compatibility with old scripts.
    2. Use apt as a first choice, but if you're scripting use apt-get. Apt-get has more stable output (meaning that the output format is left alone as much as possible so as not to break scripts which parse that output automatically). Apt-get also has some low-level commands not available in apt.
    1. As mentioned earlier, PATCH requests should apply partial updates to a resource, whereas PUT replaces an existing resource entirely. It's usually a good idea to design updates around PATCH requests

      Prefer PATCH over PUT

    2. Aside from using HTTP status codes that indicate the outcome of the request (success or error), when returning errors, always use a standardized error response that includes more detailed information on what went wrong.

      For example: ``` // Request => GET /users/4TL011ax

      // Response <= 404 Not Found { "code": "user/not_found", "message": "A user with the ID 4TL011ax could not be found." } ```

    3. https://api.averagecompany.com/v1/health https://api.averagecompany.com/health?api_version=1.0

      2 examples of versioning APIs

    4. When dealing with date and time, APIs should always return ISO 8601-formatted strings.
  10. Feb 2022
  11. Jan 2022