Come recuperare informazioni sull'azienda utilizzando l'ID o lo slug con l'API di Blue.
Per recuperare informazioni sull'azienda, puoi utilizzare la query company
con l'ID dell'azienda o lo slug:
Interrogare per ID dell'azienda
query GetCompanyById {
company(id: "company-id-here") {
id
name
slug
createdAt
updatedAt
}
}
Interrogare per Slug dell'azienda
La stessa query accetta anche uno slug dell'azienda, rendendo facile recuperare informazioni sull'azienda utilizzando l'identificatore compatibile con l'URL:
query GetCompanyBySlug {
company(id: "company-slug-here") {
id
name
slug
createdAt
updatedAt
}
}
Esempio di risposta
Entrambe le query restituiranno lo stesso oggetto aziendale:
{
"data": {
"company": {
"id": "cuid123456789",
"name": "Acme Corporation",
"slug": "acme-corp",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-03-20T14:45:00.000Z"
}
}
}
Note importanti
- Il parametro
id
accetta sia ID che slug delle aziende - Verranno restituite solo le aziende di cui l'utente attuale è membro
- Se l'azienda non viene trovata o l'utente non ha accesso, verrà generato un
CompanyNotFoundError
- Le aziende vietate genereranno un
CompanyBannedError
Campi disponibili
Puoi interrogare ulteriori campi dell'azienda secondo necessità:
query GetCompanyDetails {
company(id: "company-slug") {
id
name
slug
# Add more fields as needed based on your requirements
# Check the GraphQL schema for all available fields
}
}