Mulitpart forms and nested objects Insomnia REST client - nested-object

So I've decided to switch to Insomnia from Postman, as for some reason my Postman app keeps hanging. Everything is going well but I'm having trouble using multipart forms with Insomnia. How would I access this in Insomnia? In Postman I just need to put profile{location} as the field and it works, but Insomnia gives me an error of can't read property '0' of undefined
The object is structured as follows
{
"id": "5e76dd60d49dfd6827688908",
"username": "TLCFan",
"email": "tlc#fan.com",
"profile": {
"avatar": {
"url": "/static/img/defaultAvatar.png"
},
"header": {
"url": "/static/img/defaultBG.png"
},
"forHire": false,
"location": "Bimingham",
"bio": "Design is my life, but this is my story"
}
}

Related

Google Fit API Rest create data source

I'm learning how to use Google Fit API and right now I'm trying to do the examples Google offers to explore the OAuth 2.0 Playground.
There's one example to create a data source whose code is:
POST
https://www.googleapis.com/fitness/v1/users/me/dataSources
{
"name": "example-fit-heart-rate",
"dataStreamId":
"raw:com.google.heart_rate.bpm:1234567890:Example Fit:example-fit-hrm-1:123456",
"dataType": {
"field": [{
"name": "bpm",
"format": "floatPoint"
}],
"name": "com.google.heart_rate.bpm"
},
"application": {
"packageName": "com.example.fit.someapp",
"version": "1.0"
},
"device": {
"model": "example-fit-hrm-1",
"version": "1",
"type": "watch",
"uid": "123456",
"manufacturer":"Example Fit"
},
"type": "raw"
}
when I write that code down in the OAuth Playground I have this error message:
{
"error": {
"status": "INVALID_ARGUMENT",
"message": "Expected dataStreamId to be [raw:com.google.heart_rate.bpm:com.example.fit.someapp:Example Fit:example-fit-hrm-1:123456], but was [raw:com.google.heart_rate.bpm:1234567890:Example Fit:example-fit-hrm-1:123456]",
"code": 400,
"errors": [
{
"reason": "invalidArgument",
"message": "Expected dataStreamId to be [raw:com.google.heart_rate.bpm:com.example.fit.someapp:Example Fit:example-fit-hrm-1:123456], but was [raw:com.google.heart_rate.bpm:1234567890:Example Fit:example-fit-hrm-1:123456]",
"domain": "global"
}
]
}
}
I guess is because of the structure of the dataStreamID but I find it strange because I didn't change any code from the Google site. Also I tried to delete the dataStreamID, change the numbers, try this format type:dataType.name:developer project number:device.manufacturer:device.model:device.uid:dataStreamName
but I have no results.
I'm no pretty sure of how does the dataStreamID structure works so if anyone could explain it to me that would be great.
The link of this Google Fit site:
[https://developers.google.com/fit/rest/v1/workout?hl=es-419]
Hope someone can help me.
Thank you!!!

Zoho Recruit API Register / Login Candidate

Could someone guide me an idea of how to create the registration and login for candidates with the Recruit api? I'm making a flutter app and I need my candidates to register and log in trow the app and see the job opening, post jobs.
At the moment I created the user with [POST] https://recruit.zoho.com/recruit/v2/Candidates
{
"data": [
{
"Email": "mail#gmail.com",
"First_Name": "TheName",
"Last_Name": "TheLastName",
"Mobile": "000000000",
"Expected_Salary": "8000000",
"Country": "PY",
"Departamento": "Central",
"C_I": "37114594",
"Ciudad_de_residencia": "City",
"$Password":"myPassWord199**"
}
],
"trigger": [
"approval",
"workflow",
"blueprint"
]
}
Works Well, got success
{
"data": [
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2022-06-15T20:47:23-04:00",
"Modified_By": {
"name": "Admin",
"id": "00000000000000"
},
"Created_Time": "2022-06-15T20:47:23-04:00",
"id": "00000000000000",
"Created_By": {
"name": "Admin",
"id": "00000000000000"
}
},
"message": "record added",
"status": "success"
}
]
}
But If I try to log in in the web version (for testing the new candidate) don't work, but if it see the dashboard, the user exist. Need to add something else?
Basically I need a register api and a login one for the created record of the candidate.
Any help will be awesome, Thanks

Update Account (PUT) Endpoint in new Yodlee API for MFA

Background
I am using the newer Yodlee Aggregation API that differs from what I was previously building off of.
I am currently using this endpoint in the account registration flow to put the MFA response:
PUT /{cobrandName}/v1/providers/{providerAccountId}
My request looks like this:
{
url: `${this.rest}providers/${providerAccountId}`,
headers: {
'Authorization': `cobSession=${self.appToken}, userSession=${token}`
},
form: {
'MFAChallenge': JSON.stringify(newMfa)
}
}
where this.rest is my personal rest url, providerAccountId is the appropriate providerAccountId for the refresh, self.appToken is the current cobrand session token, token is the current user's login token, and newMfa is a JSON object being stringified that matches this profile:
{
"loginForm": {
"mfaTimeout": 94650,
"formType": "questionAndAnswer",
"row": [
{
"id": "SQandA--QUESTION_1--Row--1",
"fieldRowChoice": "0001",
"form": "0001",
"label": "What is the name of your state?",
"field": [
{
"id": "SQandA_QUESTION_1_1",
"name": "QUESTION_1",
"isOptional": false,
"value": "Enter the answer",
"valueEditable": true,
"type": "text"
}
]
},
{
"id": "SQandA--QUESTION_2--Row--2",
"fieldRowChoice": "0001",
"form": "0001",
"label": "What is the name of your first school",
"field": [
{
"id": "SQandA_QUESTION_2_2",
"name": "QUESTION_2",
"isOptional": false,
"value": "Enter the answer",
"valueEditable": true,
"type": "text"
}
]
}
]
}
with the exeption being the value fields of the field object, which have been encrypted with PKI as per instructions.
Issue
However, when I carry out this PUT request, I get this error from Yodlee:
{ errorCode: 'Y803',
errorMessage: 'MFAChallenge or providerParam required',
referenceCode: 'p1460412835654A4Q24t' }
though I clearly have an MFAChallenge parameter in my form. Any ideas on why I could be getting this error if the MFAChallenge is present (and note that it is the only info that is passed through the PUT request other than through headers or url parameters)? I tried putting it through as body data, but that doesn't seem to work, and very few of the API endpoints actually seem to use body over form encoded strings, though there was at least one.
You have to send this information MFAChallenge as part of URL, see below example
https://developer.api.yodlee.com/ysl/restserver/v1/providers/10114184?MFAChallenge=%7B%20%22loginForm%22%3A%20%7B%20%20%20%20%20%22mfaTimeout%22%3A%2094650%2C%20%20%20%20%20%22formType%22%3A%20%22questionAndAnswer%22%2C%20%20%20%20%20%22row%22%3A%20%5B%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA--QUESTION_1--Row--1%22%2C%20%20%20%20%20%20%20%20%20%22fieldRowChoice%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22form%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22label%22%3A%20%22What%20is%20the%20name%20of%20your%20state%3F%22%2C%20%20%20%20%20%20%20%20%20%22field%22%3A%20%5B%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA_QUESTION_1_1%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22QUESTION_1%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22isOptional%22%3A%20false%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22Enter%20the%20answer%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22valueEditable%22%3A%20true%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22text%22%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%20%5D%20%20%20%20%20%7D%2C%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA--QUESTION_2--Row--2%22%2C%20%20%20%20%20%20%20%20%20%22fieldRowChoice%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22form%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22label%22%3A%20%22What%20is%20the%20name%20of%20your%20first%20school%22%2C%20%20%20%20%20%20%20%20%20%22field%22%3A%20%5B%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA_QUESTION_2_2%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22QUESTION_2%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22isOptional%22%3A%20false%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22Enter%20the%20answer%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22valueEditable%22%3A%20true%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22text%22%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%20%5D%20%20%20%20%20%7D%20%5D%20%7D

Using the advanced query api and get all pages back

I can successfully call into an advanced query method and get the first page of data back (using the post option) refernced in http://api.docs.import.io/#QueryMethods
Anyone have an idea how to page after that? I get 20 out of 190 results. My query looks like:
var query = {
"input": { "last_name": name },
"additionalInput": {
"8d817939-my-api-key-9502ed72": cookie
},
"returnPaginationSuggestions": true
}
Where param name and cookie are known vars.
The results do not return a pagination block either as in the model result:
{
"connectorVersionGuid": "string",
"pagination": {
"pattern": "string",
"next": "string",
"currentPageNum": 0,
"previous": "string"
},
"connectorGuid": "string",
"totalResults": 0,
"errorType": "TimeoutException",
"outputProperties": [
{
"type": "STRING",
"name": "string"
}
],
"cookies": [
"string"
],
"results": [
{}
],
"pageUrl": "string",
"error": "string",
"data": {}
}
If the response is not returning the "Pagination" block, it means that the system was not able to identify pagination on a given page.
As far as I remember pagination is flaky for Extractor APIs, while it works quite well for Magic APIs. I would recommend trying to get a Magic extractor, and getting pagination suggestions for it. Than you should be able to get the "Pagination" block in your response, and use "next" value to get the URL of the next page.

Parse Cloud Hosting Truncating User Results

I'm having a strange issue with Parse's Cloud Hosting platform. I have a route that displays info on all 'Providers' in my system. A Provider has a column that is a Pointer to a User object. This is a special Parse.User object.
My goal is to get all Providers and the User info that the provider points to. Seems simple, using the "include" method for the query.
The route code looks like this:
exports.index = function(req, res) {
var providersQuery = new Parse.Query('Provider');
providersQuery.include('user');
providersQuery.find().then(function(providers) {
console.log(providers); //for debugging
res.render('providers/index', { providers: providers });
});
};
Here's where things get weird. The above log statement shows all Providers with all the User data included:
[{ "address": "123 Main St.", "city": "Anytown", "zip": "77777",
"user":
{ "email": "john.smith#example.com", "firstName": "John", "lastName": "Smith", "objectId": "abcd123", "__type": "Object", "className": "_User" }
}]
Notice that the __type is "Object".
However, in my view the User object data is truncated and only shows __type, className, and objectId fields:
//index.ejs
<%- JSON.stringify(providers) %>
Results in the following:
[{ "address": "123 Main St.", "city": "Anytown", "zip": "77777",
"user":
{ "objectId": "abcd123", "__type": "Pointer", "className": "_User" }
}]
All the info about the user is gone!! And the __type is now "Pointer". What the hell is going on?
Apparently calling JSON.stringify on Parse object will return "included" objects back to their "Pointer" selves. I'm sure there is some good reason for this, but it's certainly inconvenient.