### Prospyr API GraphQL Queries Source: https://docs.prospyrmed.com/docs/getting-started Provides examples of GraphQL queries for retrieving data from the Prospyr API. This includes fetching provider information and patient details using primary keys. ```graphql query GetProvider($id: uuid!) { provider_by_pk(id: $id) { id firstName lastName } } ``` ```graphql query GetPatientById($id: uuid!) { patient_by_pk(id: $id) { id firstName lastName email phoneNumber } } ``` -------------------------------- ### Search Patients with Fragment API Source: https://docs.prospyrmed.com/docs/getting-started Demonstrates how to use GraphQL fragments to reuse selections of fields in queries, specifically for searching patients. ```APIDOC ## POST /v1/graphql ### Description Searches for patients and reuses common field selections using GraphQL fragments. This improves query readability and maintainability. ### Method POST ### Endpoint https://prod.prospyrmedapi.com/v1/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string to execute. - **variables** (object) - Optional - Variables to be used with the GraphQL query. ### Request Body ```json { "query": "fragment PatientBasicInfo on patient { id firstName lastName email } query searchPatientsWithFragment { searchPatients(args: { search: \"smith\" }) { ...PatientBasicInfo dateOfBirth } }" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the query. - **searchPatients** (array) - An array of patient objects matching the search criteria. - **id** (integer) - The unique identifier for the patient. - **firstName** (string) - The first name of the patient. - **lastName** (string) - The last name of the patient. - **email** (string) - The email address of the patient. - **dateOfBirth** (string) - The date of birth of the patient. ``` -------------------------------- ### Execute setupWorkspaceTwilioAccount operation Source: https://docs.prospyrmed.com/docs/graphql/operations/mutations/setup-workspace-twilio-account This operation initializes the Twilio workspace configuration. It returns a TwilioAccountSetupResponse object containing the status and details of the account setup. ```GraphQL setupWorkspaceTwilioAccount: TwilioAccountSetupResponse! ``` -------------------------------- ### GraphQL Fragments for Reusable Selections Source: https://docs.prospyrmed.com/docs/getting-started Illustrates the use of GraphQL fragments to define reusable selections of fields. This promotes code efficiency and maintainability by avoiding repetition in query definitions. ```graphql fragment PatientBasicInfo on patient { id firstName lastName email } query searchPatientsWithFragment { searchPatients(args: { search: "smith" }) { ...PatientBasicInfo dateOfBirth } } ``` -------------------------------- ### Get Provider Information API Source: https://docs.prospyrmed.com/docs/getting-started Retrieves detailed information about a specific provider using their ID. ```APIDOC ## POST /v1/graphql ### Description Fetches information for a specific provider based on their unique identifier. ### Method POST ### Endpoint https://prod.prospyrmedapi.com/v1/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string to execute. - **variables** (object) - Required - Variables to be used with the GraphQL query. - **id** (uuid) - Required - The unique identifier of the provider. ### Request Body ```json { "query": "query GetProvider($id: uuid!) { provider_by_pk(id: $id) { id firstName lastName } }", "variables": { "id": "provider-uuid" } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the query. - **provider_by_pk** (object) - Information about the provider. - **id** (string) - The unique identifier of the provider. - **firstName** (string) - The first name of the provider. - **lastName** (string) - The last name of the provider. ``` -------------------------------- ### Query Multiple Providers with Aliases (GraphQL) Source: https://docs.prospyrmed.com/docs/getting-started Demonstrates how to query multiple providers in a single GraphQL request by using aliases. This allows for fetching distinct sets of data from the same or different fields within a single API call. No specific dependencies are required beyond a GraphQL client. ```graphql query GetMultipleProviders { provider1: provider_by_pk(id: 1) { firstName lastName specialty } provider2: provider_by_pk(id: 2) { firstName lastName specialty } } ``` -------------------------------- ### Authentication Error Source: https://docs.prospyrmed.com/docs/getting-started Handles errors related to missing or invalid authentication tokens. ```APIDOC ## Common Errors ### Authentication Error #### Description This error occurs when the `Authorization` header is missing or contains an invalid JWT token, or if the `app` header is not set to "api". #### Response Example ```json { "errors": [ { "message": "Authorization header is missing or invalid" } ] } ``` #### Solution Ensure your JWT token is correctly set in the `Authorization` header with the Bearer scheme and the `app` header is set to "api". ``` -------------------------------- ### GET /package Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/package Retrieves a list of packages from the database with support for filtering, sorting, and pagination. ```APIDOC ## GET /package ### Description Fetch data from the 'package' table with optional filtering, sorting, and pagination. ### Method GET ### Endpoint /package ### Parameters #### Query Parameters - **distinct_on** ([package_select_column!]) - Optional - Distinct select on columns. - **limit** (Int) - Optional - Limit the number of rows returned. - **offset** (Int) - Optional - Skip the first n rows. Use only with order_by. - **order_by** ([package_order_by!]) - Optional - Sort the rows by one or more columns. - **where** (package_bool_exp) - Optional - Filter the rows returned. ### Request Example { "limit": 10, "order_by": { "id": "asc" } } ### Response #### Success Response (200) - **data** (Array) - A list of package objects. #### Response Example { "data": [ { "id": 1, "name": "Basic Package" }, { "id": 2, "name": "Premium Package" } ] } ``` -------------------------------- ### serviceProvider_stream_cursor_value_input Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/service-provider-stream-cursor-value-input Defines the input object structure for initializing the starting point of a data stream. ```APIDOC ## Input Object: serviceProvider_stream_cursor_value_input ### Description This input object defines the initial value of the column from where the streaming process should commence. ### Fields - **id** (uuid) - Required - Unique identifier for the cursor value. - **providerId** (uuid) - Required - The unique identifier for the service provider. - **serviceId** (uuid) - Required - The unique identifier for the specific service. ### Member Of - serviceProvider_stream_cursor_input ### Request Example { "id": "550e8400-e29b-41d4-a716-446655440000", "providerId": "a1b2c3d4-e5f6-7890-abcd-1234567890ab", "serviceId": "f9e8d7c6-b5a4-3210-fedc-0987654321ba" } ``` -------------------------------- ### Make a Search Patients API Request Source: https://docs.prospyrmed.com/docs/getting-started Demonstrates how to perform a search for patients using the Prospyr API. This snippet shows the necessary HTTP method, headers, and data payload for a successful request. ```curl curl -X POST $PROSPYR_API_URL \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PROSPYR_JWT_TOKEN" \ -H "app: api" \ -d '{"query": "query searchPatients { searchPatients(args: { search: \"john\" }, limit: 5) { ...PatientSearchFields } }"}' ``` ```javascript const axios = require('axios'); const query = ` query searchPatients { searchPatients(args: { search: "john" }, limit: 5) { ...PatientSearchFields } } `; axios.post(process.env.PROSPYR_API_URL, { query }, { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.PROSPYR_JWT_TOKEN}`, 'app': 'api' } } ) .then(response => console.log(JSON.stringify(response.data, null, 2))) .catch(error => console.error('Error:', error.response?.data || error.message)); ``` ```python import os import requests import json query = """ query searchPatients { searchPatients(args: { search: "john" }, limit: 5) { ...PatientSearchFields } } """ headers = { 'Content-Type': 'application/json', 'Authorization': f"Bearer {os.environ['PROSPYR_JWT_TOKEN']}", 'app': 'api' } response = requests.post( os.environ['PROSPYR_API_URL'], json={'query': query}, headers=headers ) print(json.dumps(response.json(), indent=2)) ``` -------------------------------- ### GET /promotionServices_by_pk Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/promotion-services-by-pk Fetches a single promotion service record from the database using its unique primary key ID. ```APIDOC ## GET /promotionServices_by_pk ### Description Fetches data from the "promotionServices" table using primary key columns. ### Method GET ### Endpoint /promotionServices_by_pk ### Parameters #### Query Parameters - **id** (uuid!) - Required - The unique identifier of the promotion service. ### Request Example { "id": "550e8400-e29b-41d4-a716-446655440000" } ### Response #### Success Response (200) - **promotionServices** (object) - The requested promotion service object containing columns and relationships. #### Response Example { "data": { "promotionServices_by_pk": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Example Promotion", "description": "Service details" } } } ``` -------------------------------- ### GET /serviceAddOn_by_pk Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/service-add-on-by-pk Retrieves a single serviceAddOn object based on the provided primary key ID. ```APIDOC ## QUERY serviceAddOn_by_pk ### Description Fetch data from the table "serviceAddOn" using primary key columns. ### Method QUERY ### Endpoint serviceAddOn_by_pk(id: uuid!) ### Parameters #### Path Parameters - **id** (uuid!) - Required - The unique identifier of the service add-on. ### Request Example query { serviceAddOn_by_pk(id: "550e8400-e29b-41d4-a716-446655440000") { id name price } } ### Response #### Success Response (200) - **serviceAddOn** (object) - The requested serviceAddOn object containing columns and relationships. #### Response Example { "data": { "serviceAddOn_by_pk": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Premium Support", "price": 99.99 } } } ``` -------------------------------- ### GET /package_by_pk Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/package-by-pk Fetches a single package record from the 'package' table using the primary key ID. ```APIDOC ## GET /package_by_pk ### Description Fetches data from the table "package" using primary key columns. ### Method GET ### Endpoint /package_by_pk ### Parameters #### Query Parameters - **id** (uuid!) - Required - The unique identifier of the package to retrieve. ### Request Example { "id": "550e8400-e29b-41d4-a716-446655440000" } ### Response #### Success Response (200) - **package** (object) - The package object containing columns and relationships. #### Response Example { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Standard Package", "description": "Basic service package" } ``` -------------------------------- ### GET /leadFormStep_by_pk Source: https://docs.prospyrmed.com/docs/graphql/operations/subscriptions/lead-form-step-by-pk Fetch data from the leadFormStep table using primary key columns. ```APIDOC ## GET /leadFormStep_by_pk ### Description Fetch a single record from the "leadFormStep" table using its primary key (id). ### Method GET ### Endpoint /leadFormStep_by_pk ### Parameters #### Query Parameters - **id** (uuid!) - Required - The unique identifier of the lead form step. ### Request Example GET /leadFormStep_by_pk?id=550e8400-e29b-41d4-a716-446655440000 ### Response #### Success Response (200) - **leadFormStep** (object) - The requested lead form step record. #### Response Example { "id": "550e8400-e29b-41d4-a716-446655440000", "step_name": "Contact Information", "order": 1 } ``` -------------------------------- ### promotionCoupons_stream_cursor_value_input Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/promotion-coupons-stream-cursor-value-input Defines the input object used to specify the starting point for streaming promotion coupon records. ```APIDOC ## Input Object: promotionCoupons_stream_cursor_value_input ### Description This input object defines the initial values for columns used to determine the starting point of a data stream for promotion coupons. ### Fields - **couponId** (uuid) - Optional - The unique identifier of the coupon. - **createdAt** (timestamptz) - Optional - The timestamp indicating when the record was created. - **id** (uuid) - Optional - The unique identifier of the stream record. - **promotionId** (uuid) - Optional - The identifier of the associated promotion. - **updatedAt** (timestamptz) - Optional - The timestamp indicating when the record was last updated. - **workspaceId** (uuid) - Optional - The identifier of the workspace associated with the coupon. ### Request Example { "couponId": "550e8400-e29b-41d4-a716-446655440000", "createdAt": "2023-10-27T10:00:00Z", "id": "7d9a2b3c-4e5f-6a7b-8c9d-0e1f2a3b4c5d", "promotionId": "123e4567-e89b-12d3-a456-426614174000", "updatedAt": "2023-10-27T12:00:00Z", "workspaceId": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11" } ``` -------------------------------- ### POST /graphql (Get Provider by ID) Source: https://docs.prospyrmed.com/docs/sample-requests Retrieves comprehensive details for a specific provider using their unique identifier. ```APIDOC ## POST /graphql ### Description Fetch detailed information for a single provider including schedules, services, and location associations. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body - **id** (uuid) - Required - The unique identifier of the provider. ### Request Example { "query": "query GetProviderById($id: uuid!) { provider_by_pk(id: $id) { id firstName lastName email } }", "variables": { "id": "uuid-value" } } ### Response #### Success Response (200) - **provider_by_pk** (Object) - The provider details object. #### Response Example { "data": { "provider_by_pk": { "id": "uuid", "firstName": "John", "lastName": "Doe", "email": "john@example.com" } } } ``` -------------------------------- ### Fetch All leadFormSteps with Filtering and Ordering Source: https://docs.prospyrmed.com/docs/graphql/types/objects/lead-form-step Illustrates fetching a list of 'leadFormStep' objects with options for filtering, ordering, limiting, and offsetting results. This uses the 'leadFormStep' query and its associated arguments. ```graphql query GetAllLeadFormSteps($limit: Int, $offset: Int, $orderBy: [leadFormStep_order_by!], $where: leadFormStep_bool_exp) { leadFormStep(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) { id name title order } } ``` -------------------------------- ### Get Patient By ID API Source: https://docs.prospyrmed.com/docs/getting-started Retrieves patient details using their unique ID, demonstrating the use of GraphQL variables. ```APIDOC ## POST /v1/graphql ### Description Fetches a patient's details using their unique ID. This example demonstrates the use of GraphQL variables for dynamic queries. ### Method POST ### Endpoint https://prod.prospyrmedapi.com/v1/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string to execute. - **variables** (object) - Required - Variables to be used with the GraphQL query. - **id** (uuid) - Required - The unique identifier of the patient. ### Request Body ```json { "query": "query GetPatientById($id: uuid!) { patient_by_pk(id: $id) { id firstName lastName email phoneNumber } }", "variables": { "id": 123 } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the query. - **patient_by_pk** (object) - Information about the patient. - **id** (integer) - The unique identifier of the patient. - **firstName** (string) - The first name of the patient. - **lastName** (string) - The last name of the patient. - **email** (string) - The email address of the patient. - **phoneNumber** (string) - The phone number of the patient. ``` -------------------------------- ### Rate Limiting Error Source: https://docs.prospyrmed.com/docs/getting-started Handles errors when the API rate limits are exceeded. ```APIDOC ### Rate Limiting #### Description This error is returned when you have exceeded the allowed number of requests within a specific time frame. #### Response Example ```json { "errors": [ { "message": "Rate limit exceeded" } ] } ``` #### Solution Implement exponential backoff in your request logic or reduce the frequency of your API calls. ``` -------------------------------- ### GraphQL Input: promotion_stream_cursor_input Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/promotion-stream-cursor-input Defines the input structure for initializing a streaming cursor on the promotion table. ```APIDOC ## POST /graphql ### Description Defines the input object required to initialize a streaming cursor for the 'promotion' table. This input is used within the 'promotion_stream' subscription. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body - **initial_value** (promotion_stream_cursor_value_input!) - Required - Stream column input with initial value. - **ordering** (cursor_ordering) - Optional - The ordering strategy for the cursor. ### Request Example { "query": "subscription { promotion_stream(cursor: { initial_value: { ... }, ordering: ASC }) { ... } }" } ### Response #### Success Response (200) - **data** (object) - The streaming data payload returned by the subscription. #### Response Example { "data": { "promotion_stream": { "id": "123", "name": "Summer Sale" } } } ``` -------------------------------- ### setupWorkspaceTwilioAccount Mutation Response Source: https://docs.prospyrmed.com/docs/graphql/types/objects/twilio-account-setup-response This mutation sets up a Twilio account and returns the TwilioAccountSetupResponse object upon success. ```APIDOC ## setupWorkspaceTwilioAccount Mutation Response ### Description Sets up a Twilio account and returns the details of the newly created sub-account. ### Method MUTATION ### Endpoint /graphql ### Parameters #### Query Parameters None #### Request Body ```json { "query": "mutation SetupTwilio($workspaceId: uuid!) { setupWorkspaceTwilioAccount(workspaceId: $workspaceId) { id subAccountSid workspaceId } }", "variables": { "workspaceId": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } } ``` ### Response #### Success Response (200) - **id** (uuid!) - The unique identifier for the Twilio account setup. - **subAccountSid** (String!) - The SubAccount SID provided by Twilio. - **workspaceId** (uuid!) - The workspace ID associated with the Twilio account setup. #### Response Example ```json { "data": { "setupWorkspaceTwilioAccount": { "id": "f1e2d3c4-b5a6-0987-6543-210fedcba987", "subAccountSid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "workspaceId": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } } } ``` ``` -------------------------------- ### Invalid Query Error Source: https://docs.prospyrmed.com/docs/getting-started Handles errors related to invalid field names in GraphQL queries. ```APIDOC ### Invalid Query #### Description This error indicates that a field specified in your GraphQL query does not exist in the schema. #### Response Example ```json { "errors": [ { "message": "field 'invalidField' not found in type 'patient'" } ] } ``` #### Solution Consult the GraphQL Schema to verify the correct field names for your queries. ``` -------------------------------- ### Create External Patient API Source: https://docs.prospyrmed.com/docs/getting-started This mutation allows for the creation of a new external patient record. ```APIDOC ## POST /v1/graphql ### Description Creates a new external patient record in the system. ### Method POST ### Endpoint https://prod.prospyrmedapi.com/v1/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string to execute. - **variables** (object) - Required - Variables to be used with the GraphQL query. - **input** (object) - Required - Input object for creating an external patient. - **patientId** (uuid) - Required - The ID of the patient. - **message** (string) - Optional - A message associated with the patient creation. - **success** (boolean) - Required - Indicates if the patient creation was successful. ### Request Body ```json { "query": "mutation CreateExternalPatient($input: CreateExternalPatientInput!) { createExternalPatient(input: $input) { patientId message success } }", "variables": { "input": { "patientId": "some-uuid", "message": "Patient created successfully", "success": true } } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the mutation. - **createExternalPatient** (object) - Result of the create external patient mutation. - **patientId** (string) - The ID of the created patient. - **message** (string) - A confirmation message. - **success** (boolean) - Indicates if the operation was successful. ``` -------------------------------- ### POST /graphql (List Services) Source: https://docs.prospyrmed.com/docs/sample-requests Retrieves a list of available services within the system. ```APIDOC ## POST /graphql ### Description Retrieve a list of all available services. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body - **limit** (Int) - Optional - Number of services to return. ### Request Example { "query": "query ListServices($limit: Int) { service(limit: $limit) { id name description duration price } }", "variables": { "limit": 20 } } ``` -------------------------------- ### Check Appointment Availability API Source: https://docs.prospyrmed.com/docs/getting-started This query checks for appointment availability based on location, services, time, and provider. ```APIDOC ## POST /v1/graphql ### Description Checks for available appointment slots based on specified criteria. ### Method POST ### Endpoint https://prod.prospyrmedapi.com/v1/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string to execute. - **variables** (object) - Required - Variables to be used with the GraphQL query. - **locationId** (uuid) - Required - The ID of the location. - **serviceIds** (array of uuid) - Required - An array of service IDs. - **time** (string) - Required - The desired time for the appointment (e.g., ISO 8601 format). - **providerId** (uuid) - Required - The ID of the provider. ### Request Body ```json { "query": "query CheckAvailability($locationId: uuid!, $serviceIds: [uuid]!, $time: String!, $providerId: uuid!) { checkAvailability(locationId: $locationId, serviceIds: $serviceIds, time: $time, providerId: $providerId) { isAvailable errors __typename } }", "variables": { "locationId": "some-uuid", "serviceIds": ["another-uuid"], "time": "2023-10-27T10:00:00Z", "providerId": "yet-another-uuid" } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the query. - **checkAvailability** (object) - Result of the availability check. - **isAvailable** (boolean) - Indicates if the appointment slot is available. - **errors** (array) - An array of errors if any occurred during the check. - **__typename** (string) - The GraphQL type name. ``` -------------------------------- ### Search Patients API Source: https://docs.prospyrmed.com/docs/getting-started This endpoint allows you to search for patients based on a search term and limit the number of results. ```APIDOC ## POST /v1/graphql ### Description Searches for patients based on a provided search term and returns a limited number of results. ### Method POST ### Endpoint https://prod.prospyrmedapi.com/v1/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string to execute. - **variables** (object) - Optional - Variables to be used with the GraphQL query. ### Request Body ```json { "query": "query searchPatients { searchPatients(args: { search: \"john\" }, limit: 5) { ...PatientSearchFields } }" } ``` ### Request Example (curl) ```bash curl -X POST $PROSPYR_API_URL \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PROSPYR_JWT_TOKEN" \ -H "app: api" \ -d '{"query": "query searchPatients { searchPatients(args: { search: \"john\" }, limit: 5) { ...PatientSearchFields } }"}' ``` ### Request Example (JavaScript) ```javascript const axios = require('axios'); const query = ` query searchPatients { searchPatients(args: { search: "john" }, limit: 5) { ...PatientSearchFields } } `; axios.post(process.env.PROSPYR_API_URL, { query }, { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.PROSPYR_JWT_TOKEN}`, 'app': 'api' } } ) .then(response => console.log(JSON.stringify(response.data, null, 2))) .catch(error => console.error('Error:', error.response?.data || error.message)); ``` ### Request Example (Python) ```python import os import requests import json query = """ query searchPatients { searchPatients(args: { search: "john" }, limit: 5) { ...PatientSearchFields } } """ headers = { 'Content-Type': 'application/json', 'Authorization': f"Bearer {os.environ['PROSPYR_JWT_TOKEN']}", 'app': 'api' } response = requests.post( os.environ['PROSPYR_API_URL'], json={'query': query}, headers=headers ) print(json.dumps(response.json(), indent=2)) ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the query. - **searchPatients** (array) - An array of patient objects matching the search criteria. - **id** (integer) - The unique identifier for the patient. - **firstName** (string) - The first name of the patient. - **lastName** (string) - The last name of the patient. - **email** (string) - The email address of the patient. #### Response Example ```json { "data": { "searchPatients": [ { "id": 1, "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" }, { "id": 2, "firstName": "Johnny", "lastName": "Smith", "email": "johnny.smith@example.com" } ] } } ``` ``` -------------------------------- ### Query Multiple Providers Source: https://docs.prospyrmed.com/docs/getting-started This endpoint allows you to query information for multiple providers in a single request by using aliases for each provider query. ```APIDOC ## POST /graphql ### Description Query multiple providers in one request using aliases. ### Method POST ### Endpoint /graphql ### Request Body - **query** (string) - Required - The GraphQL query string. ### Request Example ```json { "query": "query GetMultipleProviders {\n provider1: provider_by_pk(id: 1) {\n firstName\n lastName\n specialty\n }\n provider2: provider_by_pk(id: 2) {\n firstName\n lastName\n specialty\n }\n}" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the results of the GraphQL query. - **provider1** (object) - Information for the first provider. - **firstName** (string) - The first name of the provider. - **lastName** (string) - The last name of the provider. - **specialty** (string) - The medical specialty of the provider. - **provider2** (object) - Information for the second provider. - **firstName** (string) - The first name of the provider. - **lastName** (string) - The last name of the provider. - **specialty** (string) - The medical specialty of the provider. #### Response Example ```json { "data": { "provider1": { "firstName": "John", "lastName": "Doe", "specialty": "Cardiology" }, "provider2": { "firstName": "Jane", "lastName": "Smith", "specialty": "Neurology" } } } ``` ``` -------------------------------- ### Fetch Promotion Data with Arguments Source: https://docs.prospyrmed.com/docs/graphql/operations/subscriptions/promotion This snippet demonstrates how to fetch promotion data from the 'promotion' table. It supports filtering, sorting, limiting, and distinct selection of columns. The `where` argument expects a `promotion_bool_exp` object, `order_by` expects a list of `promotion_order_by` objects, and `distinct_on` expects a list of `promotion_select_column` enum values. ```graphql promotion( distinct_on: [promotion_select_column!] limit: Int offset: Int order_by: [promotion_order_by!] where: promotion_bool_exp ): [promotion!]! ``` -------------------------------- ### Service Add-on Ordering Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/service-add-on-var-samp-order-by This section describes the `serviceAddOn_var_samp_order_by` input used for ordering service add-ons based on the `bookingOrder` field. ```APIDOC ## Service Add-on Ordering API ### Description This API allows for ordering service add-ons. It specifically details the `serviceAddOn_var_samp_order_by` input, which enables sorting based on the `bookingOrder` field. ### Method N/A (This describes an input type, not a direct API endpoint) ### Endpoint N/A ### Parameters #### Input Type: `serviceAddOn_var_samp_order_by` - **bookingOrder** (order_by enum) - Required - Specifies the order direction for booking orders. ### Request Example ```json { "bookingOrder": "asc" } ``` ### Response #### Success Response (N/A) This describes an input type for query parameters or request bodies, not a direct response. #### Response Example N/A ``` -------------------------------- ### promotionServices_stream_cursor_value_input Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/promotion-services-stream-cursor-value-input Defines the input fields required to initialize the streaming cursor for promotion services. ```APIDOC ## INPUT promotionServices_stream_cursor_value_input ### Description Defines the initial value of the column from where the streaming of promotion services should start. ### Request Body - **createdAt** (timestamptz) - Optional - The timestamp of when the record was created. - **discountAmount** (float8) - Optional - The numerical value of the discount. - **discountType** (String) - Optional - The category or type of the discount. - **id** (uuid) - Optional - The unique identifier of the promotion service record. - **promotionId** (uuid) - Optional - The unique identifier of the associated promotion. - **quantity** (Int) - Optional - The quantity associated with the service. - **serviceId** (uuid) - Optional - The unique identifier of the service. - **updatedAt** (timestamptz) - Optional - The timestamp of the last update. - **workspaceId** (uuid) - Optional - The unique identifier of the workspace. ### Request Example { "createdAt": "2023-01-01T00:00:00Z", "discountAmount": 10.5, "discountType": "percentage", "id": "550e8400-e29b-41d4-a716-446655440000", "promotionId": "770e8400-e29b-41d4-a716-446655440000", "quantity": 1, "serviceId": "990e8400-e29b-41d4-a716-446655440000", "updatedAt": "2023-01-01T00:00:00Z", "workspaceId": "110e8400-e29b-41d4-a716-446655440000" } ``` -------------------------------- ### Prospyr API GraphQL Mutations Source: https://docs.prospyrmed.com/docs/getting-started Defines GraphQL mutations for interacting with the Prospyr API. These snippets show how to structure requests for creating external patients and checking appointment availability. ```graphql import { graphql } from '@/gql/gql'; export const CreateExternalPatientMutation = graphql(` mutation CreateExternalPatient($input: CreateExternalPatientInput!) { createExternalPatient(input: $input) { patientId message success } } `); ``` ```graphql import { graphql } from '@/gql/gql'; export const CheckAvailabilityQuery = graphql(` query CheckAvailability( $locationId: uuid! $serviceIds: [uuid]! $time: String! $providerId: uuid! ) { checkAvailability( locationId: $locationId serviceIds: $serviceIds time: $time providerId: $providerId ) { isAvailable errors __typename } } `); ``` -------------------------------- ### Handle Rate Limiting Error Response (JSON) Source: https://docs.prospyrmed.com/docs/getting-started Illustrates the JSON response when the API rate limit is exceeded. The recommended solutions are to implement exponential backoff or to reduce the frequency of requests to the API. ```json { "errors": [{ "message": "Rate limit exceeded" }] } ``` -------------------------------- ### Query promotionServices Source: https://docs.prospyrmed.com/docs/graphql/operations/subscriptions/promotion-services Retrieve a list of promotion services with support for filtering, sorting, and pagination. ```APIDOC ## POST /graphql ### Description Fetch data from the "promotionServices" table using GraphQL query parameters for filtering and ordering. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **distinct_on** ([promotionServices_select_column!]) - Optional - Distinct select on columns - **limit** (Int) - Optional - Limit the number of rows returned - **offset** (Int) - Optional - Skip the first n rows (use with order_by) - **order_by** ([promotionServices_order_by!]) - Optional - Sort the rows by one or more columns - **where** (promotionServices_bool_exp) - Optional - Filter the rows returned ### Request Example { "query": "query { promotionServices(limit: 10, order_by: {id: asc}) { id name description } }" } ### Response #### Success Response (200) - **data** (Object) - The requested promotionServices records #### Response Example { "data": { "promotionServices": [ { "id": 1, "name": "Summer Sale", "description": "20% off all items" } ] } } ``` -------------------------------- ### Subscribe to leadFormStep Changes Source: https://docs.prospyrmed.com/docs/graphql/types/objects/lead-form-step Shows how to subscribe to real-time changes for a specific 'leadFormStep' using its primary key. The 'leadFormStep_by_pk' subscription provides updates whenever the specified 'leadFormStep' is modified. ```graphql subscription SubscribeToLeadFormStep($id: uuid!) { leadFormStep_by_pk(id: $id) { id title updatedAt } } ``` -------------------------------- ### Query leadFormStep by Primary Key Source: https://docs.prospyrmed.com/docs/graphql/types/objects/lead-form-step Demonstrates how to query a specific 'leadFormStep' using its primary key. This is typically done via the 'leadFormStep_by_pk' query. It returns a single 'leadFormStep' object or null if not found. ```graphql query GetLeadFormStep($id: uuid!) { leadFormStep_by_pk(id: $id) { id title order leadFormId } } ``` -------------------------------- ### Handle Invalid Query Error Response (JSON) Source: https://docs.prospyrmed.com/docs/getting-started Presents the JSON format for an invalid query error, typically occurring when a non-existent field is requested. The solution is to consult the GraphQL Schema to verify the correct field names. ```json { "errors": [{ "message": "field 'invalidField' not found in type 'patient'" }] } ``` -------------------------------- ### POST /graphql (workspaceConfiguration) Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/workspace-configuration Retrieves a list of workspace configurations with support for filtering, ordering, and pagination. ```APIDOC ## POST /graphql ### Description Fetch data from the "workspaceConfiguration" table using GraphQL query syntax. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters - **distinct_on** ([workspaceConfiguration_select_column!]) - Optional - Distinct select on columns - **limit** (Int) - Optional - Limit the number of rows returned - **offset** (Int) - Optional - Skip the first n rows - **order_by** ([workspaceConfiguration_order_by!]) - Optional - Sort the rows by one or more columns - **where** (workspaceConfiguration_bool_exp) - Optional - Filter the rows returned ### Request Example { "query": "query { workspaceConfiguration(limit: 10) { id, name } }" } ### Response #### Success Response (200) - **data** (object) - The requested workspaceConfiguration records #### Response Example { "data": { "workspaceConfiguration": [ { "id": 1, "name": "Default Workspace" } ] } } ``` -------------------------------- ### Set Environment Variables for Prospyr API Source: https://docs.prospyrmed.com/docs/getting-started Configure essential environment variables for interacting with the Prospyr API. This includes setting the JWT token and the API endpoint URL. These variables are crucial for authenticating and directing requests to the correct Prospyr service. ```shell export PROSPYR_JWT_TOKEN="your_jwt_token_here" export PROSPYR_API_URL="https://prod.prospyrmedapi.com/v1/graphql" ``` -------------------------------- ### Access leadFormFields from leadFormStep Source: https://docs.prospyrmed.com/docs/graphql/types/objects/lead-form-step Demonstrates how to retrieve the associated 'leadFormFields' for a given 'leadFormStep'. This example shows fetching the 'id' and 'name' of each 'leadFormField' related to a 'leadFormStep', with options to filter and order the fields. ```graphql query GetLeadFormStepWithFields($stepId: uuid!) { leadFormStep_by_pk(id: $stepId) { id name leadFormFields(order_by: { order: asc }) { id name type } } } ``` -------------------------------- ### Define promotionServices_avg_order_by Input Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/promotion-services-avg-order-by Defines the promotionServices_avg_order_by input structure, specifying the fields that can be used for ordering based on average calculations. It accepts 'order_by' enums for 'discountAmount' and 'quantity'. ```graphql input promotionServices_avg_order_by { discountAmount: order_by quantity: order_by } ``` -------------------------------- ### Handle Authentication Error Response (JSON) Source: https://docs.prospyrmed.com/docs/getting-started Shows the JSON structure for an authentication error, indicating a missing or invalid JWT token or incorrect 'app' header. The solution involves ensuring the JWT is correctly set in the 'Authorization' header with the Bearer scheme and the 'app' header is set to 'api'. ```json { "errors": [{ "message": "Authorization header is missing or invalid" }] } ``` -------------------------------- ### POST /promotion_stream Source: https://docs.prospyrmed.com/docs/graphql/operations/subscriptions/promotion-stream Fetches promotion data from the database using a streaming approach with cursor-based pagination. ```APIDOC ## POST /promotion_stream ### Description Fetches data from the "promotion" table in a streaming manner, allowing for efficient data retrieval using batching and cursors. ### Method POST ### Endpoint /promotion_stream ### Parameters #### Query Parameters - **batch_size** (Int!) - Required - The maximum number of rows to be returned in a single batch. - **cursor** ([promotion_stream_cursor_input]!) - Required - The cursor used to track the current position in the stream. - **where** (promotion_bool_exp) - Optional - Filter criteria to narrow down the rows returned. ### Request Example { "query": "query { promotion_stream(batch_size: 10, cursor: []) { id, name } }" } ### Response #### Success Response (200) - **data** (Array) - A list of promotion objects returned by the stream. #### Response Example { "data": { "promotion_stream": [ { "id": 1, "name": "Summer Sale" }, { "id": 2, "name": "Winter Clearance" } ] } } ``` -------------------------------- ### Define promotionServices_stddev_samp_order_by Input Source: https://docs.prospyrmed.com/docs/graphql/types/inputs/promotion-services-stddev-samp-order-by Defines the input structure for ordering promotion services by the sample standard deviation of discountAmount and quantity. It accepts an 'order_by' enum for each field, specifying the sorting direction. ```graphql input promotionServices_stddev_samp_order_by { discountAmount: order_by quantity: order_by } ``` -------------------------------- ### GET /getPatientAttributes Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/get-patient-attributes Retrieves the attributes of a patient based on their unique UUID. ```APIDOC ## POST /graphql ### Description Retrieves the attributes associated with a specific patient using their unique identifier. ### Method POST ### Endpoint /graphql ### Parameters #### Arguments - **patientId** (uuid!) - Required - The unique identifier of the patient. ### Request Example { "query": "query { getPatientAttributes(patientId: \"550e8400-e29b-41d4-a716-446655440000\") { id name status } }" } ### Response #### Success Response (200) - **PatientAttributes** (object) - The object containing patient attribute details. #### Response Example { "data": { "getPatientAttributes": { "id": "550e8400-e29b-41d4-a716-446655440000", "status": "active" } } } ``` -------------------------------- ### GET /websites/prospyrmed/me Source: https://docs.prospyrmed.com/docs/graphql/operations/queries/me Retrieves user information based on the provided Firebase UID. ```APIDOC ## GET /websites/prospyrmed/me ### Description Retrieves user information based on the provided Firebase UID. ### Method GET ### Endpoint /websites/prospyrmed/me ### Parameters #### Query Parameters - **firebaseUid** (String!) - Required - The unique identifier for the user in Firebase. ### Response #### Success Response (200) - **MeOutput** (object) - An object containing the user's information. #### Response Example ```json { "user": { "id": "user123", "name": "John Doe", "email": "john.doe@example.com" } } ``` ``` -------------------------------- ### Fetch Package by Primary Key Source: https://docs.prospyrmed.com/docs/graphql/operations/subscriptions/package-by-pk Retrieves package data from the 'package' table using the provided primary key (ID). ```APIDOC ## GET /websites/prospyrmed/package_by_pk ### Description Fetches data from the "package" table using the primary key column. ### Method GET ### Endpoint /websites/prospyrmed/package_by_pk ### Parameters #### Query Parameters - **id** (uuid!) - Required - The unique identifier of the package. ### Response #### Success Response (200) - **package** (object) - An object containing the package details. - **columns** (object) - The columns of the package. - **relationships** (object) - The relationships of the package. #### Response Example ```json { "package": { "columns": {}, "relationships": {} } } ``` ``` -------------------------------- ### Fetch Package Data with Arguments Source: https://docs.prospyrmed.com/docs/graphql/operations/subscriptions/package This snippet demonstrates the structure for fetching data from the 'package' table. It supports distinct selections, limiting results, offsetting rows, ordering, and filtering with a boolean expression. ```graphql package( distinct_on: [package_select_column!] limit: Int offset: Int order_by: [package_order_by!] where: package_bool_exp ): [package!]! ```