Git Product home page Git Product logo

answers-core's Introduction

Answers Core


Answers Core is a networking library for interacting with the Yext Answers API.

Full Documentation

Features

  • Works in both the browser and Node.js
  • 100% TypeScript, with detailed request and response models
  • Compatible with both CommonJS and ES6 imports
  • Offers a ponyfilled ES5 bundle which doesn't pollute the global namespace

Getting Started

For a full getting started walk through, view our official Hitchhiker Guide.

First, install Answers-core via npm:

npm install @yext/answers-core

Next, import and initialize the core library in your application.

The apiKey and experienceKey will come from your Answers experience on yext.com. You can signup for a free trial at https://www.yext.com/free-trial/.

import { provideCore } from '@yext/answers-core';

const core = provideCore({
  apiKey: '<your api key>',
  experienceKey: '<one of your experience keys>',
  locale: 'en',
  experienceVersion: 'PRODUCTION',
});

To use the library with Node, use the following import instead:

const { provideCore } = require('@yext/answers-core');

Now that the core is initialized, let's run a search on an "FAQs" vertical.

core.verticalSearch({
  verticalKey: 'FAQs',
  query: 'What is Yext Answers?',
}).then(results => {
  // Do something with the search results
}).catch(err => {
  // Handle errors thrown by the core library
});

Explanation of Builds

  • The ESM (ES6) build will be used automatically by module bundlers that support it (e.g. Webpack). It can be specified directly by importing @yext/answers-core/lib/esm
  • The CommonJS build will be used automatically by Node, but it can be specified directly by importing @yext/answers-core/lib/commonjs
  • The Legacy (UMD) bundle should be used for supporting IE11 out of the box. It is compiled to ES5 and it contains the necessary ponyfills for IE11. If your application already contains polyfills, we recommend bundling one of the other builds in order to prevent your application from including duplicate polyfills. This bundle can be specified by importing @yext/answers-core/legacy

And that's it! See our documentation for a full list of supported API calls.

License

Yext Answers-core is an open-sourced library licensed under the BSD-3 License.

Third Party Licenses

The licenses of our 3rd party dependencies are collected here: THIRD-PARTY-NOTICES.

answers-core's People

Contributors

cea2aj avatar oshi97 avatar tmeyer2115 avatar alexisgrow avatar yen-tt avatar nanhu95 avatar cjiang2000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.