1

I'm trying to do a GET request on a Parse backend but i have a 403 response from the server. I tried to follow these instructions but i still have the issue.

Here's the configuration of my service :

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import * as Parse from 'parse';


Parse.initialize('MY APP ID', 'MY MASTER KEY ID'); // use your appID & your js key
(Parse as any).serverURL = 'https://MYURL/parse'; // use your server url


@Injectable({
  providedIn: 'root'
})
export class BackofficeService {

  constructor(private http: HttpClient) {}

  public getStores(): Observable<any> {
    return this.http.get(Parse.serverURL + '/classes/Stores');
  }

I tried to add an empty paramater for the jskey (because i used master key instead of JS key) but it didn't work.

Parse.initialize('MY APP ID', '', 'MY MASTER KEY ID'); // use your appID & your js key

2 Answers 2

2

You are trying to use the Rest API of the Parse server, but you configure it with the SDK.

As you configure the SDK and you have it, I really recommend you to use it. Here is how to get all object of stores.

var Stores = Parse.Object.extend("Stores");
var query = new Parse.Query(Stores);
query.find().then(function(results) {
  console.log(results);
});
Sign up to request clarification or add additional context in comments.

4 Comments

It helps a lot ! I did succeed to get all object of stores with the code you gave me. I'm new with Parse server so i need to work on it. Thank you very much.
I'm glad that it helps you if you have any other question just let me know
It was not what i had in mind so i think i will try to figure out how to do what i want differently.
Ok no problem, just let me know
1

I resolved my issue by using what Julien gave me and modifying my service into a promise :

  public getStores(): Promise <any> {
  const Stores = Parse.Object.extend('Stores');
  const query = new Parse.Query(Stores);
  return query.find()
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.