gatsby-source-surveyjs
Source plugin for pulling surveys into Gatsby from the SurveyJS.io service.
Features
- Provides survey data via the SurveyJS Public and Private APIs
- Simplifies the integration of the
survey-reactwithin Gatsby
Install
npm install gatsby-source-surveyjsConfiguration
After creating your account on the SurveyJS Cloud Service, you will need to obtain your private API access token by visiting the Private API documentation.
Then, in your gatby-config.js add the following:
module.exports = {
plugins: [
{
resolve: "gatsby-source-surveyjs",
options: {
accessKey: "example-3462324256as26243sk3d93",
}
}
];Note: Your API access key should be considered a secret, and treated as such. See Environment Variables for more information.
How to Query
You can query the nodes that were created from SurveyJS using GraphQL like the following:
Note: Learn to use the GraphQL tool and Ctrl+Spacebar at http://localhost:8000/___graphql to discover the types and properties of your GraphQL model.
{
allSurveys {
edges {
node {
Id
PostId
Name
}
}
}
}All SurveyJS data is pulled using the SurveyJS Private API. Data is made available in the same structure as provided by the API.