Solid Pod with API

Hi,
I am building an app which gets data from an API in json format and this data needs to be pushed to my solid pod hosted in Community Solid Server. I am new to solid concept. Can I know the best way to accomplish this task?

Since you are dealing with plain json which is a non-RDF resource, then the easiest thing for you to do would be to use a library like solid-client to POST this non-RDF json resource to your Pod.

[PERSONALLY RECOMMENDED APPROACH] If you want to be able to re-use this data across applications that don’t understand the specific API that you’re using. Then I would first find appropriate vocabulary(s) to describe your data in RDF (you can find some here for instance Linked Open Vocabularies) and then have a bit of logic on your side that converts your JSON to RDF. This could be as simple as

import { Store, Datafactory as DF } from 'n3';
import { fromRdfjsDataset } from 'solid-client';

const myApiPayload = await (await fetch('http://example.org/myAPI')).json();

const myStore = new Store([
  DF.quad(
    DF.namedNode(myApiPayload.id),
    DF.namedNode("http://xmlns.com/foaf/0.1/name"),
    DF.literal(myApiPayload.name),
  ),
  DF.quad(
    DF.namedNode(myApiPayload.id),
    DF.namedNode("http://xmlns.com/foaf/0.1/name"),
    DF.literal(myApiPayload.age, "http://www.w3.org/2001/XMLSchema#integer"),
  ),
  DF.quad(
    DF.namedNode(myApiPayload.id),
    DF.namedNode("http://xmlns.com/foaf/0.1/dob"),
    DF.literal(myApiPayload.birthday, "http://www.w3.org/2001/XMLSchema#date"),
  ),
]);

const dataset = fromRdfjsDataset(store);
await saveSolidDatasetAt(
    /* url to save dataset at in Pod */,
    dataset,
    { fetch: fetch }  // fetch function from authenticated session, see https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/read-write-data/
  );