Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh generates an invalid curl command #48

Open
jurgelionis opened this issue Nov 28, 2019 · 3 comments
Open

Mesh generates an invalid curl command #48

jurgelionis opened this issue Nov 28, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jurgelionis
Copy link
Member

Curl command gets generated here :

Query = string.Format("curl -X PUT https://api.hubapi.com/" + EditUrl + "{1}?hapikey={0} " + "--header \"Content-Type: application/json\"" + " --data '{2}'", hubSpotCrawlJobData.ApiToken, this.GetLookupId(entity), JsonUtility.Serialize(properties)),

and
: base(appContext, "contacts/v1/contact/vid/:vid/profile", CluedIn.Core.Data.EntityType.Infrastructure.Contact, CluedIn.Core.Data.EntityType.Person)

Here's a curl command generated by this mesh implementation:
curl -X PUT https://api.hubapi.com/contacts/v1/contact/vid/:vid/profile801?hapikey={{_-REMOVED-_}} --header "Content-Type: application/json" --data '{"properties":[{"name":"hubspot.contact.CompanyName","value":"DL Labbb"}]}'

https://api.hubapi.com/contacts/v1/contact/vid/:vid/profile801 is faulty, because :vid should be 801

If you look in here, :vid is not injected, but is taken literally.

A proper CURL command should look like this:

curl -X PUT https://api.hubapi.com/contacts/v1/contact/vid/801/profile?hapikey={{_-REMOVED-_}} --header "Content-Type: application/json" --data '{"properties":[{"name":"hubspot.contact.CompanyName","value":"DL Labbb"}]}'

@kevinobee kevinobee added the bug Something isn't working label Dec 9, 2019
@kevinobee kevinobee self-assigned this Dec 9, 2019
@kevinobee
Copy link
Contributor

@Hyldahl From the error information that @jurgelionis has provided on this we need to get the HubSpot CluedIn.Crawling.HubSpot.Core.Models.Vid field into the EditUrl being used by the CluedIn.Provider.HubSpot.Mesh.Hubspot.HubspotContactMeshProcessor.

From what I understand the :vid value in the Url used for editing needs to be replaces with the Hubspot Vid value from the Contact model in Hubspot repository. I can easily achieve that in the this method as I have the entity as a parameter:

public override List<RawQuery> GetRawQueries(IDictionary<string, object> config, IEntity entity, Core.Mesh.Properties properties)

From what I understand the GetRawQueries method is just used by the UI to display commands that would be executed against the HubSpot datastore.

The problem comes when I want to modify the Url in the following methods of the HubspotUpdateBaseMeshProcessor mesh processor.

public override List<QueryResponse> RunQueries(IDictionary<string, object> config, string id, Core.Mesh.Properties properties)

and

public override List<QueryResponse> Validate(ExecutionContext context, MeshDataCommand command, IDictionary<string, object> config, string id, MeshQuery query)

I am using the GetLookupId method that takes an IEntity parameter to return the code value that I believe relates to the HubSpot CluedIn.Crawling.HubSpot.Core.Models.Vid field

Can the id parameter passed into the RunQueries and Validate methods could potentially be used to locate the entity in the primary data store and then be used to derive the Mesh edit url for HubSpot?

Is what I have outlined a sensible approach to fixing this issue? If so how do I best I perform the data access necessary to retrieve the Entity based on the id parameters passed into the two problematic methods?

@cluedindev
Copy link

@kevinobee Can you book some time with me next week to go through this with you? I wrote this framework so probably would be better to work with on this one.

@kevinobee
Copy link
Contributor

kevinobee commented Dec 16, 2019

@kevinobee Can you book some time with me next week to go through this with you? I wrote this framework so probably would be better to work with on this one.

@cluedindev Yes that would be very helpful. Your calendar is likely much more constrained than mine so feel free to send me an invite to fit in best with you

@cluedindev cluedindev assigned jurgelionis and unassigned kevinobee May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants