Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 3.06 KB

GraphqlOverview.md

File metadata and controls

59 lines (44 loc) · 3.06 KB

Graphql Overivew

Intro

CRM Graphql API endpoints

  • You can test graphql queries through the UI interface at the end point url /graphql

    graphql interface

  • The web interface is amazing and supports autocompletion for arguments and query structure, even model field names

  • The web interface has a side menu called Docs where you can find API documentation on any operation you're issuing Note that most query arguments are strings and following our custom Query Syntax

    graphql interface

  • using any HTTP client you also send requests to the end point url /api

CRM Graphql API General Overview

  • Graphql API is divided into 2 categories:

    • Queries (To Query Data)
    • Mutations (Manipulate Data) / (CRUD operations)
  • Our API end points is divided is also divided into the same 2 main categories (for each DB model)

    • Queries
      • Get ALl Records of certain model.
      • Filter Subset of Records based on some conditions
      • Get one record using its id
    • Mutations
      • Update
      • Delete
      • Create
      • Other custom actions depending on the DB model used; i.e a user may have add_task action exposed that may/may not exposed elsewhere
  • The query API is kinda look the same for all models

    • we have plural queries contacts, deals, ... to get all records in these models or subset of them based on some condition
    • we have singular queries contact, deal, ... to get one record of these models and they take uid argument which is the object id
  • Mutations API is mostly similar for all models but partially different in some cases

    • create operations are named like create_contact, create_deal, ...
    • update operations are named like update_contact, update_deal, ...
    • delete operations are named like delete_contact, delete_deal, ...
    • custom operations for each model and documented our API page

Important

  • Graphene by default assign an (id) field to each record returned in a query which is unique internal representation of the record, but this introduces a problem to us, because this hides the original (id) field coming from DB. To overcome this we refer to the original id field with (uid) in our queries and mutations*

complete List of Graphql API

  • Find it here or simply browse the endpoint /docs/graphqlapi assuming you are using caddy installation