BreezeChMS / breeze-api-v1

The Breeze API v1 allows you to build custom applications integrated with the Breeze database.
https://www.breezechms.com/api
5 stars 3 forks source link

Simple Getting Started Question #8

Open pl22740 opened 2 years ago

pl22740 commented 2 years ago

I am a new user to Breeze and want to use the API (if possible) to list people that match a certain last name. I want to do this in my mobile app, written in Flutter (Dart), so my thought is to have the app send a single https command to Breeze to obtain the JSON results, but I can't figure out how to add the API_KEY to the https string. Can anybody give me the syntax to do this? I've done http programming like this before connecting to a Canvas database and the string was "https:///api/;access_token="-long token string-" . Hoping that I can do this same technique to get data from Breeze. Thanks.

DISCLAIMER: Breeze does not actively monitor the contents of posted messages, is not responsible for any messages posted, does not vouch for or warrant the accuracy, completeness or usefulness of any message, and is not responsible for the contents of any message.

danbru1989 commented 2 years ago

I'm new to Webhooks, APIs, etc... but I couldn't successfully connect to Breeze and get a list of people until I put in my request Header a KEY of "api-key" and VALUE of "my api key here".

pl22740 commented 2 years ago

Yep. I was able to do my query (all records that match a person's last name) using the Python wrapper as a guide. I also have it working in my mobile app written in Flutter (Dart). If anyone would like to see the code, just let me know.

mike2elmont commented 2 years ago

Yep. I was able to do my query (all records that match a person's last name) using the Python wrapper as a guide. I also have it working in my mobile app written in Flutter (Dart). If anyone would like to see the code, just let me know.

i would like to see the code i am trying to figure out how to connect using api but dont know anything about python . thanks

pl22740 commented 2 years ago

Here you go:

Program to access the Breeze database using the Breeze API

To run this, you need to install requests

pip install requests

import requests

pprint is a great way to print out the json info in a readable format

from pprint import pprint

url = 'https://.breezechms.com/api/people' api_key = ''

headers = ({ 'Content-Type': 'application/json', 'Api-Key' : api_key})

payload = ({ 'details' : '1',

To find out the exact profile name for "last name" go to your

# Breeze database, click on People, click SHOW MORE FILTER OPTIONS,
# Click on tic mark next to "Name" and look at the URL bar to see
# what the last name field ID looks like
'filter_json' : '{"<Profile name from URL>":"smith"}'
# Next line is to limit the number of results returned
#'limit' : '10',
})

resp = requests.get(url, verify=True, params=payload, headers=headers)

print (resp.status_code)

raw = resp.json()

for person in raw : print (person['first_name'],person['last_name'])

Uncomment out the next line if you want to see all the gory details for each record

#pprint(person)